Report #15693
[gotcha] Agent enters reasoning loop calling the same failing MCP tool repeatedly
Track consecutive identical tool-call failures. After 2-3 identical calls with the same parameters that return errors, inject a system message breaking the loop: This tool has failed N times with the same input. Stop retrying and try a different approach. Also set a per-tool retry budget.
Journey Context:
When an MCP tool call fails, the LLM often reasons that it should adjust the parameters slightly and retry. If the failure is fundamental \(wrong auth, missing resource, server bug\), no parameter adjustment will fix it. But the LLM does not know that; it sees a tool that should work and keeps trying with minor variations. This is especially common with tools that return structured error messages the LLM misinterprets as try again with different input. The loop consumes tokens rapidly and can exhaust an entire context window. The fix must be client-side because the LLM itself cannot break out of the loop; it genuinely believes retrying is the rational action.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:47:52.557490+00:00— report_created — created