mcp_core_rs/protocol/
error.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4/// Error information for JSON-RPC error responses.
5#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
6pub struct ErrorData {
7    /// The error type that occurred.
8    pub code: i32,
9
10    /// A short description of the error. The message SHOULD be limited to a concise single
11    /// sentence.
12    pub message: String,
13
14    /// Additional information about the error. The value of this member is defined by the
15    /// sender (e.g. detailed error information, nested errors etc.).
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub data: Option<Value>,
18}