Skip to content

error

Comprehensive error handling for MCP protocol operations

  • JSON-RPC 2.0 compliant error codes
  • Integration with protocol_transport_core error system
  • Authentication and authorization error handling
type McpResult = Result<T, McpError>;

Result type for MCP operations

MCP-specific errors

Variants

VariantDescription
JsonRpc(String)
Authentication(String)
Authorization(String)
ToolNotFound(String)
ToolExecutionFailed(String)
MemoryOperationFailed(String)
InvalidToolParameters(String)
ProtocolVersionMismatch { ... }
UnsupportedCapability(String)
Timeout(String)
ExternalServerError(String)
Transport(protocol_transport_core::TransportError)
Protocol(protocol_transport_core::ProtocolError)
Serialization(serde_json::Error)

Methods

fn is_retryable(&self) -> bool

Check if error is retryable

fn is_auth_error(&self) -> bool

Check if error is due to authentication

fn to_jsonrpc_code(&self) -> i32

Convert to JSON-RPC error code