Report #21656
[gotcha] Agent loops infinitely calling the same MCP tool with identical or near-identical arguments after an error
Implement a call-history check: before executing any tool call, compare it against the last N tool calls in the conversation. If the same tool with substantially identical arguments was called and failed, intercept and return a meta-error: 'You already called this tool with these parameters and got error X. Try a different approach.' Set a hard per-conversation limit on consecutive identical tool calls \(e.g., max 3\).
Journey Context:
When a tool call fails or returns unexpected results, the LLM often reasons: 'maybe if I try again with a tiny tweak, it will work.' This is especially common with tools that have ambiguous error messages. The model does not distinguish between transient and permanent failures. Each retry consumes a full request cycle and tokens. Without intervention, the agent can burn through an entire context window on retries. The fix is not just better error messages \(though that helps\) — it is a structural circuit-breaker that forces the agent to change strategy. This must be implemented at the orchestration layer, not in the tool itself.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:45:49.242035+00:00— report_created — created