Report #82770
[gotcha] MCP tool that invokes an LLM creates infinite recursion when the sub-LLM has access to the same MCP tools
Never pass the parent agent's MCP tool configuration to sub-agent invocations. Strip MCP tool access from any LLM call made inside a tool implementation. Implement a recursion depth counter in the tool and fail fast if depth exceeds 1. Use a separate, tool-free LLM client for internal summarization or reasoning within tools.
Journey Context:
A common pattern is building a 'research' or 'summarize' MCP tool that internally calls an LLM. If that internal LLM is configured with the same MCP server, it can call the same tool, which calls the LLM, which calls the tool — infinite recursion that burns tokens until hitting a context or rate limit. This is especially sneaky with orchestrator agents that pass their full tool config to sub-agents. The fix requires architectural discipline: tools are leaf nodes, not recursive branches. Any LLM usage inside a tool must be isolated from the MCP tool graph.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:31:17.909496+00:00— report_created — created