pub enum McpError {
Show 18 variants
Transport(String),
Protocol(String),
Serialization(Error),
InvalidUri(String),
ToolNotFound(String),
ResourceNotFound(String),
PromptNotFound(String),
Connection(String),
Authentication(String),
Validation(String),
Io(Error),
Url(ParseError),
Http(String),
WebSocket(String),
SchemaValidation(String),
Timeout(String),
Cancelled(String),
Internal(String),
}
Expand description
The main error type for the MCP SDK
Variants§
Transport(String)
Transport-related errors (connection, I/O, etc.)
Protocol(String)
Protocol-level errors (invalid messages, unexpected responses, etc.)
Serialization(Error)
JSON serialization/deserialization errors
InvalidUri(String)
Invalid URI format or content
ToolNotFound(String)
Requested tool was not found
ResourceNotFound(String)
Requested resource was not found
PromptNotFound(String)
Requested prompt was not found
Connection(String)
Connection-related errors
Authentication(String)
Authentication/authorization errors
Validation(String)
Input validation errors
Io(Error)
I/O errors from the standard library
Url(ParseError)
URL parsing errors
Http(String)
HTTP-related errors when using HTTP transport
WebSocket(String)
WebSocket-related errors when using WebSocket transport
SchemaValidation(String)
JSON Schema validation errors
Timeout(String)
Timeout errors
Cancelled(String)
Cancellation errors
Internal(String)
Internal errors that shouldn’t normally occur
Implementations§
Source§impl McpError
impl McpError
Sourcepub fn validation<S: Into<String>>(message: S) -> Self
pub fn validation<S: Into<String>>(message: S) -> Self
Create a new validation error
Sourcepub fn connection<S: Into<String>>(message: S) -> Self
pub fn connection<S: Into<String>>(message: S) -> Self
Create a new connection error
Sourcepub fn serialization(err: Error) -> Self
pub fn serialization(err: Error) -> Self
Create a new serialization error from serde_json::Error
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Check if this error is recoverable