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

sourcemcp_server.py

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!".

A

Who triggers a call

UserHostServerModel"What does report.pdf say?"1tools/list2read_doc_contents, edit_document +schemas3prompt + tool list4picks a tool by its name anddescriptiontool_use read_doc_contents {doc_id:"report.pdf"}5tools/call read_doc_contents6runs read_document()"The report details ..."7tool result8final answer9answer10
B

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.

C

Name vs function

  • Clients call tools by the registered name: read_doc_contents.
  • read_document is only the Python function name. No client sees it.
  • edit_document uses the same name for both.
D

Ways to call them today

without writing a clientbash
# 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.py
Running 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.