Report #73451
[tooling] Agents ignore rate limits and immediately retry failed MCP tool calls causing API bans
Return JSON-RPC error code -32002 \(ResourceLimitExceeded\) with structured data containing retry\_after seconds; implement client-side middleware that catches this specific error code and enforces exponential backoff \(2^attempt \* random\_jitter\) before allowing the agent to retry
Journey Context:
Most implementations return rate limit errors as successful tool results with text like 'Error: Rate limited'. The agent sees this as valid output and either tries again immediately or hallucinates workarounds. The correct approach leverages MCP's JSON-RPC error handling layer. By returning a proper error response with code -32002, the transport layer can intercept this before it reaches the agent's reasoning loop. The error data field should include retry\_after to enable intelligent backoff. This separates transport concerns \(rate limiting\) from application logic \(tool results\). Without this pattern, agents burn tokens on doomed retries and trigger circuit breakers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T05:52:57.133281+00:00— report_created — created