diff --git a/.claude/memory/MEMORY.md b/.claude/memory/MEMORY.md index e02b12fbc..59456d279 100644 --- a/.claude/memory/MEMORY.md +++ b/.claude/memory/MEMORY.md @@ -30,3 +30,4 @@ ### MCP Service - **[MCP Service Design](./mcp-service-design.md)** - MCP (Model Context Protocol) service architecture using FastMCP with SSE transport, JWT auth, 29 tools across 5 domains +- **[MCP Tool Description Location](./mcp-tool-description-guide.md)** - Where to define MCP tool descriptions: in `@mcp.tool()` functions in `__init__.py`, not in `*_TOOLS` arrays diff --git a/.claude/memory/mcp-tool-description-guide.md b/.claude/memory/mcp-tool-description-guide.md new file mode 100644 index 000000000..ca4ebcf42 --- /dev/null +++ b/.claude/memory/mcp-tool-description-guide.md @@ -0,0 +1,43 @@ +--- +name: mcp-tool-description-location +description: Where to define MCP tool descriptions so AI can see them +metadata: + type: reference +--- + +# MCP Tool Description Location + +## Key Point +MCP tool descriptions are defined in `@mcp.tool()` decorator functions in `__init__.py`, NOT in the `*_TOOLS` arrays in individual module files. + +## Correct Location +**File**: `gns3server/api/routes/mcp/__init__.py` + +**Example**: +```python +@mcp.tool() +async def update_link( + project_id: Annotated[str, Field(description="UUID of the project")], + link_id: Annotated[str, Field(description="UUID of the link to update")], + **kwargs: Any, +) -> list[dict[str, Any]]: + """Update a link's properties. + + Put detailed descriptions here, especially for complex parameters. + Include format requirements, ranges, and examples. + """ + # implementation +``` + +## Wrong Location +- ❌ `LINK_TOOLS` in `gns3server/api/routes/mcp/links.py` +- ❌ `TEMPLATE_TOOLS` in `gns3server/api/routes/mcp/templates.py` + +## Activation +**Must restart GNS3 server** for description updates to take effect. + +## Description Requirements +- Be explicit about data formats (arrays vs single values) +- Include parameter ranges and constraints +- Provide usage examples +- Prevent common errors in the description itself