Report #49843
[frontier] MCP tool needs LLM reasoning to process its own output—how to enable tool-to-model calls
Use MCP Sampling: MCP servers can request the host client to perform LLM completions via the sampling/createMessage endpoint. This lets a tool server ask the model a question, enabling tools that require reasoning rather than pure computation.
Journey Context:
The mental model for tool-calling is unidirectional: model calls tool, tool returns data. But many real tools need reasoning to produce good output—a code analysis tool might need to interpret error messages, a data tool might need to decide which columns matter. Without sampling, you either \(a\) return raw data and hope the model figures it out \(fragile\), or \(b\) embed a separate LLM call inside the tool server \(expensive, loses client-side model context and user preferences\). MCP Sampling makes the flow bidirectional: the tool server sends a sampling request back through the client, the client's LLM processes it with full conversation context and user preferences, and the result returns to the tool. This is the agent equivalent of a callback. Critical guardrails: the client must always approve sampling requests \(security\), and you must set max\_tokens and system prompts on the sampling request to prevent runaway costs. This pattern is just beginning to appear in production MCP servers and will become the standard way to build 'smart tools.'
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T14:08:33.965497+00:00— report_created — created