diff --git a/Cargo.lock b/Cargo.lock index 908a08b..23408b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "cpufeatures" @@ -58,9 +58,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "json5" @@ -75,27 +75,21 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.169" +version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "once_cell" -version = "1.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "pest" -version = "2.7.15" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" +checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323" dependencies = [ "memchr", "thiserror", @@ -104,9 +98,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.15" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816518421cfc6887a0d62bf441b6ffb4536fcc926395a69e1a85852d4363f57e" +checksum = "bb056d9e8ea77922845ec74a1c4e8fb17e7c218cc4fc11a15c5d25e189aa40bc" dependencies = [ "pest", "pest_generator", @@ -114,9 +108,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.15" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d1396fd3a870fc7838768d171b4616d5c91f6cc25e377b673d714567d99377b" +checksum = "87e404e638f781eb3202dc82db6760c8ae8a1eeef7fb3fa8264b2ef280504966" dependencies = [ "pest", "pest_meta", @@ -127,29 +121,28 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.15" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea" +checksum = "edd1101f170f5903fde0914f899bb503d9ff5271d7ba76bbb70bea63690cc0d5" dependencies = [ - "once_cell", "pest", "sha2", ] [[package]] name = "proc-macro2" -version = "1.0.93" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -165,9 +158,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "serde" @@ -191,9 +184,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a" dependencies = [ "itoa", "memchr", @@ -203,9 +196,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures", @@ -214,9 +207,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.96" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", @@ -225,18 +218,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.11" +version = "2.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.11" +version = "2.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" dependencies = [ "proc-macro2", "quote", @@ -245,9 +238,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "ucd-trie" @@ -257,9 +250,9 @@ checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "unicode-ident" -version = "1.0.16" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "version_check" diff --git a/Cargo.toml b/Cargo.toml index 5945383..90f6412 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,8 +14,8 @@ edition = "2021" path = "src/rust-mcp-schema.rs" [dependencies] -serde = { version = "1.0.219", features = ["derive"] } -serde_json = { version = "1.0.140" } +serde = { version = "1.0", features = ["derive"] } +serde_json = { version = "1.0.143" } [dev-dependencies] diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..7855e6d --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.88.0" +components = ["rustfmt", "clippy"] diff --git a/scripts/run_test.sh b/scripts/run_test.sh index b839f18..764b552 100755 --- a/scripts/run_test.sh +++ b/scripts/run_test.sh @@ -4,7 +4,7 @@ COMMON_FEATURES=("schema_utils") # schema versions features (tested one at a time) -SCHEMA_VERSION_FEATURES=("2025_06_18", "2025_03_26", "2024_11_05", "draft") +SCHEMA_VERSION_FEATURES=("2025_06_18", "2025_03_26", "2024_11_05") #// TODO: add the "draft" tests back # space-separated string COMMON_FEATURES_STR="${COMMON_FEATURES[*]}" diff --git a/src/generated_schema/2024_11_05/mcp_schema.rs b/src/generated_schema/2024_11_05/mcp_schema.rs index 9010456..71362e1 100644 --- a/src/generated_schema/2024_11_05/mcp_schema.rs +++ b/src/generated_schema/2024_11_05/mcp_schema.rs @@ -5,8 +5,8 @@ /// modify or extend the implementations as needed, but please do so at your own risk. /// /// Generated from : -/// Hash : 0695a497eb50a804fc0e88c18a93a21a675d6b3e -/// Generated at : 2025年07月27日 15:33:20 +/// Hash : a470342d05c345b580642821605b9c885bad237b +/// Generated at : 2025年08月29日 19:12:22 /// ---------------------------------------------------------------------------- /// /// MCP Protocol Version diff --git a/src/generated_schema/2024_11_05/schema_utils.rs b/src/generated_schema/2024_11_05/schema_utils.rs index 056023e..811c347 100644 --- a/src/generated_schema/2024_11_05/schema_utils.rs +++ b/src/generated_schema/2024_11_05/schema_utils.rs @@ -236,6 +236,11 @@ impl ClientMessage { pub fn is_initialize_request(&self) -> bool { matches!(self, Self::Request(request) if request.request.is_initialize_request()) } + + /// Returns `true` if the message is an `InitializedNotification` + pub fn is_initialized_notification(&self) -> bool { + matches!(self, Self::Notification(notofication) if notofication.notification.is_initialized_notification()) + } } impl From for ClientMessage { @@ -519,7 +524,7 @@ impl TryFrom for ClientNotification { } impl NotificationFromClient { - /// Checks if the current notification is an `InitializedNotification` from the client, indicating that the client has been initialized. + /// Returns `true` if the message is an `InitializedNotification` pub fn is_initialized_notification(&self) -> bool { matches!( self, @@ -1318,10 +1323,15 @@ pub enum MessageFromClient { } impl MessageFromClient { - /// Returns `true` if the request is an `InitializeRequest`. + /// Returns `true` if the message is an `InitializeRequest`. pub fn is_initialize_request(&self) -> bool { matches!(self, Self::RequestFromClient(request) if request.is_initialize_request()) } + + /// Returns `true` if the message is an `InitializedNotification` + pub fn is_initialized_notification(&self) -> bool { + matches!(self, Self::NotificationFromClient(notofication) if notofication.is_initialized_notification()) + } } impl From for MessageFromClient { @@ -1450,12 +1460,60 @@ impl CallToolError { } /// Specific constructor to create a `CallToolError` for an `UnknownTool` error. - pub fn unknown_tool(tool_name: String) -> Self { + pub fn unknown_tool(tool_name: impl Into) -> Self { // Create a `CallToolError` from an `UnknownTool` error (wrapped in a `Box`). - CallToolError(Box::new(UnknownTool(tool_name))) + CallToolError(Box::new(UnknownTool(tool_name.into()))) + } + + pub fn invalid_arguments(tool_name: impl Into, message: Option>) -> Self { + let tool_name = tool_name.into(); + let message = message.map(|m| m.into()); + + let full_message = match message { + Some(msg) => format!("Invalid arguments for tool '{tool_name}': {msg}" ), + None => format!("Invalid arguments for tool '{tool_name}'"), + }; + Self::from_message(full_message) + } + + /// Creates a new `CallToolError` from a string message. + /// + /// This is useful for generating ad-hoc or one-off errors without defining a custom error type. + /// Internally, it wraps the string in a lightweight error type that implements the `Error` trait. + /// + /// # Examples + /// + /// ``` + /// let err = CallToolError::from_message("Something went wrong"); + /// println!("{:?}", err); + /// ``` + /// + /// # Parameters + /// + /// - `message`: Any type that can be converted into a `String` (e.g., `&str` or `String`) + /// + /// # Returns + /// + /// A `CallToolError` wrapping a dynamic error created from the provided message. + pub fn from_message(message: impl Into) -> Self { + struct MsgError(String); + impl std::fmt::Debug for MsgError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } + } + impl std::fmt::Display for MsgError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } + } + impl std::error::Error for MsgError {} + + CallToolError::new(MsgError(message.into())) } } + /// Converts a `CallToolError` into a `RpcError`. /// /// The conversion creates an internal error variant of `RpcError` @@ -1508,8 +1566,6 @@ impl> From for TextContent { } } - - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(untagged)] #[allow(clippy::large_enum_variant)] @@ -1568,8 +1624,6 @@ impl Display for ClientMessages { } } - - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(untagged)] #[allow(clippy::large_enum_variant)] @@ -1628,8 +1682,6 @@ impl Display for ServerMessages { } } - - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(untagged)] #[allow(clippy::large_enum_variant)] diff --git a/src/generated_schema/2025_03_26/mcp_schema.rs b/src/generated_schema/2025_03_26/mcp_schema.rs index 587d210..af8a838 100644 --- a/src/generated_schema/2025_03_26/mcp_schema.rs +++ b/src/generated_schema/2025_03_26/mcp_schema.rs @@ -5,8 +5,8 @@ /// modify or extend the implementations as needed, but please do so at your own risk. /// /// Generated from : -/// Hash : 0695a497eb50a804fc0e88c18a93a21a675d6b3e -/// Generated at : 2025年07月27日 15:33:21 +/// Hash : a470342d05c345b580642821605b9c885bad237b +/// Generated at : 2025年08月29日 19:12:23 /// ---------------------------------------------------------------------------- /// /// MCP Protocol Version diff --git a/src/generated_schema/2025_03_26/schema_utils.rs b/src/generated_schema/2025_03_26/schema_utils.rs index 12eed17..48c7065 100644 --- a/src/generated_schema/2025_03_26/schema_utils.rs +++ b/src/generated_schema/2025_03_26/schema_utils.rs @@ -236,6 +236,11 @@ impl ClientMessage { pub fn is_initialize_request(&self) -> bool { matches!(self, Self::Request(request) if request.request.is_initialize_request()) } + + /// Returns `true` if the message is an `InitializedNotification` + pub fn is_initialized_notification(&self) -> bool { + matches!(self, Self::Notification(notofication) if notofication.notification.is_initialized_notification()) + } } impl From for ClientMessage { @@ -519,7 +524,7 @@ impl TryFrom for ClientNotification { } impl NotificationFromClient { - /// Checks if the current notification is an `InitializedNotification` from the client, indicating that the client has been initialized. + /// Returns `true` if the message is an `InitializedNotification` pub fn is_initialized_notification(&self) -> bool { matches!( self, @@ -1318,10 +1323,15 @@ pub enum MessageFromClient { } impl MessageFromClient { - /// Returns `true` if the request is an `InitializeRequest`. + /// Returns `true` if the message is an `InitializeRequest`. pub fn is_initialize_request(&self) -> bool { matches!(self, Self::RequestFromClient(request) if request.is_initialize_request()) } + + /// Returns `true` if the message is an `InitializedNotification` + pub fn is_initialized_notification(&self) -> bool { + matches!(self, Self::NotificationFromClient(notofication) if notofication.is_initialized_notification()) + } } impl From for MessageFromClient { @@ -1450,12 +1460,60 @@ impl CallToolError { } /// Specific constructor to create a `CallToolError` for an `UnknownTool` error. - pub fn unknown_tool(tool_name: String) -> Self { + pub fn unknown_tool(tool_name: impl Into) -> Self { // Create a `CallToolError` from an `UnknownTool` error (wrapped in a `Box`). - CallToolError(Box::new(UnknownTool(tool_name))) + CallToolError(Box::new(UnknownTool(tool_name.into()))) + } + + pub fn invalid_arguments(tool_name: impl Into, message: Option>) -> Self { + let tool_name = tool_name.into(); + let message = message.map(|m| m.into()); + + let full_message = match message { + Some(msg) => format!("Invalid arguments for tool '{tool_name}': {msg}" ), + None => format!("Invalid arguments for tool '{tool_name}'"), + }; + Self::from_message(full_message) + } + + /// Creates a new `CallToolError` from a string message. + /// + /// This is useful for generating ad-hoc or one-off errors without defining a custom error type. + /// Internally, it wraps the string in a lightweight error type that implements the `Error` trait. + /// + /// # Examples + /// + /// ``` + /// let err = CallToolError::from_message("Something went wrong"); + /// println!("{:?}", err); + /// ``` + /// + /// # Parameters + /// + /// - `message`: Any type that can be converted into a `String` (e.g., `&str` or `String`) + /// + /// # Returns + /// + /// A `CallToolError` wrapping a dynamic error created from the provided message. + pub fn from_message(message: impl Into) -> Self { + struct MsgError(String); + impl std::fmt::Debug for MsgError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } + } + impl std::fmt::Display for MsgError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } + } + impl std::error::Error for MsgError {} + + CallToolError::new(MsgError(message.into())) } } + /// Converts a `CallToolError` into a `RpcError`. /// /// The conversion creates an internal error variant of `RpcError` @@ -1508,8 +1566,6 @@ impl> From for TextContent { } } - - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(untagged)] #[allow(clippy::large_enum_variant)] @@ -1568,9 +1624,6 @@ impl Display for ClientMessages { } } - - - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(untagged)] #[allow(clippy::large_enum_variant)] @@ -1629,7 +1682,6 @@ impl Display for ServerMessages { } } - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(untagged)] #[allow(clippy::large_enum_variant)] @@ -1726,7 +1778,6 @@ impl From> for MessagesFromClient { } } - #[deprecated(since = "0.4.0", note = "This trait was renamed to RpcMessage. Use RpcMessage instead.")] pub type RPCMessage = (); #[deprecated(since = "0.4.0", note = "This trait was renamed to McpMessage. Use McpMessage instead.")] diff --git a/src/generated_schema/2025_06_18/mcp_schema.rs b/src/generated_schema/2025_06_18/mcp_schema.rs index 65778ec..a5625ab 100644 --- a/src/generated_schema/2025_06_18/mcp_schema.rs +++ b/src/generated_schema/2025_06_18/mcp_schema.rs @@ -5,8 +5,8 @@ /// modify or extend the implementations as needed, but please do so at your own risk. /// /// Generated from : -/// Hash : 0695a497eb50a804fc0e88c18a93a21a675d6b3e -/// Generated at : 2025年07月27日 15:33:21 +/// Hash : a470342d05c345b580642821605b9c885bad237b +/// Generated at : 2025年08月29日 19:12:24 /// ---------------------------------------------------------------------------- /// /// MCP Protocol Version @@ -83,7 +83,7 @@ pub struct Annotations { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -115,7 +115,7 @@ pub struct AudioContent { pub annotations: ::std::option::Option, ///The base64-encoded audio data. pub data: ::std::string::String, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of the audio. Different providers may support different audio types. @@ -195,7 +195,7 @@ pub struct BaseMetadata { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -221,7 +221,7 @@ pub struct BaseMetadata { pub struct BlobResourceContents { ///A base64-encoded string representing the binary data of the item. pub blob: ::std::string::String, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of this resource, if known. @@ -385,7 +385,7 @@ pub struct CallToolRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -424,7 +424,7 @@ pub struct CallToolResult { should be reported as an MCP error response.*/ #[serde(rename = "isError", default, skip_serializing_if = "::std::option::Option::is_none")] pub is_error: ::std::option::Option, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///An optional JSON object that represents the structured result of the tool call. @@ -1100,7 +1100,7 @@ impl ::std::convert::From for CompleteRequestParamsRe /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -1134,7 +1134,7 @@ impl ::std::convert::From for CompleteRequestParamsRe #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct CompleteResult { pub completion: CompleteResultCompletion, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } @@ -1462,7 +1462,7 @@ impl ::std::fmt::Display for CreateMessageRequestParamsIncludeContext { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -1497,7 +1497,7 @@ impl ::std::fmt::Display for CreateMessageRequestParamsIncludeContext { #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct CreateMessageResult { pub content: CreateMessageResultContent, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The name of the model that generated the message. @@ -1768,7 +1768,7 @@ impl ElicitRequestParamsRequestedSchema { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -1807,7 +1807,7 @@ pub struct ElicitResult { Contains values matching the requested schema.*/ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub content: ::std::option::Option<::std::collections::hashmap<::std::string::string, ElicitResultContentValue>>, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } @@ -1895,7 +1895,7 @@ of the LLM and/or the user.*/ /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -1926,7 +1926,7 @@ pub struct EmbeddedResource { ///Optional annotations for the client. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub annotations: ::std::option::Option, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, pub resource: EmbeddedResourceResource, @@ -2178,7 +2178,7 @@ pub struct GetPromptRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -2202,7 +2202,7 @@ pub struct GetPromptResult { #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub description: ::std::option::Option<::std::string::string>, pub messages: ::std::vec::Vec, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } @@ -2221,7 +2221,7 @@ pub struct GetPromptResult { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -2253,7 +2253,7 @@ pub struct ImageContent { pub annotations: ::std::option::Option, ///The base64-encoded image data. pub data: ::std::string::String, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of the image. Different providers may support different image types. @@ -2436,7 +2436,7 @@ pub struct InitializeRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -2465,7 +2465,7 @@ pub struct InitializeResult { This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt.*/ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub instructions: ::std::option::Option<::std::string::string>, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect. @@ -2494,7 +2494,7 @@ pub struct InitializeResult { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -2534,7 +2534,7 @@ impl InitializedNotification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -2545,7 +2545,7 @@ impl InitializedNotification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct InitializedNotificationParams { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -2690,7 +2690,7 @@ impl ::std::convert::From for JsonrpcMessage { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -2729,7 +2729,7 @@ impl JsonrpcNotification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -2740,7 +2740,7 @@ impl JsonrpcNotification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct JsonrpcNotificationParams { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -2774,7 +2774,7 @@ pub struct JsonrpcNotificationParams { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -2821,7 +2821,7 @@ impl JsonrpcRequest { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -2843,13 +2843,13 @@ pub struct JsonrpcRequestParams { #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] pub extra: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } -///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. +///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. /// ///
JSON schema /// /// ```json ///{ -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -3000,7 +3000,7 @@ pub struct ListPromptsRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -3020,7 +3020,7 @@ pub struct ListPromptsRequestParams { ///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListPromptsResult { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, /**An opaque token representing the pagination position after the last returned result. @@ -3114,7 +3114,7 @@ pub struct ListResourceTemplatesRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -3134,7 +3134,7 @@ pub struct ListResourceTemplatesRequestParams { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListResourceTemplatesResult { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, /**An opaque token representing the pagination position after the last returned result. @@ -3229,7 +3229,7 @@ pub struct ListResourcesRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -3249,7 +3249,7 @@ pub struct ListResourcesRequestParams { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListResourcesResult { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, /**An opaque token representing the pagination position after the last returned result. @@ -3283,7 +3283,7 @@ structure or access specific locations that the client has permission to read fr /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -3329,7 +3329,7 @@ impl ListRootsRequest { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -3351,13 +3351,13 @@ pub struct ListRootsRequestParams { #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] pub extra: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } -///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. +///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. /// ///
JSON schema /// /// ```json ///{ -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -3392,7 +3392,7 @@ or file that the server can operate on.*/ /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -3408,7 +3408,7 @@ or file that the server can operate on.*/ ///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListRootsResult { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, pub roots: ::std::vec::Vec, @@ -3498,7 +3498,7 @@ pub struct ListToolsRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -3518,7 +3518,7 @@ pub struct ListToolsRequestParams { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListToolsResult { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, /**An opaque token representing the pagination position after the last returned result. @@ -3795,7 +3795,7 @@ pub struct ModelPreferences { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -3821,7 +3821,7 @@ pub struct Notification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -3832,7 +3832,7 @@ pub struct Notification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct NotificationParams { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -3979,7 +3979,7 @@ pub struct PaginatedRequestParams { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -3993,7 +3993,7 @@ pub struct PaginatedRequestParams { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct PaginatedResult { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, /**An opaque token representing the pagination position after the last returned result. @@ -4021,7 +4021,7 @@ pub struct PaginatedResult { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -4067,7 +4067,7 @@ impl PingRequest { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -4089,13 +4089,13 @@ pub struct PingRequestParams { #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] pub extra: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } -///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. +///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. /// ///
JSON schema /// /// ```json ///{ -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -4315,7 +4315,7 @@ impl ::std::convert::From for ProgressToken { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -4350,7 +4350,7 @@ pub struct Prompt { ///An optional description of what this prompt provides #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub description: ::std::option::Option<::std::string::string>, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present). @@ -4433,7 +4433,7 @@ pub struct PromptArgument { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -4473,7 +4473,7 @@ impl PromptListChangedNotification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -4484,7 +4484,7 @@ impl PromptListChangedNotification { ///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct PromptListChangedNotificationParams { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -4669,7 +4669,7 @@ pub struct ReadResourceRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -4693,7 +4693,7 @@ pub struct ReadResourceRequestParams { #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ReadResourceResult { pub contents: ::std::vec::Vec, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } @@ -4748,7 +4748,7 @@ impl ::std::convert::From for ReadResourceResultContentsIt /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -4805,7 +4805,7 @@ impl ::std::convert::From for RequestId { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -4827,13 +4827,13 @@ pub struct RequestParams { #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] pub extra: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } -///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. +///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. /// ///
JSON schema /// /// ```json ///{ -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -4867,7 +4867,7 @@ pub struct RequestParamsMeta { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -4913,7 +4913,7 @@ pub struct Resource { This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.*/ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub description: ::std::option::Option<::std::string::string>, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of this resource, if known. @@ -4948,7 +4948,7 @@ pub struct Resource { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -4967,7 +4967,7 @@ pub struct Resource { ///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ResourceContents { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of this resource, if known. @@ -4992,7 +4992,7 @@ Note: resource links returned by tools are not guaranteed to appear in the resul /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -5042,7 +5042,7 @@ pub struct ResourceLink { This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.*/ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub description: ::std::option::Option<::std::string::string>, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of this resource, if known. @@ -5117,7 +5117,7 @@ impl ResourceLink { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -5157,7 +5157,7 @@ impl ResourceListChangedNotification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -5168,7 +5168,7 @@ impl ResourceListChangedNotification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct ResourceListChangedNotificationParams { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -5188,7 +5188,7 @@ pub struct ResourceListChangedNotificationParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -5230,7 +5230,7 @@ pub struct ResourceTemplate { This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.*/ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub description: ::std::option::Option<::std::string::string>, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type. @@ -5383,7 +5383,7 @@ pub struct ResourceUpdatedNotificationParams { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -5394,7 +5394,7 @@ pub struct ResourceUpdatedNotificationParams { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct Result { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -5443,7 +5443,7 @@ impl ::std::fmt::Display for Role { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -5462,7 +5462,7 @@ impl ::std::fmt::Display for Role { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct Root { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, /**An optional name for the root. This can be used to provide a human-readable @@ -5497,7 +5497,7 @@ The server should then request an updated list of roots using the ListRootsReque /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -5537,7 +5537,7 @@ impl RootsListChangedNotification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -5548,7 +5548,7 @@ impl RootsListChangedNotification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct RootsListChangedNotificationParams { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -6350,7 +6350,7 @@ pub struct SubscribeRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -6375,7 +6375,7 @@ pub struct TextContent { ///Optional annotations for the client. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub annotations: ::std::option::Option, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The text content of the message. @@ -6416,7 +6416,7 @@ impl TextContent { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -6439,7 +6439,7 @@ impl TextContent { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct TextResourceContents { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of this resource, if known. @@ -6464,7 +6464,7 @@ pub struct TextResourceContents { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -6552,7 +6552,7 @@ pub struct Tool { pub description: ::std::option::Option<::std::string::string>, #[serde(rename = "inputSchema")] pub input_schema: ToolInputSchema, - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present). @@ -6721,7 +6721,7 @@ impl ToolInputSchema { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -6761,7 +6761,7 @@ impl ToolListChangedNotification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -6772,7 +6772,7 @@ impl ToolListChangedNotification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct ToolListChangedNotificationParams { - ///See [specification/2025-06-18/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] diff --git a/src/generated_schema/2025_06_18/schema_utils.rs b/src/generated_schema/2025_06_18/schema_utils.rs index 6d237e5..60034b8 100644 --- a/src/generated_schema/2025_06_18/schema_utils.rs +++ b/src/generated_schema/2025_06_18/schema_utils.rs @@ -235,6 +235,11 @@ impl ClientMessage { pub fn is_initialize_request(&self) -> bool { matches!(self, Self::Request(request) if request.request.is_initialize_request()) } + + /// Returns `true` if the message is an `InitializedNotification` + pub fn is_initialized_notification(&self) -> bool { + matches!(self, Self::Notification(notofication) if notofication.notification.is_initialized_notification()) + } } impl From for ClientMessage { @@ -519,7 +524,7 @@ impl TryFrom for ClientNotification { } impl NotificationFromClient { - /// Checks if the current notification is an `InitializedNotification` from the client, indicating that the client has been initialized. + /// Returns `true` if the message is an `InitializedNotification` pub fn is_initialized_notification(&self) -> bool { matches!( self, @@ -1319,10 +1324,15 @@ pub enum MessageFromClient { } impl MessageFromClient { - /// Returns `true` if the request is an `InitializeRequest`. + /// Returns `true` if the message is an `InitializeRequest`. pub fn is_initialize_request(&self) -> bool { matches!(self, Self::RequestFromClient(request) if request.is_initialize_request()) } + + /// Returns `true` if the message is an `InitializedNotification` + pub fn is_initialized_notification(&self) -> bool { + matches!(self, Self::NotificationFromClient(notofication) if notofication.is_initialized_notification()) + } } impl From for MessageFromClient { @@ -1451,9 +1461,56 @@ impl CallToolError { } /// Specific constructor to create a `CallToolError` for an `UnknownTool` error. - pub fn unknown_tool(tool_name: String) -> Self { + pub fn unknown_tool(tool_name: impl Into) -> Self { // Create a `CallToolError` from an `UnknownTool` error (wrapped in a `Box`). - CallToolError(Box::new(UnknownTool(tool_name))) + CallToolError(Box::new(UnknownTool(tool_name.into()))) + } + + pub fn invalid_arguments(tool_name: impl Into, message: Option>) -> Self { + let tool_name = tool_name.into(); + let message = message.map(|m| m.into()); + + let full_message = match message { + Some(msg) => format!("Invalid arguments for tool '{tool_name}': {msg}"), + None => format!("Invalid arguments for tool '{tool_name}'"), + }; + Self::from_message(full_message) + } + + /// Creates a new `CallToolError` from a string message. + /// + /// This is useful for generating ad-hoc or one-off errors without defining a custom error type. + /// Internally, it wraps the string in a lightweight error type that implements the `Error` trait. + /// + /// # Examples + /// + /// ``` + /// let err = rust_mcp_schema::schema_utils::CallToolError::from_message("Something went wrong"); + /// println!("{:?}", err); + /// ``` + /// + /// # Parameters + /// + /// - `message`: Any type that can be converted into a `String` (e.g., `&str` or `String`) + /// + /// # Returns + /// + /// A `CallToolError` wrapping a dynamic error created from the provided message. + pub fn from_message(message: impl Into) -> Self { + struct MsgError(String); + impl std::fmt::Debug for MsgError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } + } + impl std::fmt::Display for MsgError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } + } + impl std::error::Error for MsgError {} + + CallToolError::new(MsgError(message.into())) } } @@ -1514,8 +1571,6 @@ impl> From for TextContent { } } - - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(untagged)] #[allow(clippy::large_enum_variant)] @@ -1574,9 +1629,6 @@ impl Display for ClientMessages { } } - - - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(untagged)] #[allow(clippy::large_enum_variant)] @@ -1635,8 +1687,6 @@ impl Display for ServerMessages { } } - - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(untagged)] #[allow(clippy::large_enum_variant)] @@ -1733,7 +1783,6 @@ impl From> for MessagesFromClient { } } - #[deprecated(since = "0.4.0", note = "This trait was renamed to RpcMessage. Use RpcMessage instead.")] pub type RPCMessage = (); #[deprecated(since = "0.4.0", note = "This trait was renamed to McpMessage. Use McpMessage instead.")] diff --git a/src/generated_schema/draft/mcp_schema.rs b/src/generated_schema/draft/mcp_schema.rs index 72bbcbb..c0dc196 100644 --- a/src/generated_schema/draft/mcp_schema.rs +++ b/src/generated_schema/draft/mcp_schema.rs @@ -5,8 +5,8 @@ /// modify or extend the implementations as needed, but please do so at your own risk. /// /// Generated from : -/// Hash : 0695a497eb50a804fc0e88c18a93a21a675d6b3e -/// Generated at : 2025年07月27日 15:33:21 +/// Hash : a470342d05c345b580642821605b9c885bad237b +/// Generated at : 2025年08月29日 19:12:24 /// ---------------------------------------------------------------------------- /// /// MCP Protocol Version @@ -83,7 +83,7 @@ pub struct Annotations { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -115,7 +115,7 @@ pub struct AudioContent { pub annotations: ::std::option::Option, ///The base64-encoded audio data. pub data: ::std::string::String, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of the audio. Different providers may support different audio types. @@ -195,7 +195,7 @@ pub struct BaseMetadata { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -221,7 +221,7 @@ pub struct BaseMetadata { pub struct BlobResourceContents { ///A base64-encoded string representing the binary data of the item. pub blob: ::std::string::String, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of this resource, if known. @@ -298,10 +298,19 @@ impl BooleanSchema { /// "description": "Used by the client to invoke a tool provided by the server.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "tools/call" @@ -327,16 +336,23 @@ impl BooleanSchema { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct CallToolRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: CallToolRequestParams, } impl CallToolRequest { - pub fn new(params: CallToolRequestParams) -> Self { + pub fn new(id: RequestId, params: CallToolRequestParams) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "tools/call".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -385,7 +401,7 @@ pub struct CallToolRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -424,7 +440,7 @@ pub struct CallToolResult { should be reported as an MCP error response.*/ #[serde(rename = "isError", default, skip_serializing_if = "::std::option::Option::is_none")] pub is_error: ::std::option::Option, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///An optional JSON object that represents the structured result of the tool call. @@ -447,10 +463,15 @@ A client MUST NOT attempt to cancel its initialize request.*/ /// "description": "This notification can be sent by either side to indicate that it is cancelling a previously-issued request.\n\nThe request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.\n\nThis notification indicates that the result will be unused, so any associated processing SHOULD cease.\n\nA client MUST NOT attempt to cancel its initialize request.", /// "type": "object", /// "required": [ +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "notifications/cancelled" @@ -477,16 +498,21 @@ A client MUST NOT attempt to cancel its initialize request.*/ /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct CancelledNotification { + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: CancelledNotificationParams, } impl CancelledNotification { pub fn new(params: CancelledNotificationParams) -> Self { Self { + jsonrpc: JSONRPC_VERSION.to_string(), method: "notifications/cancelled".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -850,10 +876,19 @@ impl ::std::convert::From for ClientResult { /// "description": "A request from the client to the server, to ask for completion options.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "completion/complete" @@ -914,16 +949,23 @@ impl ::std::convert::From for ClientResult { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct CompleteRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: CompleteRequestParams, } impl CompleteRequest { - pub fn new(params: CompleteRequestParams) -> Self { + pub fn new(id: RequestId, params: CompleteRequestParams) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "completion/complete".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -1100,7 +1142,7 @@ impl ::std::convert::From for CompleteRequestParamsRe /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -1134,7 +1176,7 @@ impl ::std::convert::From for CompleteRequestParamsRe #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct CompleteResult { pub completion: CompleteResultCompletion, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } @@ -1248,10 +1290,19 @@ impl ::std::convert::From for ContentBlock { /// "description": "A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "sampling/createMessage" @@ -1312,16 +1363,23 @@ impl ::std::convert::From for ContentBlock { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct CreateMessageRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: CreateMessageRequestParams, } impl CreateMessageRequest { - pub fn new(params: CreateMessageRequestParams) -> Self { + pub fn new(id: RequestId, params: CreateMessageRequestParams) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "sampling/createMessage".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -1462,7 +1520,7 @@ impl ::std::fmt::Display for CreateMessageRequestParamsIncludeContext { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -1497,7 +1555,7 @@ impl ::std::fmt::Display for CreateMessageRequestParamsIncludeContext { #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct CreateMessageResult { pub content: CreateMessageResultContent, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The name of the model that generated the message. @@ -1572,10 +1630,19 @@ pub struct Cursor(pub ::std::string::String); /// "description": "A request from the server to elicit additional information from the user via the client.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "elicitation/create" @@ -1625,16 +1692,23 @@ pub struct Cursor(pub ::std::string::String); /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ElicitRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: ElicitRequestParams, } impl ElicitRequest { - pub fn new(params: ElicitRequestParams) -> Self { + pub fn new(id: RequestId, params: ElicitRequestParams) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "elicitation/create".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -1768,7 +1842,7 @@ impl ElicitRequestParamsRequestedSchema { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -1807,7 +1881,7 @@ pub struct ElicitResult { Contains values matching the requested schema.*/ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub content: ::std::option::Option<::std::collections::hashmap<::std::string::string, ElicitResultContentValue>>, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } @@ -1895,7 +1969,7 @@ of the LLM and/or the user.*/ /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -1926,7 +2000,7 @@ pub struct EmbeddedResource { ///Optional annotations for the client. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub annotations: ::std::option::Option, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, pub resource: EmbeddedResourceResource, @@ -2081,10 +2155,19 @@ impl EnumSchema { /// "description": "Used by the client to get a prompt provided by the server.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "prompts/get" @@ -2114,16 +2197,23 @@ impl EnumSchema { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct GetPromptRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: GetPromptRequestParams, } impl GetPromptRequest { - pub fn new(params: GetPromptRequestParams) -> Self { + pub fn new(id: RequestId, params: GetPromptRequestParams) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "prompts/get".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -2178,7 +2268,7 @@ pub struct GetPromptRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -2202,7 +2292,7 @@ pub struct GetPromptResult { #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub description: ::std::option::Option<::std::string::string>, pub messages: ::std::vec::Vec, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } @@ -2221,7 +2311,7 @@ pub struct GetPromptResult { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -2253,7 +2343,7 @@ pub struct ImageContent { pub annotations: ::std::option::Option, ///The base64-encoded image data. pub data: ::std::string::String, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of the image. Different providers may support different image types. @@ -2334,10 +2424,19 @@ pub struct Implementation { /// "description": "This request is sent from the client to the server when it first connects, asking it to begin initialization.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "initialize" @@ -2368,16 +2467,23 @@ pub struct Implementation { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct InitializeRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: InitializeRequestParams, } impl InitializeRequest { - pub fn new(params: InitializeRequestParams) -> Self { + pub fn new(id: RequestId, params: InitializeRequestParams) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "initialize".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -2436,7 +2542,7 @@ pub struct InitializeRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -2465,7 +2571,7 @@ pub struct InitializeResult { This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt.*/ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub instructions: ::std::option::Option<::std::string::string>, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect. @@ -2483,9 +2589,14 @@ pub struct InitializeResult { /// "description": "This notification is sent from the client to the server after initialization has finished.", /// "type": "object", /// "required": [ +/// "jsonrpc", /// "method" /// ], /// "properties": { +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "notifications/initialized" @@ -2494,7 +2605,7 @@ pub struct InitializeResult { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -2507,6 +2618,7 @@ pub struct InitializeResult { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct InitializedNotification { + jsonrpc: ::std::string::String, method: ::std::string::String, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub params: ::std::option::Option, @@ -2514,10 +2626,14 @@ pub struct InitializedNotification { impl InitializedNotification { pub fn new(params: ::std::option::Option) -> Self { Self { + jsonrpc: JSONRPC_VERSION.to_string(), method: "notifications/initialized".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -2534,7 +2650,7 @@ impl InitializedNotification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -2545,7 +2661,7 @@ impl InitializedNotification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct InitializedNotificationParams { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -2566,24 +2682,7 @@ pub struct InitializedNotificationParams { /// ], /// "properties": { /// "error": { -/// "type": "object", -/// "required": [ -/// "code", -/// "message" -/// ], -/// "properties": { -/// "code": { -/// "description": "The error type that occurred.", -/// "type": "integer" -/// }, -/// "data": { -/// "description": "Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.)." -/// }, -/// "message": { -/// "description": "A short description of the error. The message SHOULD be limited to a concise single sentence.", -/// "type": "string" -/// } -/// } +/// "$ref": "#/definitions/Error" /// }, /// "id": { /// "$ref": "#/definitions/RequestId" @@ -2690,7 +2789,7 @@ impl ::std::convert::From for JsonrpcMessage { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -2729,7 +2828,7 @@ impl JsonrpcNotification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -2740,7 +2839,7 @@ impl JsonrpcNotification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct JsonrpcNotificationParams { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -2774,7 +2873,7 @@ pub struct JsonrpcNotificationParams { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -2821,7 +2920,7 @@ impl JsonrpcRequest { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -2843,13 +2942,13 @@ pub struct JsonrpcRequestParams { #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] pub extra: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } -///See [specification/draft/basic/index#general-fields] for notes on _meta usage. +///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. /// ///
JSON schema /// /// ```json ///{ -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -2924,9 +3023,18 @@ impl JsonrpcResponse { /// "description": "Sent from the client to request a list of prompts and prompt templates the server has.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "prompts/list" @@ -2946,17 +3054,24 @@ impl JsonrpcResponse { ///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListPromptsRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub params: ::std::option::Option, } impl ListPromptsRequest { - pub fn new(params: ::std::option::Option) -> Self { + pub fn new(id: RequestId, params: ::std::option::Option) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "prompts/list".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -3000,7 +3115,7 @@ pub struct ListPromptsRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -3020,7 +3135,7 @@ pub struct ListPromptsRequestParams { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListPromptsResult { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, /**An opaque token representing the pagination position after the last returned result. @@ -3038,9 +3153,18 @@ pub struct ListPromptsResult { /// "description": "Sent from the client to request a list of resource templates the server has.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "resources/templates/list" @@ -3060,17 +3184,24 @@ pub struct ListPromptsResult { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListResourceTemplatesRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub params: ::std::option::Option, } impl ListResourceTemplatesRequest { - pub fn new(params: ::std::option::Option) -> Self { + pub fn new(id: RequestId, params: ::std::option::Option) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "resources/templates/list".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -3114,7 +3245,7 @@ pub struct ListResourceTemplatesRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -3134,7 +3265,7 @@ pub struct ListResourceTemplatesRequestParams { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListResourceTemplatesResult { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, /**An opaque token representing the pagination position after the last returned result. @@ -3153,9 +3284,18 @@ pub struct ListResourceTemplatesResult { /// "description": "Sent from the client to request a list of resources the server has.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "resources/list" @@ -3175,17 +3315,24 @@ pub struct ListResourceTemplatesResult { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListResourcesRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub params: ::std::option::Option, } impl ListResourcesRequest { - pub fn new(params: ::std::option::Option) -> Self { + pub fn new(id: RequestId, params: ::std::option::Option) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "resources/list".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -3229,7 +3376,7 @@ pub struct ListResourcesRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -3249,7 +3396,7 @@ pub struct ListResourcesRequestParams { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListResourcesResult { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, /**An opaque token representing the pagination position after the last returned result. @@ -3272,9 +3419,18 @@ structure or access specific locations that the client has permission to read fr /// "description": "Sent from the server to request a list of root URIs from the client. Roots allow\nservers to ask for specific directories or files to operate on. A common example\nfor roots is providing a set of repositories or directories a server should operate\non.\n\nThis request is typically used when the server needs to understand the file system\nstructure or access specific locations that the client has permission to read from.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "roots/list" @@ -3283,7 +3439,7 @@ structure or access specific locations that the client has permission to read fr /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -3302,17 +3458,24 @@ structure or access specific locations that the client has permission to read fr /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListRootsRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub params: ::std::option::Option, } impl ListRootsRequest { - pub fn new(params: ::std::option::Option) -> Self { + pub fn new(id: RequestId, params: ::std::option::Option) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "roots/list".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -3329,7 +3492,7 @@ impl ListRootsRequest { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -3351,13 +3514,13 @@ pub struct ListRootsRequestParams { #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] pub extra: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } -///See [specification/draft/basic/index#general-fields] for notes on _meta usage. +///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. /// ///
JSON schema /// /// ```json ///{ -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -3392,7 +3555,7 @@ or file that the server can operate on.*/ /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -3408,7 +3571,7 @@ or file that the server can operate on.*/ ///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListRootsResult { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, pub roots: ::std::vec::Vec, @@ -3422,9 +3585,18 @@ pub struct ListRootsResult { /// "description": "Sent from the client to request a list of tools the server has.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "tools/list" @@ -3444,17 +3616,24 @@ pub struct ListRootsResult { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListToolsRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub params: ::std::option::Option, } impl ListToolsRequest { - pub fn new(params: ::std::option::Option) -> Self { + pub fn new(id: RequestId, params: ::std::option::Option) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "tools/list".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -3498,7 +3677,7 @@ pub struct ListToolsRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -3518,7 +3697,7 @@ pub struct ListToolsRequestParams { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ListToolsResult { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, /**An opaque token representing the pagination position after the last returned result. @@ -3583,19 +3762,24 @@ impl ::std::fmt::Display for LoggingLevel { } } } -///Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically. +///JSONRPCNotification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically. /// ///
JSON schema /// /// ```json ///{ -/// "description": "Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.", +/// "description": "JSONRPCNotification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.", /// "type": "object", /// "required": [ +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "notifications/message" @@ -3626,16 +3810,21 @@ impl ::std::fmt::Display for LoggingLevel { ///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct LoggingMessageNotification { + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: LoggingMessageNotificationParams, } impl LoggingMessageNotification { pub fn new(params: LoggingMessageNotificationParams) -> Self { Self { + jsonrpc: JSONRPC_VERSION.to_string(), method: "notifications/message".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -3795,7 +3984,7 @@ pub struct ModelPreferences { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -3821,7 +4010,7 @@ pub struct Notification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -3832,7 +4021,7 @@ pub struct Notification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct NotificationParams { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -3922,9 +4111,18 @@ impl ::std::fmt::Display for NumberSchemaType { ///{ /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string" /// }, @@ -3943,10 +4141,25 @@ impl ::std::fmt::Display for NumberSchemaType { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct PaginatedRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, pub method: ::std::string::String, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub params: ::std::option::Option, } +impl PaginatedRequest { + pub fn new(id: RequestId, method: ::std::string::String, params: ::std::option::Option) -> Self { + Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), + method, + params, + } + } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } +} ///PaginatedRequestParams /// ///
JSON schema @@ -3979,7 +4192,7 @@ pub struct PaginatedRequestParams { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -3993,7 +4206,7 @@ pub struct PaginatedRequestParams { ///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct PaginatedResult { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, /**An opaque token representing the pagination position after the last returned result. @@ -4010,9 +4223,18 @@ pub struct PaginatedResult { /// "description": "A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "ping" @@ -4021,7 +4243,7 @@ pub struct PaginatedResult { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -4040,17 +4262,24 @@ pub struct PaginatedResult { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct PingRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub params: ::std::option::Option, } impl PingRequest { - pub fn new(params: ::std::option::Option) -> Self { + pub fn new(id: RequestId, params: ::std::option::Option) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "ping".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -4067,7 +4296,7 @@ impl PingRequest { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -4089,13 +4318,13 @@ pub struct PingRequestParams { #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] pub extra: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } -///See [specification/draft/basic/index#general-fields] for notes on _meta usage. +///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. /// ///
JSON schema /// /// ```json ///{ -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -4177,10 +4406,15 @@ impl ::std::convert::From for PrimitiveSchemaDefinition { /// "description": "An out-of-band notification used to inform the receiver of a progress update for a long-running request.", /// "type": "object", /// "required": [ +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "notifications/progress" @@ -4216,16 +4450,21 @@ impl ::std::convert::From for PrimitiveSchemaDefinition { ///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ProgressNotification { + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: ProgressNotificationParams, } impl ProgressNotification { pub fn new(params: ProgressNotificationParams) -> Self { Self { + jsonrpc: JSONRPC_VERSION.to_string(), method: "notifications/progress".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -4315,7 +4554,7 @@ impl ::std::convert::From for ProgressToken { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -4350,7 +4589,7 @@ pub struct Prompt { ///An optional description of what this prompt provides #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub description: ::std::option::Option<::std::string::string>, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present). @@ -4422,9 +4661,14 @@ pub struct PromptArgument { /// "description": "An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.", /// "type": "object", /// "required": [ +/// "jsonrpc", /// "method" /// ], /// "properties": { +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "notifications/prompts/list_changed" @@ -4433,7 +4677,7 @@ pub struct PromptArgument { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -4446,6 +4690,7 @@ pub struct PromptArgument { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct PromptListChangedNotification { + jsonrpc: ::std::string::String, method: ::std::string::String, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub params: ::std::option::Option, @@ -4453,10 +4698,14 @@ pub struct PromptListChangedNotification { impl PromptListChangedNotification { pub fn new(params: ::std::option::Option) -> Self { Self { + jsonrpc: JSONRPC_VERSION.to_string(), method: "notifications/prompts/list_changed".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -4473,7 +4722,7 @@ impl PromptListChangedNotification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -4484,7 +4733,7 @@ impl PromptListChangedNotification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct PromptListChangedNotificationParams { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -4587,10 +4836,19 @@ impl PromptReference { /// "description": "Sent from the client to the server, to read a specific resource URI.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "resources/read" @@ -4614,16 +4872,23 @@ impl PromptReference { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ReadResourceRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: ReadResourceRequestParams, } impl ReadResourceRequest { - pub fn new(params: ReadResourceRequestParams) -> Self { + pub fn new(id: RequestId, params: ReadResourceRequestParams) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "resources/read".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -4669,7 +4934,7 @@ pub struct ReadResourceRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -4693,7 +4958,7 @@ pub struct ReadResourceRequestParams { #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ReadResourceResult { pub contents: ::std::vec::Vec, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } @@ -4748,7 +5013,7 @@ impl ::std::convert::From for ReadResourceResultContentsIt /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -4805,7 +5070,7 @@ impl ::std::convert::From for RequestId { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -4827,13 +5092,13 @@ pub struct RequestParams { #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] pub extra: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, } -///See [specification/draft/basic/index#general-fields] for notes on _meta usage. +///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. /// ///
JSON schema /// /// ```json ///{ -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "properties": { /// "progressToken": { @@ -4867,7 +5132,7 @@ pub struct RequestParamsMeta { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -4913,7 +5178,7 @@ pub struct Resource { This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.*/ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub description: ::std::option::Option<::std::string::string>, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of this resource, if known. @@ -4948,7 +5213,7 @@ pub struct Resource { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -4967,7 +5232,7 @@ pub struct Resource { ///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ResourceContents { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of this resource, if known. @@ -4992,7 +5257,7 @@ Note: resource links returned by tools are not guaranteed to appear in the resul /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -5042,7 +5307,7 @@ pub struct ResourceLink { This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.*/ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub description: ::std::option::Option<::std::string::string>, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of this resource, if known. @@ -5106,9 +5371,14 @@ impl ResourceLink { /// "description": "An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.", /// "type": "object", /// "required": [ +/// "jsonrpc", /// "method" /// ], /// "properties": { +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "notifications/resources/list_changed" @@ -5117,7 +5387,7 @@ impl ResourceLink { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -5130,6 +5400,7 @@ impl ResourceLink { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ResourceListChangedNotification { + jsonrpc: ::std::string::String, method: ::std::string::String, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub params: ::std::option::Option, @@ -5137,10 +5408,14 @@ pub struct ResourceListChangedNotification { impl ResourceListChangedNotification { pub fn new(params: ::std::option::Option) -> Self { Self { + jsonrpc: JSONRPC_VERSION.to_string(), method: "notifications/resources/list_changed".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -5157,7 +5432,7 @@ impl ResourceListChangedNotification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -5168,7 +5443,7 @@ impl ResourceListChangedNotification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct ResourceListChangedNotificationParams { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -5188,7 +5463,7 @@ pub struct ResourceListChangedNotificationParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -5230,7 +5505,7 @@ pub struct ResourceTemplate { This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.*/ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub description: ::std::option::Option<::std::string::string>, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type. @@ -5305,10 +5580,15 @@ impl ResourceTemplateReference { /// "description": "A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.", /// "type": "object", /// "required": [ +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "notifications/resources/updated" @@ -5332,16 +5612,21 @@ impl ResourceTemplateReference { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ResourceUpdatedNotification { + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: ResourceUpdatedNotificationParams, } impl ResourceUpdatedNotification { pub fn new(params: ResourceUpdatedNotificationParams) -> Self { Self { + jsonrpc: JSONRPC_VERSION.to_string(), method: "notifications/resources/updated".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -5383,7 +5668,7 @@ pub struct ResourceUpdatedNotificationParams { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -5394,7 +5679,7 @@ pub struct ResourceUpdatedNotificationParams { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct Result { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -5443,7 +5728,7 @@ impl ::std::fmt::Display for Role { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -5462,7 +5747,7 @@ impl ::std::fmt::Display for Role { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct Root { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, /**An optional name for the root. This can be used to provide a human-readable @@ -5486,9 +5771,14 @@ The server should then request an updated list of roots using the ListRootsReque /// "description": "A notification from the client to the server, informing it that the list of roots has changed.\nThis notification should be sent whenever the client adds, removes, or modifies any root.\nThe server should then request an updated list of roots using the ListRootsRequest.", /// "type": "object", /// "required": [ +/// "jsonrpc", /// "method" /// ], /// "properties": { +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "notifications/roots/list_changed" @@ -5497,7 +5787,7 @@ The server should then request an updated list of roots using the ListRootsReque /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -5510,6 +5800,7 @@ The server should then request an updated list of roots using the ListRootsReque /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct RootsListChangedNotification { + jsonrpc: ::std::string::String, method: ::std::string::String, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub params: ::std::option::Option, @@ -5517,10 +5808,14 @@ pub struct RootsListChangedNotification { impl RootsListChangedNotification { pub fn new(params: ::std::option::Option) -> Self { Self { + jsonrpc: JSONRPC_VERSION.to_string(), method: "notifications/roots/list_changed".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -5537,7 +5832,7 @@ impl RootsListChangedNotification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -5548,7 +5843,7 @@ impl RootsListChangedNotification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct RootsListChangedNotificationParams { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -6075,10 +6370,19 @@ impl ::std::convert::From for ServerResult { /// "description": "A request from the client to the server, to enable or adjust logging.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "logging/setLevel" @@ -6101,16 +6405,23 @@ impl ::std::convert::From for ServerResult { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct SetLevelRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: SetLevelRequestParams, } impl SetLevelRequest { - pub fn new(params: SetLevelRequestParams) -> Self { + pub fn new(id: RequestId, params: SetLevelRequestParams) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "logging/setLevel".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -6267,10 +6578,19 @@ impl ::std::fmt::Display for StringSchemaFormat { /// "description": "Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "resources/subscribe" @@ -6294,16 +6614,23 @@ impl ::std::fmt::Display for StringSchemaFormat { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct SubscribeRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: SubscribeRequestParams, } impl SubscribeRequest { - pub fn new(params: SubscribeRequestParams) -> Self { + pub fn new(id: RequestId, params: SubscribeRequestParams) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "resources/subscribe".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -6350,7 +6677,7 @@ pub struct SubscribeRequestParams { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -6375,7 +6702,7 @@ pub struct TextContent { ///Optional annotations for the client. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub annotations: ::std::option::Option, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The text content of the message. @@ -6416,7 +6743,7 @@ impl TextContent { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -6439,7 +6766,7 @@ impl TextContent { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct TextResourceContents { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///The MIME type of this resource, if known. @@ -6464,7 +6791,7 @@ pub struct TextResourceContents { /// ], /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// }, @@ -6552,7 +6879,7 @@ pub struct Tool { pub description: ::std::option::Option<::std::string::string>, #[serde(rename = "inputSchema")] pub input_schema: ToolInputSchema, - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present). @@ -6710,9 +7037,14 @@ impl ToolInputSchema { /// "description": "An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.", /// "type": "object", /// "required": [ +/// "jsonrpc", /// "method" /// ], /// "properties": { +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "notifications/tools/list_changed" @@ -6721,7 +7053,7 @@ impl ToolInputSchema { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -6734,6 +7066,7 @@ impl ToolInputSchema { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct ToolListChangedNotification { + jsonrpc: ::std::string::String, method: ::std::string::String, #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub params: ::std::option::Option, @@ -6741,10 +7074,14 @@ pub struct ToolListChangedNotification { impl ToolListChangedNotification { pub fn new(params: ::std::option::Option) -> Self { Self { + jsonrpc: JSONRPC_VERSION.to_string(), method: "notifications/tools/list_changed".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } @@ -6761,7 +7098,7 @@ impl ToolListChangedNotification { /// "type": "object", /// "properties": { /// "_meta": { -/// "description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.", +/// "description": "See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage.", /// "type": "object", /// "additionalProperties": {} /// } @@ -6772,7 +7109,7 @@ impl ToolListChangedNotification { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)] pub struct ToolListChangedNotificationParams { - ///See [specification/draft/basic/index#general-fields] for notes on _meta usage. + ///See [General fields: _meta](/specification/draft/basic/index#meta) for notes on _meta usage. #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")] pub meta: ::std::option::Option<::serde_json::map<::std::string::string, ::serde_json::Value>>, #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")] @@ -6855,10 +7192,19 @@ impl ToolOutputSchema { /// "description": "Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.", /// "type": "object", /// "required": [ +/// "id", +/// "jsonrpc", /// "method", /// "params" /// ], /// "properties": { +/// "id": { +/// "$ref": "#/definitions/RequestId" +/// }, +/// "jsonrpc": { +/// "type": "string", +/// "const": "2.0" +/// }, /// "method": { /// "type": "string", /// "const": "resources/unsubscribe" @@ -6882,16 +7228,23 @@ impl ToolOutputSchema { /// #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] pub struct UnsubscribeRequest { + pub id: RequestId, + jsonrpc: ::std::string::String, method: ::std::string::String, pub params: UnsubscribeRequestParams, } impl UnsubscribeRequest { - pub fn new(params: UnsubscribeRequestParams) -> Self { + pub fn new(id: RequestId, params: UnsubscribeRequestParams) -> Self { Self { + id, + jsonrpc: JSONRPC_VERSION.to_string(), method: "resources/unsubscribe".to_string(), params, } } + pub fn jsonrpc(&self) -> &::std::string::String { + &self.jsonrpc + } pub fn method(&self) -> &::std::string::String { &self.method } diff --git a/src/generated_schema/draft/schema_utils.rs b/src/generated_schema/draft/schema_utils.rs index 0be01d0..6636bbf 100644 --- a/src/generated_schema/draft/schema_utils.rs +++ b/src/generated_schema/draft/schema_utils.rs @@ -236,6 +236,11 @@ impl ClientMessage { pub fn is_initialize_request(&self) -> bool { matches!(self, Self::Request(request) if request.request.is_initialize_request()) } + + /// Returns `true` if the message is an `InitializedNotification` + pub fn is_initialized_notification(&self) -> bool { + matches!(self, Self::Notification(notofication) if notofication.notification.is_initialized_notification()) + } } impl From for ClientMessage { @@ -520,7 +525,7 @@ impl TryFrom for ClientNotification { } impl NotificationFromClient { - /// Checks if the current notification is an `InitializedNotification` from the client, indicating that the client has been initialized. + /// Returns `true` if the message is an `InitializedNotification` pub fn is_initialized_notification(&self) -> bool { matches!( self, @@ -926,6 +931,7 @@ impl FromStr for ServerJsonrpcRequest { /// To determine standard and custom request from the server side /// Custom requests are of type serde_json::Value and can be deserialized into any custom type. +#[allow(clippy::large_enum_variant)] #[derive(::serde::Serialize, Clone, Debug)] #[serde(untagged)] pub enum RequestFromServer { @@ -1320,10 +1326,15 @@ pub enum MessageFromClient { } impl MessageFromClient { - /// Returns `true` if the request is an `InitializeRequest`. + /// Returns `true` if the message is an `InitializeRequest`. pub fn is_initialize_request(&self) -> bool { matches!(self, Self::RequestFromClient(request) if request.is_initialize_request()) } + + /// Returns `true` if the message is an `InitializedNotification` + pub fn is_initialized_notification(&self) -> bool { + matches!(self, Self::NotificationFromClient(notofication) if notofication.is_initialized_notification()) + } } impl From for MessageFromClient { @@ -1452,9 +1463,56 @@ impl CallToolError { } /// Specific constructor to create a `CallToolError` for an `UnknownTool` error. - pub fn unknown_tool(tool_name: String) -> Self { + pub fn unknown_tool(tool_name: impl Into) -> Self { // Create a `CallToolError` from an `UnknownTool` error (wrapped in a `Box`). - CallToolError(Box::new(UnknownTool(tool_name))) + CallToolError(Box::new(UnknownTool(tool_name.into()))) + } + + pub fn invalid_arguments(tool_name: impl Into, message: Option>) -> Self { + let tool_name = tool_name.into(); + let message = message.map(|m| m.into()); + + let full_message = match message { + Some(msg) => format!("Invalid arguments for tool '{tool_name}': {msg}"), + None => format!("Invalid arguments for tool '{tool_name}'"), + }; + Self::from_message(full_message) + } + + /// Creates a new `CallToolError` from a string message. + /// + /// This is useful for generating ad-hoc or one-off errors without defining a custom error type. + /// Internally, it wraps the string in a lightweight error type that implements the `Error` trait. + /// + /// # Examples + /// + /// ``` + /// let err = CallToolError::from_message("Something went wrong"); + /// println!("{:?}", err); + /// ``` + /// + /// # Parameters + /// + /// - `message`: Any type that can be converted into a `String` (e.g., `&str` or `String`) + /// + /// # Returns + /// + /// A `CallToolError` wrapping a dynamic error created from the provided message. + pub fn from_message(message: impl Into) -> Self { + struct MsgError(String); + impl std::fmt::Debug for MsgError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } + } + impl std::fmt::Display for MsgError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } + } + impl std::error::Error for MsgError {} + + CallToolError::new(MsgError(message.into())) } } @@ -1515,8 +1573,6 @@ impl> From for TextContent { } } - - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(untagged)] #[allow(clippy::large_enum_variant)] @@ -1575,9 +1631,6 @@ impl Display for ClientMessages { } } - - - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(untagged)] #[allow(clippy::large_enum_variant)] @@ -1636,8 +1689,6 @@ impl Display for ServerMessages { } } - - #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(untagged)] #[allow(clippy::large_enum_variant)] @@ -1734,7 +1785,6 @@ impl From> for MessagesFromClient { } } - #[deprecated(since = "0.4.0", note = "This trait was renamed to RpcMessage. Use RpcMessage instead.")] pub type RPCMessage = (); #[deprecated(since = "0.4.0", note = "This trait was renamed to McpMessage. Use McpMessage instead.")] @@ -4221,7 +4271,7 @@ mod tests { #[test] fn test_detect_message_type() { // standard request - let message = ClientJsonrpcRequest::new(RequestId::Integer(0), PingRequest::new(None).into()); + let message = ClientJsonrpcRequest::new(RequestId::Integer(0), PingRequest::new(RequestId::Integer(0), None).into()); let result = detect_message_type(&json!(message)); assert!(matches!(result, MessageTypes::Request)); diff --git a/tests/test_serialize.rs b/tests/test_serialize.rs index 48a8b3e..7117ba0 100644 --- a/tests/test_serialize.rs +++ b/tests/test_serialize.rs @@ -30,6 +30,7 @@ mod test_serialize { use super::common::re_serialize; /* ---------------------- CLIENT REQUESTS ---------------------- */ + #[cfg(not(feature = "draft"))] #[test] fn test_client_initialize_request() { // create a ClientMessage @@ -85,6 +86,7 @@ mod test_serialize { )); } + #[cfg(not(feature = "draft"))] #[test] fn test_client_list_resources_request() { // create a ClientMessage @@ -101,6 +103,7 @@ mod test_serialize { )); } + #[cfg(not(feature = "draft"))] #[test] fn test_client_read_resource_request() { // create a ClientMessage @@ -121,6 +124,7 @@ mod test_serialize { )); } + #[cfg(not(feature = "draft"))] #[test] fn test_client_list_prompts_request() { let message: ClientMessage = ClientMessage::Request(ClientJsonrpcRequest::new( @@ -136,6 +140,7 @@ mod test_serialize { )); } + #[cfg(not(feature = "draft"))] #[test] fn test_client_get_prompt_request() { let message: ClientMessage = ClientMessage::Request(ClientJsonrpcRequest::new( @@ -155,6 +160,7 @@ mod test_serialize { )); } + #[cfg(not(feature = "draft"))] #[test] fn test_client_list_tools_request() { let message: ClientMessage = ClientMessage::Request(ClientJsonrpcRequest::new( @@ -170,6 +176,7 @@ mod test_serialize { )); } + #[cfg(not(feature = "draft"))] #[test] fn test_client_call_tool_request() { let message: ClientMessage = ClientMessage::Request(ClientJsonrpcRequest::new( @@ -188,6 +195,7 @@ mod test_serialize { )); } + #[cfg(not(feature = "draft"))] #[test] fn test_client_ping_request() { let message: ClientMessage = ClientMessage::Request(ClientJsonrpcRequest::new( @@ -584,6 +592,7 @@ mod test_serialize { } /* ---------------------- SERVER REQUESTS ---------------------- */ + #[cfg(not(feature = "draft"))] #[test] fn test_server_requests() { let message: ServerMessage = ServerMessage::Request(ServerJsonrpcRequest::new( @@ -798,6 +807,7 @@ mod test_serialize { matches!(error_object.data, Some(data) if data["details"].as_str().unwrap() == "error detail"); } + #[cfg(not(feature = "draft"))] #[test] fn test_client_jsonrpc_request() { let message = ClientJsonrpcRequest::new(

AltStyle によって変換されたページ (->オリジナル) /