pub enum McpError {
Show 18 variants
Transport(String),
Protocol(String),
Serialization(String),
InvalidUri(String),
ToolNotFound(String),
ResourceNotFound(String),
PromptNotFound(String),
Connection(String),
Authentication(String),
Validation(String),
Io(String),
Url(String),
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(String)
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(String)
I/O errors from the standard library
Url(String)
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 connection_error<S: Into<String>>(message: S) -> Self
pub fn connection_error<S: Into<String>>(message: S) -> Self
Create a connection error (compatibility method)
Sourcepub fn protocol_error<S: Into<String>>(message: S) -> Self
pub fn protocol_error<S: Into<String>>(message: S) -> Self
Create a protocol error (compatibility method)
Sourcepub fn validation_error<S: Into<String>>(message: S) -> Self
pub fn validation_error<S: Into<String>>(message: S) -> Self
Create a validation error (compatibility method)
Sourcepub fn timeout_error() -> Self
pub fn timeout_error() -> Self
Create a timeout error (compatibility method)
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Check if this error is recoverable
Trait Implementations§
Source§impl Error for McpError
impl Error for McpError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<ParseError> for McpError
impl From<ParseError> for McpError
Source§fn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Auto Trait Implementations§
impl Freeze for McpError
impl RefUnwindSafe for McpError
impl Send for McpError
impl Sync for McpError
impl Unpin for McpError
impl UnwindSafe for McpError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.