Report #1611
[gotcha] Agent enters infinite loop calling same MCP tool repeatedly with near-identical arguments
Implement a client-side call-deduplication guard: track \(tool\_name, args\_hash\) pairs within a session and refuse or flag repeated identical or near-identical calls. Set a max-retries-per-tool-per-turn limit \(e.g., 3\). When a tool returns an error, include a structured error object with a 'recovery\_suggestion' field that tells the model what to change, not just what went wrong.
Journey Context:
When a tool returns an error or unexpected result, the LLM's default behavior is to retry with a slight variation—which produces the same error, triggering another retry. This is especially common with tools that have strict input validation where the error message says what failed but not how to fix it. The loop is invisible from the server's perspective because each call is technically valid and independent. Client-side deduplication and retry caps are the only reliable circuit breakers. You cannot fix this at the tool level because the root cause is in the agent's reasoning about the result. The counter-intuitive fix is improving error messages: a structured 'recovery\_suggestion' field breaks the loop more effectively than any retry limit, because it gives the model a new reasoning path.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T04:32:51.683628+00:00— report_created — created