pub enum McpError {
Show 17 variants
Integration(IntegrationError),
Protocol(ProtocolError),
NotConnected,
CapabilityNegotiationFailed {
reason: String,
},
UnsupportedCapability {
capability: String,
},
ResourceNotFound {
uri: String,
},
ToolNotFound {
name: String,
},
ToolExecutionFailed {
name: String,
reason: String,
},
PromptNotFound {
name: String,
},
InvalidPromptArguments {
prompt: String,
reason: String,
},
SubscriptionFailed {
uri: String,
reason: String,
},
ServerError {
message: String,
},
Timeout {
seconds: u64,
},
InvalidResponse {
reason: String,
},
AlreadyConnected,
InvalidState {
state: String,
},
Custom {
message: String,
},
}Expand description
MCP-specific error types
Variants§
Integration(IntegrationError)
Integration layer error (JSON-RPC, transport)
Protocol(ProtocolError)
Protocol-specific error (validation, format)
NotConnected
Connection not established or lost
CapabilityNegotiationFailed
Capability negotiation failed
UnsupportedCapability
Server does not support requested capability
ResourceNotFound
Resource not found
ToolNotFound
Tool not found
ToolExecutionFailed
Tool execution failed
PromptNotFound
Prompt not found
InvalidPromptArguments
Invalid prompt arguments
SubscriptionFailed
Subscription failed
ServerError
Server error response
Timeout
Timeout waiting for response
InvalidResponse
Invalid server response format
AlreadyConnected
Connection already established
InvalidState
Operation not allowed in current state
Custom
Custom error for user-defined errors
Implementations§
Source§impl McpError
impl McpError
Sourcepub fn capability_negotiation_failed(reason: impl Into<String>) -> Self
pub fn capability_negotiation_failed(reason: impl Into<String>) -> Self
Create a capability negotiation failed error
Sourcepub fn unsupported_capability(capability: impl Into<String>) -> Self
pub fn unsupported_capability(capability: impl Into<String>) -> Self
Create an unsupported capability error
Sourcepub fn resource_not_found(uri: impl Into<String>) -> Self
pub fn resource_not_found(uri: impl Into<String>) -> Self
Create a resource not found error
Sourcepub fn tool_not_found(name: impl Into<String>) -> Self
pub fn tool_not_found(name: impl Into<String>) -> Self
Create a tool not found error
Sourcepub fn tool_execution_failed(
name: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn tool_execution_failed( name: impl Into<String>, reason: impl Into<String>, ) -> Self
Create a tool execution failed error
Sourcepub fn prompt_not_found(name: impl Into<String>) -> Self
pub fn prompt_not_found(name: impl Into<String>) -> Self
Create a prompt not found error
Sourcepub fn invalid_response(reason: impl Into<String>) -> Self
pub fn invalid_response(reason: impl Into<String>) -> Self
Create an invalid response error
Sourcepub fn invalid_request(details: impl Into<String>) -> Self
pub fn invalid_request(details: impl Into<String>) -> Self
Create an invalid request error
Sourcepub fn method_not_found(method: impl Into<String>) -> Self
pub fn method_not_found(method: impl Into<String>) -> Self
Create a method not found error
Sourcepub fn server_error(message: impl Into<String>) -> Self
pub fn server_error(message: impl Into<String>) -> Self
Create a server error
Sourcepub fn already_connected() -> Self
pub fn already_connected() -> Self
Create an already connected error
Sourcepub fn invalid_state(state: impl Into<String>) -> Self
pub fn invalid_state(state: impl Into<String>) -> Self
Create an invalid state error
Sourcepub fn internal_error(message: impl Into<String>) -> Self
pub fn internal_error(message: impl Into<String>) -> Self
Create an internal error (alias for server_error)
Sourcepub fn invalid_prompt_arguments(
prompt: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn invalid_prompt_arguments( prompt: impl Into<String>, reason: impl Into<String>, ) -> Self
Create an invalid prompt arguments error
Sourcepub fn subscription_failed(
uri: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn subscription_failed( uri: impl Into<String>, reason: impl Into<String>, ) -> Self
Create a subscription failed error
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Check if this error is recoverable (can retry)
Sourcepub fn is_connection_error(&self) -> bool
pub fn is_connection_error(&self) -> bool
Check if this error indicates a connection problem
Trait Implementations§
Source§impl Error for McpError
impl Error for McpError
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<IntegrationError> for McpError
impl From<IntegrationError> for McpError
Source§fn from(source: IntegrationError) -> Self
fn from(source: IntegrationError) -> Self
Source§impl From<ProtocolError> for McpError
impl From<ProtocolError> for McpError
Source§fn from(source: ProtocolError) -> Self
fn from(source: ProtocolError) -> Self
Source§impl From<TransportError> for McpError
impl From<TransportError> for McpError
Source§fn from(err: TransportError) -> Self
fn from(err: TransportError) -> Self
Source§impl From<TransportError> for McpError
impl From<TransportError> for McpError
Source§fn from(err: TransportError) -> Self
fn from(err: TransportError) -> 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> 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.