Skip to main content
Glama
MCP_TOOLS_ADDED.md3.65 kB
# MCP Tools Discovery Fixed ✅ ## What Was Missing Your server was missing the **`@mcp._mcp_server.list_tools()`** handler. This is required for ChatGPT to discover available tools via the MCP protocol. ## What Was Added Added explicit tool listing handler in `server/main.py`: ```python @mcp._mcp_server.list_tools() async def list_tools() -> List[types.Tool]: """List available MCP tools for ChatGPT discovery""" return [ types.Tool(name="chess_move", ...), types.Tool(name="chess_status", ...), types.Tool(name="chess_reset", ...), types.Tool(name="chess_puzzle", ...), types.Tool(name="chess_stockfish", ...), ] ``` Each tool now includes: - ✅ Proper input schema - ✅ `_meta` with OpenAI-specific fields - ✅ Annotations (`readOnlyHint`, `destructiveHint`, `openWorldHint`) - ✅ Widget template associations ## How It Works 1. **Discovery Phase:** - ChatGPT calls `ListToolsRequest` - Server returns all 5 tools with metadata - ChatGPT knows what tools are available ✅ 2. **Invocation Phase:** - ChatGPT calls `CallToolRequest` with tool name + arguments - FastMCP routes to your `@mcp.tool()` decorated functions - Tool executes and returns result ✅ 3. **Widget Rendering:** - Tools marked with `openai/outputTemplate` render widgets - ChatGPT fetches HTML from `ReadResourceRequest` - Interactive chess board appears ✅ ## Your 5 Tools 1. **chess_move** - Make chess moves (e.g., "e4", "Nf3") 2. **chess_status** - Get game status and turn info 3. **chess_reset** - Reset game to starting position 4. **chess_puzzle** - Load mate-in-1 puzzles (easy/medium/hard) 5. **chess_stockfish** - Get engine analysis ## Next Steps ### 1. Restart Your Server ```bash cd /Users/jerel/Documents/Projects/ChessMCP/server python3 main.py ``` Watch for this log line when ChatGPT connects: ``` INFO: Processing request of type ListToolsRequest ``` ### 2. Test in ChatGPT Try these commands: **Start a game:** ``` Let's play chess! I'll start with e4 ``` **Check status:** ``` What's the current game status? ``` **Load a puzzle:** ``` Show me a chess puzzle ``` **Get analysis:** ``` What does Stockfish recommend? ``` ## Troubleshooting ### "Still don't see the app" The connector is configured, but you need to **use it in conversation**. Try: ``` Use the Chess MCP to play chess. I'll start with e4. ``` ChatGPT should recognize the tool and call it. ### "Tool not found" If ChatGPT says it can't find the tool: 1. Check server logs for `ListToolsRequest` - should return 5 tools 2. Restart server to ensure new tool list is loaded 3. Try again in a fresh ChatGPT conversation ### "No widget appears" Ensure: - `assets/chess-board.html` exists (run `npm run build` if missing) - Server logs show `ReadResourceRequest` - Check widget HTML is being returned ## Verification After restarting, test with curl: ```bash # This should now work (test ListTools via HTTP) curl -X POST https://shimmery-genevive-wooly.ngrok-free.dev/mcp \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' ``` You should see all 5 tools listed with their metadata. ## Success Indicators ✅ Server starts without errors ✅ `list_tools()` returns 5 Tool objects ✅ ChatGPT receives tool list on `ListToolsRequest` ✅ Natural language commands work ("Let's play chess") ✅ Interactive chess board appears ✅ Per-user game state maintained --- **Status:** Ready to test **Next:** Restart server and try chess commands in ChatGPT! 🎮♟️

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GeneralJerel/ChessMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server