Generated by Answer me with HTML 0.5.5 · 2026-10-22 13:44 · ★ Star on GitHub
When Tools Get Called
read_document and edit_document run only when a client sends tools/call
Lead: The server never calls its own tools. A client calls a tool when the model picks that tool to answer a request. Your project has no client yet: main.py only prints "Hello from mcp-docs!".
Who triggers a call
Which tool the model picks
| User request | Tool the model calls | Python function |
|---|---|---|
| "Summarize plan.md" | read_doc_contents | read_document |
| "What is in spec.txt?" | read_doc_contents | read_document |
| "In plan.md, change 'steps' to 'phases'" | edit_document | edit_document |
| "Fix a typo in report.pdf" | read_doc_contents, then edit_document | both, in order |
| "What is MCP?" | tool | none |
The model decides from the tool description and the parameter descriptions. A clear description makes the right pick more likely.
Name vs function
- Clients call tools by the registered
name:read_doc_contents. read_documentis only the Python function name. No client sees it.edit_documentuses the same name for both.
Ways to call them today
# Open MCP Inspector; click Tools → Runuv run mcp dev mcp_server.py# Add the server to Claude Code, then ask about a documentclaude mcp add documents -- uv run mcp_server.pyRunning the script alone does nothing visible
python mcp_server.py waits for JSON-RPC on stdin. No tool runs until a client sends tools/call.