Agents-MCP-Hackathon/documentation_mcp_tool
0
Pydocstyle Documentation Checker (via Modal MCP)
This Gradio application provides an interface to check Python code for documentation style issues using Pydocstyle. The analysis is performed by a Pydocstyle tool running on a Modal Labs Multi-Compute-Platform (MCP) server.
How to Use
- Input Parameters:
- The input field expects a JSON object.
- This JSON object must contain a key named
"code"whose value is the Python code string you want to analyze. - An example is pre-filled for convenience:
{
"code": "# No module docstring here\n\ndef example_function_missing_docstring():\n pass\n\nclass ExampleClassMissingDocstring:\n def method_missing_docstring(self):\n pass\n\ndef well_documented_function():\n \"\"\"This function is well documented.\"\"\"\n return True\n"
}- Submit: Click the "Submit" button.
- Output:
- The application will send the code to the Pydocstyle tool on the Modal MCP server.
- The results of the Pydocstyle analysis will be displayed as a JSON object in the output field. This JSON will typically include:
tool: "pydocstyle"errors: A list of documentation errors found, with details like error code, message, and line number.files_checked: Number of files checked (usually 1 for the provided code snippet).- Any errors encountered during the process.
Configuration
For this application to function correctly, the MODAL_MCP_ENDPOINT environment variable must be set. This variable should point to your deployed Modal function that handles MCP tool execution (e.g., the /execute_tool endpoint).
- Create a
.envfile in themcp_deploydirectory (or the root of your Space if deploying to Hugging Face Spaces and it's not automatically picked up from this directory). - Add the following line to the
.envfile, replacing the placeholder with your actual Modal endpoint URL:
MODAL_MCP_ENDPOINT="https://your-username--mcp-server-app-execute-tool.modal.run"If the MODAL_MCP_ENDPOINT is not set or is incorrect, the application will display an error message upon submission.
Next step
Add more tools to analyse different other aspects.
