pub enum McpError {
Show 20 variants
VersionMismatch {
expected: String,
actual: String,
},
InvalidCapability(String),
ToolNotFound(String),
ResourceNotFound(String),
PromptNotFound(String),
InvalidParameters(String),
MissingParameter(String),
InvalidParameterType {
param: String,
expected: String,
actual: String,
},
ParameterOutOfRange {
param: String,
value: String,
constraint: String,
},
ToolExecutionError(String),
ResourceExecutionError(String),
PromptExecutionError(String),
ResourceAccessDenied(String),
ConfigurationError(String),
SessionError(String),
ValidationError(String),
IoError(Error),
SerializationError(Error),
TransportError(String),
JsonRpcProtocolError(String),
}
Expand description
MCP-specific errors
Variants§
VersionMismatch
InvalidCapability(String)
ToolNotFound(String)
ResourceNotFound(String)
PromptNotFound(String)
InvalidParameters(String)
MissingParameter(String)
InvalidParameterType
ParameterOutOfRange
ToolExecutionError(String)
ResourceExecutionError(String)
PromptExecutionError(String)
ResourceAccessDenied(String)
ConfigurationError(String)
SessionError(String)
ValidationError(String)
IoError(Error)
SerializationError(Error)
TransportError(String)
JsonRpcProtocolError(String)
Implementations§
Source§impl McpError
impl McpError
Sourcepub fn missing_param(param: &str) -> McpError
pub fn missing_param(param: &str) -> McpError
Create a missing parameter error
Sourcepub fn invalid_param_type(param: &str, expected: &str, actual: &str) -> McpError
pub fn invalid_param_type(param: &str, expected: &str, actual: &str) -> McpError
Create an invalid parameter type error
Sourcepub fn param_out_of_range(
param: &str,
value: &str,
constraint: &str,
) -> McpError
pub fn param_out_of_range( param: &str, value: &str, constraint: &str, ) -> McpError
Create a parameter out of range error
Sourcepub fn tool_execution(message: &str) -> McpError
pub fn tool_execution(message: &str) -> McpError
Create a tool execution error
Sourcepub fn resource_execution(message: &str) -> McpError
pub fn resource_execution(message: &str) -> McpError
Create a resource execution error
Sourcepub fn prompt_execution(message: &str) -> McpError
pub fn prompt_execution(message: &str) -> McpError
Create a prompt execution error
Sourcepub fn validation(message: &str) -> McpError
pub fn validation(message: &str) -> McpError
Create a validation error
Sourcepub fn configuration(message: &str) -> McpError
pub fn configuration(message: &str) -> McpError
Create a configuration error
Sourcepub fn json_rpc_protocol(message: &str) -> McpError
pub fn json_rpc_protocol(message: &str) -> McpError
Create a JSON-RPC protocol error
Sourcepub fn to_error_object(&self) -> JsonRpcErrorObject
pub fn to_error_object(&self) -> JsonRpcErrorObject
Convert to a JsonRpcErrorObject for JSON-RPC 2.0 responses
Sourcepub fn to_json_rpc_response(&self, id: Option<RequestId>) -> JsonRpcError
pub fn to_json_rpc_response(&self, id: Option<RequestId>) -> JsonRpcError
Create a JSON-RPC error response for this MCP error
Sourcepub fn to_json_rpc_error(&self) -> JsonRpcErrorObject
👎Deprecated: Use to_error_object() instead for cleaner architecture
pub fn to_json_rpc_error(&self) -> JsonRpcErrorObject
Legacy method for backward compatibility - use to_error_object() instead
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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl ToJsonRpcError for McpError
impl ToJsonRpcError for McpError
Source§fn to_error_object(&self) -> JsonRpcErrorObject
fn to_error_object(&self) -> JsonRpcErrorObject
Convert this error to a JSON-RPC error object
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
Mutably borrows from an owned value. Read more