Report #17980
[gotcha] MCP tool requesting sampling creates circular dependency with the calling LLM
Avoid issuing sampling/createMessage requests from tools called by the same LLM client that must service them. If server-side LLM generation is needed, use a separate model instance or implement the logic without an LLM roundtrip. Treat sampling as a client-to-server capability, not a tool-to-caller callback.
Journey Context:
MCP's sampling feature lets a server request the client's LLM to generate text, for summarization or decision-making. But if the LLM is currently blocked waiting for a tool result, and that tool issues a sampling request back to the same LLM client, a circular dependency forms. The client cannot service the sampling request because its LLM call is occupied waiting for the tool. This deadlock is invisible — no error is produced, the request simply hangs indefinitely. The MCP spec notes sampling is optional and client-driven but does not explicitly warn about this deadlock pattern. The fix is architectural: never create a call cycle between tool execution and LLM inference on the same session.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:53:45.890217+00:00— report_created — created