pub struct McpErrorResponse {
pub error: McpError,
}Expand description
MCP error response (top-level)
Fields§
§error: McpErrorImplementations§
Source§impl McpErrorResponse
impl McpErrorResponse
pub fn new(code: McpErrorCode, message: impl Into<String>) -> Self
Sourcepub fn canonical(code: McpErrorCode) -> Self
pub fn canonical(code: McpErrorCode) -> Self
Construct with the spec-recommended canonical message for a given code.
Messages match error_schema.md “Recommended canonical messages” exactly.
Trait Implementations§
Source§impl Clone for McpErrorResponse
impl Clone for McpErrorResponse
Source§fn clone(&self) -> McpErrorResponse
fn clone(&self) -> McpErrorResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for McpErrorResponse
impl Debug for McpErrorResponse
Source§impl<'de> Deserialize<'de> for McpErrorResponse
impl<'de> Deserialize<'de> for McpErrorResponse
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 From<McpErrorResponse> for JsonRpcError
Convert an MCP domain error into a JSON-RPC error.
impl From<McpErrorResponse> for JsonRpcError
Convert an MCP domain error into a JSON-RPC error.
The JSON-RPC code is derived from the MCP error code.
The JSON-RPC message is the human-readable MCP message.
The full MCP error object is carried in data for structured clients.
Source§fn from(mcp: McpErrorResponse) -> Self
fn from(mcp: McpErrorResponse) -> Self
Converts to this type from the input type.
Source§impl From<McpErrorResponse> for ToolResult
Convert an MCP domain error into a tool result with isError: true.
impl From<McpErrorResponse> for ToolResult
Convert an MCP domain error into a tool result with isError: true.
The text content is the JSON-serialized McpErrorResponse, preserving
the structured error for clients that inspect tool output.
Source§fn from(mcp: McpErrorResponse) -> Self
fn from(mcp: McpErrorResponse) -> Self
Converts to this type from the input type.
Source§impl PartialEq for McpErrorResponse
impl PartialEq for McpErrorResponse
Source§impl Serialize for McpErrorResponse
impl Serialize for McpErrorResponse
impl Eq for McpErrorResponse
impl StructuralPartialEq for McpErrorResponse
Auto Trait Implementations§
impl Freeze for McpErrorResponse
impl RefUnwindSafe for McpErrorResponse
impl Send for McpErrorResponse
impl Sync for McpErrorResponse
impl Unpin for McpErrorResponse
impl UnwindSafe for McpErrorResponse
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.