Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Do not retry a side-effecting tool when a transport failure leaves it ambiguous whether the original call already ran; a blind retry can double-charge or double-write.
Think about hitting Submit on a checkout page and the screen freezing. Did the payment go through, or not? If you click Submit again to be safe, you might get charged twice. The safe move is to check the order history first, not blindly resubmit. A production MCP client faces the same problem. When a tool call times out, the client cannot tell whether the server already ran the tool before the connection dropped. For a read like list files, retrying is harmless. For a write like send payment, retrying could fire it twice. So the rule is: retry freely when the action is safe to repeat, but never blindly retry an action that changes the world when you are unsure it already happened.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: two failure classes (protocol vs tool isError) + the ambiguous-write hazard + idempotency keys + backoff with jitter + when to escalate instead of retry.
| Failure | Shape | Retry? |
|---|---|---|
| Transport timeout, read-only tool | No response / socket drop | Yes, with backoff |
| Transport timeout, side-effecting tool | No response / socket drop | Only with an idempotency key |
| HTTP 503 / 5xx | Server overloaded | Yes if safe to repeat |
| JSON-RPC -32601 / -32602 | Protocol error object | No, permanent |
| Tool result with isError true | Valid result, logical failure | No, surface it |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Retrying every failure with blanket backoff. That double-fires non-idempotent tools whenever a timeout hides a call that actually succeeded.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.