File size: 2,631 Bytes
6d5e18e da957a4 6d5e18e a7c3236 6d5e18e 7a7a0f0 da957a4 6d5e18e 7a7a0f0 da957a4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
---
title: Documentation Mcp Tool
emoji: π
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 5.33.1
app_file: app.py
pinned: false
license: mit
tags:
- mcp-server-track
- pydocstyle
- code-analysis
- documentation
- modal
short_description: Analyzes Python code for docstring convention
---
## 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](https://modal.com) Multi-Compute-Platform (MCP) server.
### How to Use
1. **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:
```json
{
"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"
}
```
2. **Submit**: Click the "Submit" button.
3. **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 `.env` file in the `mcp_deploy` directory (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 `.env` file, 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. |