pub struct McpError {
pub code: ErrorCode,
pub message: String,
pub details: Option<Value>,
pub retryable: bool,
}Expand description
Structured error response for MCP tools.
Fields§
§code: ErrorCodeMachine-readable error code
message: StringHuman-readable error message
details: Option<Value>Additional context (e.g., matched session IDs for ambiguous prefix)
retryable: boolWhether the operation can be retried
Implementations§
Source§impl McpError
impl McpError
pub fn session_not_found(session_id: &str) -> Self
pub fn ambiguous_prefix(prefix: &str, matches: Vec<String>) -> Self
pub fn invalid_event_index(session_id: &str, index: usize, max: usize) -> Self
pub fn invalid_cursor(cursor: &str) -> Self
pub fn invalid_parameter(param_name: &str, reason: &str) -> Self
pub fn internal_error(message: String) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for McpError
impl<'de> Deserialize<'de> for McpError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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)>
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 JsonSchema for McpError
impl JsonSchema for McpError
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreAuto 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