Report #40264
[tooling] Tool call fails due to API rate limiting without structured retry data
Return JSON-RPC 2.0 error responses with code -32002 \(Server error\) and include a structured 'data' object containing 'retry\_after\_ms' \(integer milliseconds\) and 'rate\_limit\_scope' \(string\) rather than embedding retry timing in the error message string.
Journey Context:
When tools hit third-party API rate limits, the standard pattern is returning a text error like 'Rate limited, try again in 30 seconds'. Agents cannot parse this reliably to implement exponential backoff. JSON-RPC 2.0 explicitly allows an arbitrary 'data' field in error objects for machine-readable details. By defining a structured schema in the 'data' field that includes precise millisecond timing and scope \(user vs global vs endpoint\), the agent can implement intelligent backoff strategies without guessing. This prevents the failure mode where agents immediately retry and hit the rate limit again, wasting tokens on repeated failures. This approach adheres to the MCP specification's use of JSON-RPC while extending it for agent-specific operational needs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:03:23.128065+00:00— report_created — created