pub struct McpError {
pub code: i32,
pub message: String,
pub data: Option<Value>,
}Expand description
MCP JSON-RPC error structure
Fields§
§code: i32Error code
message: StringError message
data: Option<Value>Additional error data
Implementations§
Source§impl McpError
impl McpError
Sourcepub fn parse_error() -> McpError
pub fn parse_error() -> McpError
JSON-RPC parse error (-32700)
Sourcepub fn invalid_request(msg: &str) -> McpError
pub fn invalid_request(msg: &str) -> McpError
JSON-RPC invalid request (-32600)
Sourcepub fn method_not_found() -> McpError
pub fn method_not_found() -> McpError
JSON-RPC method not found (-32601)
Sourcepub fn invalid_params() -> McpError
pub fn invalid_params() -> McpError
JSON-RPC invalid params (-32602)
Sourcepub fn internal_error(msg: &str) -> McpError
pub fn internal_error(msg: &str) -> McpError
JSON-RPC internal error (-32603)
Sourcepub fn server_error(msg: &str) -> McpError
pub fn server_error(msg: &str) -> McpError
Server error (codes -32000 to -32099)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for McpError
impl<'de> Deserialize<'de> for McpError
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<McpError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<McpError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for McpError
impl Serialize for McpError
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for McpError
impl RefUnwindSafe for McpError
impl Send for McpError
impl Sync for McpError
impl Unpin for McpError
impl UnsafeUnpin 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