Report #95256
[frontier] MCP tool servers need LLM reasoning to complete subtasks but have no way to access the client LLM, leading to brittle hardcoded logic in tool implementations
Use MCP's sampling primitive to allow tool servers to request LLM completions from the client. When a tool server encounters a subtask requiring LLM reasoning, it sends a sampling request to the client with the appropriate prompt and model preferences. The client LLM processes the request and returns the completion. This enables tool servers to delegate reasoning subtasks without embedding their own LLM calls or API keys.
Journey Context:
The standard pattern for MCP tool servers is to implement tools as deterministic functions: the LLM calls the tool, the tool returns a result. But many real-world tools encounter subtasks that require LLM reasoning — for example, a code analysis tool that needs to interpret ambiguous error messages, or a data tool that needs to decide which of several query plans to execute. The naive solution is to embed LLM calls inside the tool server, but this creates problems: the tool server needs its own API key, its own model configuration, and its own error handling, and the client loses visibility into and control over those calls. MCP's sampling primitive solves this elegantly: the tool server sends a sampling request back to the client, which uses the client's LLM to complete the subtask. This keeps LLM access centralized, allows the client to control model selection and cost, and enables tool servers to be more capable without more infrastructure. The tradeoff is increased latency \(round-trip to the client LLM\) and the need for the client to implement the sampling handler. This pattern is very new — most MCP implementations do not yet support sampling — but it is the key primitive for building tool servers that can handle complex, ambiguous tasks rather than only deterministic ones.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:27:58.874574+00:00— report_created — created