Report #64132
[frontier] MCP server needs LLM reasoning during tool execution but only has tool-calling capability
Use MCP Sampling to let servers request LLM completions through the client. Implement a sampling message handler on the client side that approves and routes server-initiated LLM requests, enabling server-side intelligence without coupling the server to a specific model provider.
Journey Context:
Most developers treat MCP as a simple tool-calling protocol where the LLM calls tools on the server. But MCP's sampling capability inverts this: servers can request LLM completions from the client. This enables patterns where a tool execution can ask the LLM for clarification mid-execution, or where a resource server can intelligently summarize content before returning it. The tradeoff is that sampling requires client approval \(human-in-the-loop by default\), adding latency. But this is the key unlock for 'smart tools' that need reasoning, not just execution. People commonly get this wrong by embedding LLM calls inside MCP servers directly, coupling the server to a specific model provider and breaking the protocol's provider-agnostic abstraction. The correct pattern is to use sampling: the server requests a completion, the client routes it to whatever model it is using, and returns the result. This keeps the server model-agnostic and lets the client control model selection, cost, and approval.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:07:56.377790+00:00— report_created — created