How should an agent handle errors from an MCP server?

Pass a tool result marked isError: true back to the model, and handle JSON-RPC errors in the client: retry -32022 with a version from the server’s data.supported list, resend with the capabilities -32021 names if your client has them, and otherwise fix the request or stop. That’s per the Model Context Protocol’s 2026-07-28 specification, current as of October 2026.

The standard codes come from the JSON-RPC 2.0 specification: -32700 parse error, -32600 invalid request, -32601 method not found, -32602 invalid params, and -32603 internal error. MCP uses -32602 for an unknown tool, a missing resource, and a request without its required _meta fields. Sent again unchanged, those fail again, which is how a retry storm starts. -32603 is the one a retry might fix, but the spec sets no retry rule for it, so bound it yourself.

-32020 means required HTTP headers are missing or don’t match the request body, so your client sent something wrong. Codes from -32000 to -32019 are legacy, and the spec says not to read a meaning into them, except -32002, which older servers send for a missing resource. A timeout your SDK raises carries no MCP code, since it never came from the server, and the request may still be running there, so resending it can run it twice.

published

sources

keep reading

More on this.

Try Tessary on Cloud.

free · 10,000 traces a month · 1 GB · 30-day retention · $10 one-time credit for triage and RCA · no credit card