Inside a Tool Call
Step-by-step breakdown of an LLM tool call: request, schema validation, execution, and result handling with code examples.
Last updated
After this section you can
- Trace one tool call through every message on the wire and name each field that matters
- Build the follow-up request correctly, including parallel calls and failed tools
- Explain where MCP’s JSON-RPC sits relative to the model’s tool_use blocks
Inside a Tool Call: The Exact JSON
You know the idea: the model asks, your code acts. This is what actually crosses the wire, field by field, and the handful of rules that make the next request succeed or fail.
A tool call is a relay in four pieces. You send tool definitions; the model answers with a tool_use block and stops; your code runs the tool; you send back a tool_result with the same id. Then the model answers.