Put the MCP tool discovery and invocation steps in the correct order
- 1Server executes the tool and returns a `content` array (with optional `isError: true`)
- 2Host injects tool descriptions into the LLM's context
- 3Host sends `tools/call` with `name` and `arguments` to the server
- 4LLM decides to call a tool and emits a structured function-call request
- 5Server returns an array of tool objects, each with `name`, `description`, and `inputSchema`
- 6Host sends `tools/list` to the server to discover available tools
MCP tool use is discovery-before-call: the host lists tools, injects their schemas into the model, the model picks one, then the host invokes it and returns the result.
Imagine walking into a workshop you've never seen. First you read the labels on every machine to learn what each does and which buttons it needs. That is the host asking the server for its tool list. Then you decide which machine fits your task, set its dials correctly, and press start. That is the model picking a tool and the host running it. The machine does its work and hands you the finished part, which is the server returning a result. You never press start before reading the labels, because you would not know what the machine expects. MCP enforces the same order: discover what exists and how to call it, then call it.
Detailed answer & concept explanation~7 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: handshake then tools/list discovery, schema injection into the model, model selection, tools/call dispatch, content array result, and why the order cannot invert.
| Step | Message | Direction |
|---|---|---|
| Discover tools | tools/list | Host to server |
| Return catalog | Array with name, description, inputSchema | Server to host |
| Expose to model | Tool definitions injected into context | Host to model |
| Model selects | Structured function-call request | Model to host |
| Invoke tool | tools/call with name and arguments | Host to server |
| Return result | content array, optional isError true | Server to host |
Real products, models, and research that use this idea.
- Claude Code calls tools/list on each configured server at session start, then injects the discovered tools as Anthropic tool definitions.
- Cursor and Zed run the same discover-then-call loop over JSON-RPC, so any MCP server written once works across all three hosts.
- The mcp-inspector tool lets you watch the tools/list response and the tools/call round-trip live while building a server.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does the host handle two servers that both advertise a tool named search?
QWhat changes if the tool list can change mid-session rather than only at startup?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Putting the tool call before discovery. The model cannot invoke a tool whose name and argument schema it has never seen injected into context.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.