Expand description
Error types for MCP
§JSON-RPC Error Codes
Standard JSON-RPC 2.0 error codes are defined in the specification: https://www.jsonrpc.org/specification#error_object
| Code | Message | Meaning |
|---|---|---|
| -32700 | Parse error | Invalid JSON was received |
| -32600 | Invalid Request | The JSON sent is not a valid Request |
| -32601 | Method not found | The method does not exist / is not available |
| -32602 | Invalid params | Invalid method parameter(s) |
| -32603 | Internal error | Internal JSON-RPC error |
§MCP-Specific Error Codes
MCP uses the server error range (-32000 to -32099) for protocol-specific errors. Codes assigned by the spec are marked spec; codes used only by this implementation (in the JSON-RPC “implementation-defined” subrange) are marked impl.
| Code | Name | Source | Meaning |
|---|---|---|---|
| -32000 | ConnectionClosed | impl | Transport connection was closed |
| -32001 | HeaderMismatch | spec (SEP-2243) | HTTP headers do not match the request body, or required headers are missing/malformed |
| -32002 | ResourceNotFound | deprecated | SEP-2164 reassigned to -32602; variant kept for backcompat |
| -32003 | MissingRequiredClientCapability | spec (SEP-2575) | Client lacks a capability required by the request |
| -32004 | UnsupportedProtocolVersion | spec (SEP-2575) | Server does not support the request’s protocol version |
| -32005 | SessionNotFound | impl | Session not found or expired (legacy; deprecated by SEP-2567) |
| -32006 | SessionRequired | impl | Mcp-Session-Id header required (legacy; deprecated by SEP-2567) |
| -32007 | Forbidden | impl | Access forbidden (insufficient scope) |
| -32008 | AlreadySubscribed | impl | Resource already subscribed (moved from -32003 to avoid collision with SEP-2575) |
| -32009 | NotSubscribed | impl | Resource not subscribed (moved from -32004 to avoid collision with SEP-2575) |
| -32010 | RequestTimeout | impl | Request exceeded timeout (moved from -32001 to avoid collision with SEP-2243) |
| -32042 | UrlElicitationRequired | TS SDK | URL elicitation required |
Structs§
- Json
RpcError - JSON-RPC error object
- Tool
Error - Tool execution error with context
- Unsupported
Protocol Version Data - SEP-2575 error data for
UnsupportedProtocolVersion(-32004).
Enums§
- Error
- tower-mcp error type
- Error
Code - Standard JSON-RPC error codes
- McpError
Code - MCP-specific error codes (in the -32000 to -32099 range).
Traits§
- Result
Ext - Extension trait for converting errors into tower-mcp tool errors.