diff --git a/Cargo.toml b/Cargo.toml
index bf87c9b..1ca99e4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -45,5 +45,7 @@ latest = ["2025_03_26"]
2025_03_26 = []
# enabled mcp schema version 2024_11_05
2024_11_05 = []
+# enabled draft mcp schema
+draft = []
# Enables `schema_utils`, which provides utility types that simplify communication with MCP messages, improving ease of use while reducing potential mistakes ane errors when constructing messages.
schema_utils = []
diff --git a/README.md b/README.md
index ff1ab23..cc7a5ab 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
[
](https://github.com/rust-mcp-stack/rust-mcp-schema/actions/workflows/ci.yml)
-A type-safe implementation of the official Model Context Protocol (MCP) schema in Rust, supporting both the `2024_11_05` and `2025_03_26` versions.
+A type-safe Rust implementation of the official Model Context Protocol (MCP) schema, supporting all official released versions including `2024_11_05`, `2025_03_26`, and `draft` version for early adoption.
The MCP schemas in this repository are [automatically generated](#how-are-schemas-generated) from the official Model Context Protocol, ensuring they are always up-to-date and aligned with the latest official specifications.
@@ -46,7 +46,7 @@ Focus on your app's logic while [rust-mcp-sdk](https://crates.io/crates/rust-mcp
- 🧩 Type-safe implementation of the MCP protocol specification.
- 💎 Auto-generated schemas are always synchronized with the official schema specifications.
-- 📜 Includes both schema versions : `2024_11_05` and `2025_03_26`.
+- 📜 Includes all official released versions : `2024_11_05` and `2025_03_26` and `draft` version for early adoption.
- 🛠Complimentary schema utility module (schema_utils) to boost productivity and ensure development integrity.
## How can this crate be used?
@@ -68,10 +68,11 @@ For more information on the MCP architecture, refer to the [official documentati
## Schema Versions
-This repository provides all versions of the schema, which can be selected using Cargo features:
+This repository provides all official released versions the schema , including draft version, enabling you to prepare and adapt your applications ahead of upcoming official schema releases.
- [2024_11_05](src/generated_schema/2024_11_05)
- [2025_03_26](src/generated_schema/2025_03_26)
+- [draft](src/generated_schema/draft)
### How to switch between different schema versions?
diff --git a/examples/mcp_client_handle_message.rs b/examples/mcp_client_handle_message.rs
index 3cf8e54..b0e5379 100644
--- a/examples/mcp_client_handle_message.rs
+++ b/examples/mcp_client_handle_message.rs
@@ -107,7 +107,6 @@ fn handle_message(message_payload: &str) -> std::result::Result<(), AppError> {
ServerResult::ListResourcesResult(list_resources_result) => {
dbg!(list_resources_result);
}
- #[cfg(feature = "2024_11_05")]
ServerResult::ListResourceTemplatesResult(list_resource_templates_result) => {
dbg!(list_resource_templates_result);
}
diff --git a/examples/mcp_server_handle_message.rs b/examples/mcp_server_handle_message.rs
index 37df56b..5eda347 100644
--- a/examples/mcp_server_handle_message.rs
+++ b/examples/mcp_server_handle_message.rs
@@ -52,7 +52,6 @@ fn handle_message(message_payload: &str) -> std::result::Result<(), AppError> {
dbg!(list_resources_request);
}
- #[cfg(feature = "2024_11_05")]
ClientRequest::ListResourceTemplatesRequest(list_resource_templates_request) => {
dbg!(list_resource_templates_request);
}
diff --git a/scripts/run_clippy.sh b/scripts/run_clippy.sh
index a152f36..8088ee0 100755
--- a/scripts/run_clippy.sh
+++ b/scripts/run_clippy.sh
@@ -4,7 +4,7 @@
COMMON_FEATURES=("schema_utils")
# schema versions features (passed to clippy one at a time)
-SCHEMA_VERSION_FEATURES=("2025_03_26", "2024_11_05")
+SCHEMA_VERSION_FEATURES=("2025_03_26", "2024_11_05", "draft")
# space-separated string
COMMON_FEATURES_STR="${COMMON_FEATURES[*]}"
diff --git a/scripts/run_test.sh b/scripts/run_test.sh
index 433841a..9625120 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_03_26", "2024_11_05")
+SCHEMA_VERSION_FEATURES=("2025_03_26", "2024_11_05", "draft")
# space-separated string
COMMON_FEATURES_STR="${COMMON_FEATURES[*]}"
diff --git a/src/generated_schema.rs b/src/generated_schema.rs
index 77c8f5d..f95ede3 100644
--- a/src/generated_schema.rs
+++ b/src/generated_schema.rs
@@ -2,6 +2,7 @@
#[cfg(feature = "2024_11_05")]
#[path = "generated_schema/2024_11_05/mcp_schema.rs"]
mod schema_2024_11_05;
+
#[cfg(feature = "2024_11_05")]
pub use schema_2024_11_05::*;
@@ -23,3 +24,21 @@ pub use schema_2025_03_26::*;
#[cfg(not(feature = "2024_11_05"))]
#[path = "generated_schema/2025_03_26/schema_utils.rs"]
pub mod schema_utils;
+
+/// Schema Version : draft
+#[cfg(feature = "draft")]
+#[cfg(not(feature = "2024_11_05"))]
+#[cfg(not(feature = "2025_03_26"))]
+#[path = "generated_schema/draft/mcp_schema.rs"]
+mod schema_draft;
+
+#[cfg(feature = "draft")]
+#[cfg(not(feature = "2024_11_05"))]
+#[cfg(not(feature = "2025_03_26"))]
+pub use schema_draft::*;
+
+#[cfg(all(feature = "schema_utils", feature = "draft"))]
+#[cfg(not(feature = "2024_11_05"))]
+#[cfg(not(feature = "2025_03_26"))]
+#[path = "generated_schema/draft/schema_utils.rs"]
+pub mod schema_utils;
diff --git a/src/generated_schema/2024_11_05/mcp_schema.rs b/src/generated_schema/2024_11_05/mcp_schema.rs
index d61f45c..369e1d2 100644
--- a/src/generated_schema/2024_11_05/mcp_schema.rs
+++ b/src/generated_schema/2024_11_05/mcp_schema.rs
@@ -1,12 +1,12 @@
/// ----------------------------------------------------------------------------
-/// This file is auto-generated by mcp-schema-gen v0.1.16.
+/// This file is auto-generated by mcp-schema-gen v0.2.0.
/// WARNING:
/// It is not recommended to modify this file directly. You are free to
/// modify or extend the implementations as needed, but please do so at your own risk.
///
/// Generated from :
-/// Hash : 72516795d9a7aacdcf9b87624feb05229e10c950
-/// Generated at : 2025-04-04 20:01:25
+/// Hash : 5da5bac89165d68cad24a211119e4c1b61178d5a
+/// Generated at : 2025-04-26 18:56:03
/// ----------------------------------------------------------------------------
///
/// 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 818964f..244b751 100644
--- a/src/generated_schema/2024_11_05/schema_utils.rs
+++ b/src/generated_schema/2024_11_05/schema_utils.rs
@@ -59,12 +59,12 @@ fn detect_message_type(value: &serde_json::Value) -> MessageTypes {
/// Represents a generic MCP (Model Context Protocol) message.
/// This trait defines methods to classify and extract information from messages.
-pub trait RPCMessage: MCPMessage {
+pub trait RpcMessage: McpMessage {
fn request_id(&self) -> Option<&RequestId>;
fn jsonrpc(&self) -> &str;
}
-pub trait MCPMessage {
+pub trait McpMessage {
fn is_response(&self) -> bool;
fn is_request(&self) -> bool;
fn is_notification(&self) -> bool;
@@ -226,7 +226,7 @@ impl ClientMessage {
}
}
-impl RPCMessage for ClientMessage {
+impl RpcMessage for ClientMessage {
// Retrieves the request ID associated with the message, if applicable
fn request_id(&self) -> Option<&RequestId> {
match self {
@@ -251,8 +251,8 @@ impl RPCMessage for ClientMessage {
}
}
-// Implementing the `MCPMessage` trait for `ClientMessage`
-impl MCPMessage for ClientMessage {
+// Implementing the `McpMessage` trait for `ClientMessage`
+impl McpMessage for ClientMessage {
// Returns true if the message is a response type
fn is_response(&self) -> bool {
matches!(self, ClientMessage::Response(_))
@@ -738,7 +738,7 @@ impl ServerMessage {
}
}
-impl RPCMessage for ServerMessage {
+impl RpcMessage for ServerMessage {
// Retrieves the request ID associated with the message, if applicable
fn request_id(&self) -> Option<&RequestId> {
match self {
@@ -767,8 +767,8 @@ impl RPCMessage for ServerMessage {
}
}
-// Implementing the `MCPMessage` trait for `ServerMessage`
-impl MCPMessage for ServerMessage {
+// Implementing the `McpMessage` trait for `ServerMessage`
+impl McpMessage for ServerMessage {
// Returns true if the message is a response type
fn is_response(&self) -> bool {
matches!(self, ServerMessage::Response(_))
@@ -1183,7 +1183,7 @@ impl From for MessageFromServer {
}
}
-impl MCPMessage for MessageFromServer {
+impl McpMessage for MessageFromServer {
fn is_response(&self) -> bool {
matches!(self, MessageFromServer::ResultFromServer(_))
}
@@ -1288,7 +1288,7 @@ impl From for MessageFromClient {
}
}
-impl MCPMessage for MessageFromClient {
+impl McpMessage for MessageFromClient {
fn is_response(&self) -> bool {
matches!(self, MessageFromClient::ResultFromClient(_))
}
@@ -1442,6 +1442,11 @@ impl CallToolRequest {
}
}
+#[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.")]
+pub type MCPMessage = ();
+
/// BEGIN AUTO GENERATED
impl ::serde::Serialize for ClientJsonrpcRequest {
fn serialize(&self, serializer: S) -> std::result::Result
diff --git a/src/generated_schema/2025_03_26/mcp_schema.rs b/src/generated_schema/2025_03_26/mcp_schema.rs
index b8f9431..6d95e5b 100644
--- a/src/generated_schema/2025_03_26/mcp_schema.rs
+++ b/src/generated_schema/2025_03_26/mcp_schema.rs
@@ -1,12 +1,12 @@
/// ----------------------------------------------------------------------------
-/// This file is auto-generated by mcp-schema-gen v0.1.16.
+/// This file is auto-generated by mcp-schema-gen v0.2.0.
/// WARNING:
/// It is not recommended to modify this file directly. You are free to
/// modify or extend the implementations as needed, but please do so at your own risk.
///
/// Generated from :
-/// Hash : 72516795d9a7aacdcf9b87624feb05229e10c950
-/// Generated at : 2025-04-04 20:01:26
+/// Hash : 5da5bac89165d68cad24a211119e4c1b61178d5a
+/// Generated at : 2025-04-26 18:56:03
/// ----------------------------------------------------------------------------
///
/// MCP Protocol Version
@@ -594,6 +594,9 @@ impl ::std::convert::From for ClientNotification {
/// "$ref": "#/definitions/ListResourcesRequest"
/// },
/// {
+/// "$ref": "#/definitions/ListResourceTemplatesRequest"
+/// },
+/// {
/// "$ref": "#/definitions/ReadResourceRequest"
/// },
/// {
@@ -630,6 +633,7 @@ pub enum ClientRequest {
InitializeRequest(InitializeRequest),
PingRequest(PingRequest),
ListResourcesRequest(ListResourcesRequest),
+ ListResourceTemplatesRequest(ListResourceTemplatesRequest),
ReadResourceRequest(ReadResourceRequest),
SubscribeRequest(SubscribeRequest),
UnsubscribeRequest(UnsubscribeRequest),
@@ -655,6 +659,11 @@ impl ::std::convert::From for ClientRequest {
Self::ListResourcesRequest(value)
}
}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: ListResourceTemplatesRequest) -> Self {
+ Self::ListResourceTemplatesRequest(value)
+ }
+}
impl ::std::convert::From for ClientRequest {
fn from(value: ReadResourceRequest) -> Self {
Self::ReadResourceRequest(value)
@@ -4237,6 +4246,10 @@ pub struct RequestParamsMeta {
/// "description": "A human-readable name for this resource.\n\nThis can be used by clients to populate UI elements.",
/// "type": "string"
/// },
+/// "size": {
+/// "description": "The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.\n\nThis can be used by Hosts to display file sizes and estimate context window usage.",
+/// "type": "integer"
+/// },
/// "uri": {
/// "description": "The URI of this resource.",
/// "type": "string",
@@ -4261,6 +4274,10 @@ pub struct Resource {
/**A human-readable name for this resource.
This can be used by clients to populate UI elements.*/
pub name: ::std::string::String,
+ /**The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
+ This can be used by Hosts to display file sizes and estimate context window usage.*/
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub size: ::std::option::Option,
///The URI of this resource.
pub uri: ::std::string::String,
}
@@ -5143,6 +5160,9 @@ impl ::std::convert::From for ServerRequest {
/// "$ref": "#/definitions/ListResourcesResult"
/// },
/// {
+/// "$ref": "#/definitions/ListResourceTemplatesResult"
+/// },
+/// {
/// "$ref": "#/definitions/ReadResourceResult"
/// },
/// {
@@ -5169,6 +5189,7 @@ impl ::std::convert::From for ServerRequest {
pub enum ServerResult {
InitializeResult(InitializeResult),
ListResourcesResult(ListResourcesResult),
+ ListResourceTemplatesResult(ListResourceTemplatesResult),
ReadResourceResult(ReadResourceResult),
ListPromptsResult(ListPromptsResult),
GetPromptResult(GetPromptResult),
@@ -5187,6 +5208,11 @@ impl ::std::convert::From for ServerResult {
Self::ListResourcesResult(value)
}
}
+impl ::std::convert::From for ServerResult {
+ fn from(value: ListResourceTemplatesResult) -> Self {
+ Self::ListResourceTemplatesResult(value)
+ }
+}
impl ::std::convert::From for ServerResult {
fn from(value: ReadResourceResult) -> Self {
Self::ReadResourceResult(value)
@@ -5549,7 +5575,7 @@ received from untrusted servers.*/
///
/// ```json
///{
-/// "description": "Additional properties describing a Tool to clients.\n\nNOTE: all properties in ToolAnnotations are **hints**. \nThey are not guaranteed to provide a faithful description of \ntool behavior (including descriptive properties like title).\n\nClients should never make tool use decisions based on ToolAnnotations\nreceived from untrusted servers.",
+/// "description": "Additional properties describing a Tool to clients.\n\nNOTE: all properties in ToolAnnotations are **hints**.\nThey are not guaranteed to provide a faithful description of\ntool behavior (including descriptive properties like title).\n\nClients should never make tool use decisions based on ToolAnnotations\nreceived from untrusted servers.",
/// "type": "object",
/// "properties": {
/// "destructiveHint": {
@@ -5557,7 +5583,7 @@ received from untrusted servers.*/
/// "type": "boolean"
/// },
/// "idempotentHint": {
-/// "description": "If true, calling the tool repeatedly with the same arguments \nwill have no additional effect on the its environment.\n\n(This property is meaningful only when readOnlyHint == false)\n\nDefault: false",
+/// "description": "If true, calling the tool repeatedly with the same arguments\nwill have no additional effect on the its environment.\n\n(This property is meaningful only when readOnlyHint == false)\n\nDefault: false",
/// "type": "boolean"
/// },
/// "openWorldHint": {
@@ -5850,6 +5876,11 @@ impl<'de> serde::Deserialize<'de> for ClientRequest {
let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::ListResourcesRequest(req))
}
+ "resources/templates/list" => {
+ let req =
+ serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::ListResourceTemplatesRequest(req))
+ }
"resources/read" => {
let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::ReadResourceRequest(req))
@@ -5899,6 +5930,7 @@ impl ClientRequest {
ClientRequest::InitializeRequest(request) => request.method(),
ClientRequest::PingRequest(request) => request.method(),
ClientRequest::ListResourcesRequest(request) => request.method(),
+ ClientRequest::ListResourceTemplatesRequest(request) => request.method(),
ClientRequest::ReadResourceRequest(request) => request.method(),
ClientRequest::SubscribeRequest(request) => request.method(),
ClientRequest::UnsubscribeRequest(request) => request.method(),
diff --git a/src/generated_schema/2025_03_26/schema_utils.rs b/src/generated_schema/2025_03_26/schema_utils.rs
index 27aae34..4ac6368 100644
--- a/src/generated_schema/2025_03_26/schema_utils.rs
+++ b/src/generated_schema/2025_03_26/schema_utils.rs
@@ -59,12 +59,12 @@ fn detect_message_type(value: &serde_json::Value) -> MessageTypes {
/// Represents a generic MCP (Model Context Protocol) message.
/// This trait defines methods to classify and extract information from messages.
-pub trait RPCMessage: MCPMessage {
+pub trait RpcMessage: McpMessage {
fn request_id(&self) -> Option<&RequestId>;
fn jsonrpc(&self) -> &str;
}
-pub trait MCPMessage {
+pub trait McpMessage {
fn is_response(&self) -> bool;
fn is_request(&self) -> bool;
fn is_notification(&self) -> bool;
@@ -226,7 +226,7 @@ impl ClientMessage {
}
}
-impl RPCMessage for ClientMessage {
+impl RpcMessage for ClientMessage {
// Retrieves the request ID associated with the message, if applicable
fn request_id(&self) -> Option<&RequestId> {
match self {
@@ -251,8 +251,8 @@ impl RPCMessage for ClientMessage {
}
}
-// Implementing the `MCPMessage` trait for `ClientMessage`
-impl MCPMessage for ClientMessage {
+// Implementing the `McpMessage` trait for `ClientMessage`
+impl McpMessage for ClientMessage {
// Returns true if the message is a response type
fn is_response(&self) -> bool {
matches!(self, ClientMessage::Response(_))
@@ -738,7 +738,7 @@ impl ServerMessage {
}
}
-impl RPCMessage for ServerMessage {
+impl RpcMessage for ServerMessage {
// Retrieves the request ID associated with the message, if applicable
fn request_id(&self) -> Option<&RequestId> {
match self {
@@ -767,8 +767,8 @@ impl RPCMessage for ServerMessage {
}
}
-// Implementing the `MCPMessage` trait for `ServerMessage`
-impl MCPMessage for ServerMessage {
+// Implementing the `McpMessage` trait for `ServerMessage`
+impl McpMessage for ServerMessage {
// Returns true if the message is a response type
fn is_response(&self) -> bool {
matches!(self, ServerMessage::Response(_))
@@ -1183,7 +1183,7 @@ impl From for MessageFromServer {
}
}
-impl MCPMessage for MessageFromServer {
+impl McpMessage for MessageFromServer {
fn is_response(&self) -> bool {
matches!(self, MessageFromServer::ResultFromServer(_))
}
@@ -1288,7 +1288,7 @@ impl From for MessageFromClient {
}
}
-impl MCPMessage for MessageFromClient {
+impl McpMessage for MessageFromClient {
fn is_response(&self) -> bool {
matches!(self, MessageFromClient::ResultFromClient(_))
}
@@ -1442,6 +1442,11 @@ impl CallToolRequest {
}
}
+#[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.")]
+pub type MCPMessage = ();
+
/// BEGIN AUTO GENERATED
impl ::serde::Serialize for ClientJsonrpcRequest {
fn serialize(&self, serializer: S) -> std::result::Result
@@ -1462,6 +1467,11 @@ impl ::serde::Serialize for ClientJsonrpcRequest {
}
}
ListResourcesRequest(msg) => state.serialize_field("params", &msg.params)?,
+ ListResourceTemplatesRequest(msg) => {
+ if let Some(params) = &msg.params {
+ state.serialize_field("params", params)?
+ }
+ }
ReadResourceRequest(msg) => state.serialize_field("params", &msg.params)?,
SubscribeRequest(msg) => state.serialize_field("params", &msg.params)?,
UnsubscribeRequest(msg) => state.serialize_field("params", &msg.params)?,
@@ -1904,6 +1914,11 @@ impl From for RequestFromClient {
Self::ClientRequest(value.into())
}
}
+impl From for RequestFromClient {
+ fn from(value: ListResourceTemplatesRequest) -> Self {
+ Self::ClientRequest(value.into())
+ }
+}
impl From for RequestFromClient {
fn from(value: ReadResourceRequest) -> Self {
Self::ClientRequest(value.into())
@@ -1964,6 +1979,11 @@ impl From for MessageFromClient {
MessageFromClient::RequestFromClient(value.into())
}
}
+impl From for MessageFromClient {
+ fn from(value: ListResourceTemplatesRequest) -> Self {
+ MessageFromClient::RequestFromClient(value.into())
+ }
+}
impl From for MessageFromClient {
fn from(value: ReadResourceRequest) -> Self {
MessageFromClient::RequestFromClient(value.into())
@@ -2497,6 +2517,11 @@ impl From for ResultFromServer {
Self::ServerResult(value.into())
}
}
+impl From for ResultFromServer {
+ fn from(value: ListResourceTemplatesResult) -> Self {
+ Self::ServerResult(value.into())
+ }
+}
impl From for ResultFromServer {
fn from(value: ReadResourceResult) -> Self {
Self::ServerResult(value.into())
@@ -2542,6 +2567,11 @@ impl From for MessageFromServer {
MessageFromServer::ResultFromServer(value.into())
}
}
+impl From for MessageFromServer {
+ fn from(value: ListResourceTemplatesResult) -> Self {
+ MessageFromServer::ResultFromServer(value.into())
+ }
+}
impl From for MessageFromServer {
fn from(value: ReadResourceResult) -> Self {
MessageFromServer::ResultFromServer(value.into())
@@ -2608,6 +2638,21 @@ impl ToMessage for ListResourcesRequest {
ClientMessage::from_message(self, request_id)
}
}
+impl FromMessage for ClientMessage {
+ fn from_message(
+ message: ListResourceTemplatesRequest,
+ request_id: Option,
+ ) -> std::result::Result {
+ let request_id =
+ request_id.ok_or_else(|| RpcError::internal_error().with_message("request_id is None!".to_string()))?;
+ Ok(ClientMessage::Request(ClientJsonrpcRequest::new(request_id, message.into())))
+ }
+}
+impl ToMessage for ListResourceTemplatesRequest {
+ fn to_message(self, request_id: Option) -> std::result::Result {
+ ClientMessage::from_message(self, request_id)
+ }
+}
impl FromMessage for ClientMessage {
fn from_message(message: ReadResourceRequest, request_id: Option) -> std::result::Result {
let request_id =
@@ -2905,6 +2950,24 @@ impl ToMessage for ListResourcesResult {
ServerMessage::from_message(self, request_id)
}
}
+impl FromMessage for ServerMessage {
+ fn from_message(
+ message: ListResourceTemplatesResult,
+ request_id: Option,
+ ) -> std::result::Result {
+ let request_id =
+ request_id.ok_or_else(|| RpcError::internal_error().with_message("request_id is None!".to_string()))?;
+ Ok(ServerMessage::Response(ServerJsonrpcResponse::new(
+ request_id,
+ message.into(),
+ )))
+ }
+}
+impl ToMessage for ListResourceTemplatesResult {
+ fn to_message(self, request_id: Option) -> std::result::Result {
+ ServerMessage::from_message(self, request_id)
+ }
+}
impl FromMessage for ServerMessage {
fn from_message(message: ReadResourceResult, request_id: Option) -> std::result::Result {
let request_id =
@@ -3148,6 +3211,17 @@ impl TryFrom for ListResourcesRequest {
}
}
}
+impl TryFrom for ListResourceTemplatesRequest {
+ type Error = RpcError;
+ fn try_from(value: RequestFromClient) -> std::result::Result {
+ let matched_type: ClientRequest = value.try_into()?;
+ if let ClientRequest::ListResourceTemplatesRequest(result) = matched_type {
+ Ok(result)
+ } else {
+ Err(RpcError::internal_error().with_message("Not a ListResourceTemplatesRequest".to_string()))
+ }
+ }
+}
impl TryFrom for ReadResourceRequest {
type Error = RpcError;
fn try_from(value: RequestFromClient) -> std::result::Result {
@@ -3390,6 +3464,17 @@ impl TryFrom for ListResourcesResult {
}
}
}
+impl TryFrom for ListResourceTemplatesResult {
+ type Error = RpcError;
+ fn try_from(value: ResultFromServer) -> std::result::Result {
+ let matched_type: ServerResult = value.try_into()?;
+ if let ServerResult::ListResourceTemplatesResult(result) = matched_type {
+ Ok(result)
+ } else {
+ Err(RpcError::internal_error().with_message("Not a ListResourceTemplatesResult".to_string()))
+ }
+ }
+}
impl TryFrom for ReadResourceResult {
type Error = RpcError;
fn try_from(value: ResultFromServer) -> std::result::Result {
diff --git a/src/generated_schema/draft/mcp_schema.rs b/src/generated_schema/draft/mcp_schema.rs
new file mode 100644
index 0000000..36bc1d4
--- /dev/null
+++ b/src/generated_schema/draft/mcp_schema.rs
@@ -0,0 +1,6095 @@
+/// ----------------------------------------------------------------------------
+/// This file is auto-generated by mcp-schema-gen v0.2.0.
+/// WARNING:
+/// It is not recommended to modify this file directly. You are free to
+/// modify or extend the implementations as needed, but please do so at your own risk.
+///
+/// Generated from :
+/// Hash : 5da5bac89165d68cad24a211119e4c1b61178d5a
+/// Generated at : 2025-04-26 18:56:03
+/// ----------------------------------------------------------------------------
+///
+/// MCP Protocol Version
+pub const LATEST_PROTOCOL_VERSION: &str = "DRAFT-2025-v2";
+/// JSON-RPC Version
+pub const JSONRPC_VERSION: &str = "2.0";
+/// Parse error. Invalid JSON was received. An error occurred while parsing the JSON text.
+pub const PARSE_ERROR: i64 = -32700i64;
+/// Invalid Request. The JSON sent is not a valid Request object.
+pub const INVALID_REQUEST: i64 = -32600i64;
+/// Method not found. The method does not exist / is not available.
+pub const METHOD_NOT_FOUND: i64 = -32601i64;
+/// Invalid param. Invalid method parameter(s).
+pub const INVALID_PARAMS: i64 = -32602i64;
+/// Internal error. Internal JSON-RPC error.
+pub const INTERNAL_ERROR: i64 = -32603i64;
+///Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Optional annotations for the client. The client can use annotations to inform how objects are used or displayed",
+/// "type": "object",
+/// "properties": {
+/// "audience": {
+/// "description": "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., [\"user\", \"assistant\"]).",
+/// "type": "array",
+/// "items": {
+/// "$ref": "#/definitions/Role"
+/// }
+/// },
+/// "priority": {
+/// "description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.",
+/// "type": "number",
+/// "maximum": 1.0,
+/// "minimum": 0.0
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct Annotations {
+ /**Describes who the intended customer of this object or data is.
+ It can include multiple entries to indicate content useful for multiple audiences (e.g., ["user", "assistant"]).*/
+ #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
+ pub audience: ::std::vec::Vec,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub priority: ::std::option::Option,
+}
+///Audio provided to or from an LLM.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Audio provided to or from an LLM.",
+/// "type": "object",
+/// "required": [
+/// "data",
+/// "mimeType",
+/// "type"
+/// ],
+/// "properties": {
+/// "annotations": {
+/// "description": "Optional annotations for the client.",
+/// "$ref": "#/definitions/Annotations"
+/// },
+/// "data": {
+/// "description": "The base64-encoded audio data.",
+/// "type": "string",
+/// "format": "byte"
+/// },
+/// "mimeType": {
+/// "description": "The MIME type of the audio. Different providers may support different audio types.",
+/// "type": "string"
+/// },
+/// "type": {
+/// "type": "string",
+/// "const": "audio"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct AudioContent {
+ ///Optional annotations for the client.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub annotations: ::std::option::Option,
+ ///The base64-encoded audio data.
+ pub data: ::std::string::String,
+ ///The MIME type of the audio. Different providers may support different audio types.
+ #[serde(rename = "mimeType")]
+ pub mime_type: ::std::string::String,
+ #[serde(rename = "type")]
+ type_: ::std::string::String,
+}
+impl AudioContent {
+ pub fn new(
+ data: ::std::string::String,
+ mime_type: ::std::string::String,
+ annotations: ::std::option::Option,
+ ) -> Self {
+ Self {
+ annotations,
+ data,
+ mime_type,
+ type_: "audio".to_string(),
+ }
+ }
+ pub fn type_(&self) -> &::std::string::String {
+ &self.type_
+ }
+ pub fn type_name() -> ::std::string::String {
+ "audio".to_string()
+ }
+}
+///BlobResourceContents
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "blob",
+/// "uri"
+/// ],
+/// "properties": {
+/// "blob": {
+/// "description": "A base64-encoded string representing the binary data of the item.",
+/// "type": "string",
+/// "format": "byte"
+/// },
+/// "mimeType": {
+/// "description": "The MIME type of this resource, if known.",
+/// "type": "string"
+/// },
+/// "uri": {
+/// "description": "The URI of this resource.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct BlobResourceContents {
+ ///A base64-encoded string representing the binary data of the item.
+ pub blob: ::std::string::String,
+ ///The MIME type of this resource, if known.
+ #[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub mime_type: ::std::option::Option<::std::string::String>,
+ ///The URI of this resource.
+ pub uri: ::std::string::String,
+}
+///Used by the client to invoke a tool provided by the server.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Used by the client to invoke a tool provided by the server.",
+/// "type": "object",
+/// "required": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "tools/call"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "name"
+/// ],
+/// "properties": {
+/// "arguments": {
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "name": {
+/// "type": "string"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CallToolRequest {
+ method: ::std::string::String,
+ pub params: CallToolRequestParams,
+}
+impl CallToolRequest {
+ pub fn new(params: CallToolRequestParams) -> Self {
+ Self {
+ method: "tools/call".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "tools/call".to_string()
+ }
+}
+///CallToolRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "name"
+/// ],
+/// "properties": {
+/// "arguments": {
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "name": {
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CallToolRequestParams {
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub arguments: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+ pub name: ::std::string::String,
+}
+/**The server's response to a tool call.
+Any errors that originate from the tool SHOULD be reported inside the result
+object, with isError set to true, _not_ as an MCP protocol-level error
+response. Otherwise, the LLM would not be able to see that an error occurred
+and self-correct.
+However, any errors in _finding_ the tool, an error indicating that the
+server does not support tool calls, or any other exceptional conditions,
+should be reported as an MCP error response.*/
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The server's response to a tool call.\n\nAny errors that originate from the tool SHOULD be reported inside the result\nobject, with isError set to true, _not_ as an MCP protocol-level error\nresponse. Otherwise, the LLM would not be able to see that an error occurred\nand self-correct.\n\nHowever, any errors in _finding_ the tool, an error indicating that the\nserver does not support tool calls, or any other exceptional conditions,\nshould be reported as an MCP error response.",
+/// "type": "object",
+/// "required": [
+/// "content"
+/// ],
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "content": {
+/// "type": "array",
+/// "items": {
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/TextContent"
+/// },
+/// {
+/// "$ref": "#/definitions/ImageContent"
+/// },
+/// {
+/// "$ref": "#/definitions/AudioContent"
+/// },
+/// {
+/// "$ref": "#/definitions/EmbeddedResource"
+/// }
+/// ]
+/// }
+/// },
+/// "isError": {
+/// "description": "Whether the tool call ended in an error.\n\nIf not set, this is assumed to be false (the call was successful).",
+/// "type": "boolean"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CallToolResult {
+ pub content: ::std::vec::Vec,
+ /**Whether the tool call ended in an error.
+ If not set, this is assumed to be false (the call was successful).*/
+ #[serde(rename = "isError", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub is_error: ::std::option::Option,
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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>>,
+}
+///CallToolResultContentItem
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/TextContent"
+/// },
+/// {
+/// "$ref": "#/definitions/ImageContent"
+/// },
+/// {
+/// "$ref": "#/definitions/AudioContent"
+/// },
+/// {
+/// "$ref": "#/definitions/EmbeddedResource"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum CallToolResultContentItem {
+ TextContent(TextContent),
+ ImageContent(ImageContent),
+ AudioContent(AudioContent),
+ EmbeddedResource(EmbeddedResource),
+}
+impl ::std::convert::From for CallToolResultContentItem {
+ fn from(value: TextContent) -> Self {
+ Self::TextContent(value)
+ }
+}
+impl ::std::convert::From for CallToolResultContentItem {
+ fn from(value: ImageContent) -> Self {
+ Self::ImageContent(value)
+ }
+}
+impl ::std::convert::From for CallToolResultContentItem {
+ fn from(value: AudioContent) -> Self {
+ Self::AudioContent(value)
+ }
+}
+impl ::std::convert::From for CallToolResultContentItem {
+ fn from(value: EmbeddedResource) -> Self {
+ Self::EmbeddedResource(value)
+ }
+}
+/**This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
+The 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.
+This notification indicates that the result will be unused, so any associated processing SHOULD cease.
+A client MUST NOT attempt to cancel its initialize request.*/
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "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": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "notifications/cancelled"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "requestId"
+/// ],
+/// "properties": {
+/// "reason": {
+/// "description": "An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.",
+/// "type": "string"
+/// },
+/// "requestId": {
+/// "description": "The ID of the request to cancel.\n\nThis MUST correspond to the ID of a request previously issued in the same direction.",
+/// "$ref": "#/definitions/RequestId"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CancelledNotification {
+ method: ::std::string::String,
+ pub params: CancelledNotificationParams,
+}
+impl CancelledNotification {
+ pub fn new(params: CancelledNotificationParams) -> Self {
+ Self {
+ method: "notifications/cancelled".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "notifications/cancelled".to_string()
+ }
+}
+///CancelledNotificationParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "requestId"
+/// ],
+/// "properties": {
+/// "reason": {
+/// "description": "An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.",
+/// "type": "string"
+/// },
+/// "requestId": {
+/// "description": "The ID of the request to cancel.\n\nThis MUST correspond to the ID of a request previously issued in the same direction.",
+/// "$ref": "#/definitions/RequestId"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CancelledNotificationParams {
+ ///An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub reason: ::std::option::Option<::std::string::String>,
+ /**The ID of the request to cancel.
+ This MUST correspond to the ID of a request previously issued in the same direction.*/
+ #[serde(rename = "requestId")]
+ pub request_id: RequestId,
+}
+///Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.",
+/// "type": "object",
+/// "properties": {
+/// "experimental": {
+/// "description": "Experimental, non-standard capabilities that the client supports.",
+/// "type": "object",
+/// "additionalProperties": {
+/// "type": "object",
+/// "additionalProperties": true
+/// }
+/// },
+/// "roots": {
+/// "description": "Present if the client supports listing roots.",
+/// "type": "object",
+/// "properties": {
+/// "listChanged": {
+/// "description": "Whether the client supports notifications for changes to the roots list.",
+/// "type": "boolean"
+/// }
+/// }
+/// },
+/// "sampling": {
+/// "description": "Present if the client supports sampling from an LLM.",
+/// "type": "object",
+/// "additionalProperties": true
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ClientCapabilities {
+ ///Experimental, non-standard capabilities that the client supports.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub experimental: ::std::option::Option<
+ ::std::collections::HashMap<::std::string::String, ::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+ >,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub roots: ::std::option::Option,
+ ///Present if the client supports sampling from an LLM.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub sampling: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+}
+///Present if the client supports listing roots.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Present if the client supports listing roots.",
+/// "type": "object",
+/// "properties": {
+/// "listChanged": {
+/// "description": "Whether the client supports notifications for changes to the roots list.",
+/// "type": "boolean"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ClientCapabilitiesRoots {
+ ///Whether the client supports notifications for changes to the roots list.
+ #[serde(rename = "listChanged", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub list_changed: ::std::option::Option,
+}
+///ClientNotification
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/CancelledNotification"
+/// },
+/// {
+/// "$ref": "#/definitions/InitializedNotification"
+/// },
+/// {
+/// "$ref": "#/definitions/ProgressNotification"
+/// },
+/// {
+/// "$ref": "#/definitions/RootsListChangedNotification"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum ClientNotification {
+ CancelledNotification(CancelledNotification),
+ InitializedNotification(InitializedNotification),
+ ProgressNotification(ProgressNotification),
+ RootsListChangedNotification(RootsListChangedNotification),
+}
+impl ::std::convert::From for ClientNotification {
+ fn from(value: CancelledNotification) -> Self {
+ Self::CancelledNotification(value)
+ }
+}
+impl ::std::convert::From for ClientNotification {
+ fn from(value: InitializedNotification) -> Self {
+ Self::InitializedNotification(value)
+ }
+}
+impl ::std::convert::From for ClientNotification {
+ fn from(value: ProgressNotification) -> Self {
+ Self::ProgressNotification(value)
+ }
+}
+impl ::std::convert::From for ClientNotification {
+ fn from(value: RootsListChangedNotification) -> Self {
+ Self::RootsListChangedNotification(value)
+ }
+}
+///ClientRequest
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/InitializeRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/PingRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/ListResourcesRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/ListResourceTemplatesRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/ReadResourceRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/SubscribeRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/UnsubscribeRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/ListPromptsRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/GetPromptRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/ListToolsRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/CallToolRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/SetLevelRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/CompleteRequest"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum ClientRequest {
+ InitializeRequest(InitializeRequest),
+ PingRequest(PingRequest),
+ ListResourcesRequest(ListResourcesRequest),
+ ListResourceTemplatesRequest(ListResourceTemplatesRequest),
+ ReadResourceRequest(ReadResourceRequest),
+ SubscribeRequest(SubscribeRequest),
+ UnsubscribeRequest(UnsubscribeRequest),
+ ListPromptsRequest(ListPromptsRequest),
+ GetPromptRequest(GetPromptRequest),
+ ListToolsRequest(ListToolsRequest),
+ CallToolRequest(CallToolRequest),
+ SetLevelRequest(SetLevelRequest),
+ CompleteRequest(CompleteRequest),
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: InitializeRequest) -> Self {
+ Self::InitializeRequest(value)
+ }
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: PingRequest) -> Self {
+ Self::PingRequest(value)
+ }
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: ListResourcesRequest) -> Self {
+ Self::ListResourcesRequest(value)
+ }
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: ListResourceTemplatesRequest) -> Self {
+ Self::ListResourceTemplatesRequest(value)
+ }
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: ReadResourceRequest) -> Self {
+ Self::ReadResourceRequest(value)
+ }
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: SubscribeRequest) -> Self {
+ Self::SubscribeRequest(value)
+ }
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: UnsubscribeRequest) -> Self {
+ Self::UnsubscribeRequest(value)
+ }
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: ListPromptsRequest) -> Self {
+ Self::ListPromptsRequest(value)
+ }
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: GetPromptRequest) -> Self {
+ Self::GetPromptRequest(value)
+ }
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: ListToolsRequest) -> Self {
+ Self::ListToolsRequest(value)
+ }
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: CallToolRequest) -> Self {
+ Self::CallToolRequest(value)
+ }
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: SetLevelRequest) -> Self {
+ Self::SetLevelRequest(value)
+ }
+}
+impl ::std::convert::From for ClientRequest {
+ fn from(value: CompleteRequest) -> Self {
+ Self::CompleteRequest(value)
+ }
+}
+///ClientResult
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/Result"
+/// },
+/// {
+/// "$ref": "#/definitions/CreateMessageResult"
+/// },
+/// {
+/// "$ref": "#/definitions/ListRootsResult"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum ClientResult {
+ CreateMessageResult(CreateMessageResult),
+ ListRootsResult(ListRootsResult),
+ Result(Result),
+}
+impl ::std::convert::From for ClientResult {
+ fn from(value: CreateMessageResult) -> Self {
+ Self::CreateMessageResult(value)
+ }
+}
+impl ::std::convert::From for ClientResult {
+ fn from(value: ListRootsResult) -> Self {
+ Self::ListRootsResult(value)
+ }
+}
+impl ::std::convert::From for ClientResult {
+ fn from(value: Result) -> Self {
+ Self::Result(value)
+ }
+}
+///A request from the client to the server, to ask for completion options.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A request from the client to the server, to ask for completion options.",
+/// "type": "object",
+/// "required": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "completion/complete"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "argument",
+/// "ref"
+/// ],
+/// "properties": {
+/// "argument": {
+/// "description": "The argument's information",
+/// "type": "object",
+/// "required": [
+/// "name",
+/// "value"
+/// ],
+/// "properties": {
+/// "name": {
+/// "description": "The name of the argument",
+/// "type": "string"
+/// },
+/// "value": {
+/// "description": "The value of the argument to use for completion matching.",
+/// "type": "string"
+/// }
+/// }
+/// },
+/// "ref": {
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/PromptReference"
+/// },
+/// {
+/// "$ref": "#/definitions/ResourceReference"
+/// }
+/// ]
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CompleteRequest {
+ method: ::std::string::String,
+ pub params: CompleteRequestParams,
+}
+impl CompleteRequest {
+ pub fn new(params: CompleteRequestParams) -> Self {
+ Self {
+ method: "completion/complete".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "completion/complete".to_string()
+ }
+}
+///CompleteRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "argument",
+/// "ref"
+/// ],
+/// "properties": {
+/// "argument": {
+/// "description": "The argument's information",
+/// "type": "object",
+/// "required": [
+/// "name",
+/// "value"
+/// ],
+/// "properties": {
+/// "name": {
+/// "description": "The name of the argument",
+/// "type": "string"
+/// },
+/// "value": {
+/// "description": "The value of the argument to use for completion matching.",
+/// "type": "string"
+/// }
+/// }
+/// },
+/// "ref": {
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/PromptReference"
+/// },
+/// {
+/// "$ref": "#/definitions/ResourceReference"
+/// }
+/// ]
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CompleteRequestParams {
+ pub argument: CompleteRequestParamsArgument,
+ #[serde(rename = "ref")]
+ pub ref_: CompleteRequestParamsRef,
+}
+///The argument's information
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The argument's information",
+/// "type": "object",
+/// "required": [
+/// "name",
+/// "value"
+/// ],
+/// "properties": {
+/// "name": {
+/// "description": "The name of the argument",
+/// "type": "string"
+/// },
+/// "value": {
+/// "description": "The value of the argument to use for completion matching.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CompleteRequestParamsArgument {
+ ///The name of the argument
+ pub name: ::std::string::String,
+ ///The value of the argument to use for completion matching.
+ pub value: ::std::string::String,
+}
+///CompleteRequestParamsRef
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/PromptReference"
+/// },
+/// {
+/// "$ref": "#/definitions/ResourceReference"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum CompleteRequestParamsRef {
+ PromptReference(PromptReference),
+ ResourceReference(ResourceReference),
+}
+impl ::std::convert::From for CompleteRequestParamsRef {
+ fn from(value: PromptReference) -> Self {
+ Self::PromptReference(value)
+ }
+}
+impl ::std::convert::From for CompleteRequestParamsRef {
+ fn from(value: ResourceReference) -> Self {
+ Self::ResourceReference(value)
+ }
+}
+///The server's response to a completion/complete request
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The server's response to a completion/complete request",
+/// "type": "object",
+/// "required": [
+/// "completion"
+/// ],
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "completion": {
+/// "type": "object",
+/// "required": [
+/// "values"
+/// ],
+/// "properties": {
+/// "hasMore": {
+/// "description": "Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.",
+/// "type": "boolean"
+/// },
+/// "total": {
+/// "description": "The total number of completion options available. This can exceed the number of values actually sent in the response.",
+/// "type": "integer"
+/// },
+/// "values": {
+/// "description": "An array of completion values. Must not exceed 100 items.",
+/// "type": "array",
+/// "items": {
+/// "type": "string"
+/// }
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CompleteResult {
+ pub completion: CompleteResultCompletion,
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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>>,
+}
+///CompleteResultCompletion
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "values"
+/// ],
+/// "properties": {
+/// "hasMore": {
+/// "description": "Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.",
+/// "type": "boolean"
+/// },
+/// "total": {
+/// "description": "The total number of completion options available. This can exceed the number of values actually sent in the response.",
+/// "type": "integer"
+/// },
+/// "values": {
+/// "description": "An array of completion values. Must not exceed 100 items.",
+/// "type": "array",
+/// "items": {
+/// "type": "string"
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CompleteResultCompletion {
+ ///Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
+ #[serde(rename = "hasMore", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub has_more: ::std::option::Option,
+ ///The total number of completion options available. This can exceed the number of values actually sent in the response.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub total: ::std::option::Option,
+ ///An array of completion values. Must not exceed 100 items.
+ pub values: ::std::vec::Vec<::std::string::String>,
+}
+///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.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "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": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "sampling/createMessage"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "maxTokens",
+/// "messages"
+/// ],
+/// "properties": {
+/// "includeContext": {
+/// "description": "A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.",
+/// "type": "string",
+/// "enum": [
+/// "allServers",
+/// "none",
+/// "thisServer"
+/// ]
+/// },
+/// "maxTokens": {
+/// "description": "The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.",
+/// "type": "integer"
+/// },
+/// "messages": {
+/// "type": "array",
+/// "items": {
+/// "$ref": "#/definitions/SamplingMessage"
+/// }
+/// },
+/// "metadata": {
+/// "description": "Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.",
+/// "type": "object",
+/// "additionalProperties": true
+/// },
+/// "modelPreferences": {
+/// "description": "The server's preferences for which model to select. The client MAY ignore these preferences.",
+/// "$ref": "#/definitions/ModelPreferences"
+/// },
+/// "stopSequences": {
+/// "type": "array",
+/// "items": {
+/// "type": "string"
+/// }
+/// },
+/// "systemPrompt": {
+/// "description": "An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.",
+/// "type": "string"
+/// },
+/// "temperature": {
+/// "type": "number"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CreateMessageRequest {
+ method: ::std::string::String,
+ pub params: CreateMessageRequestParams,
+}
+impl CreateMessageRequest {
+ pub fn new(params: CreateMessageRequestParams) -> Self {
+ Self {
+ method: "sampling/createMessage".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "sampling/createMessage".to_string()
+ }
+}
+///CreateMessageRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "maxTokens",
+/// "messages"
+/// ],
+/// "properties": {
+/// "includeContext": {
+/// "description": "A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.",
+/// "type": "string",
+/// "enum": [
+/// "allServers",
+/// "none",
+/// "thisServer"
+/// ]
+/// },
+/// "maxTokens": {
+/// "description": "The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.",
+/// "type": "integer"
+/// },
+/// "messages": {
+/// "type": "array",
+/// "items": {
+/// "$ref": "#/definitions/SamplingMessage"
+/// }
+/// },
+/// "metadata": {
+/// "description": "Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.",
+/// "type": "object",
+/// "additionalProperties": true
+/// },
+/// "modelPreferences": {
+/// "description": "The server's preferences for which model to select. The client MAY ignore these preferences.",
+/// "$ref": "#/definitions/ModelPreferences"
+/// },
+/// "stopSequences": {
+/// "type": "array",
+/// "items": {
+/// "type": "string"
+/// }
+/// },
+/// "systemPrompt": {
+/// "description": "An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.",
+/// "type": "string"
+/// },
+/// "temperature": {
+/// "type": "number"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CreateMessageRequestParams {
+ ///A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
+ #[serde(rename = "includeContext", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub include_context: ::std::option::Option,
+ ///The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.
+ #[serde(rename = "maxTokens")]
+ pub max_tokens: i64,
+ pub messages: ::std::vec::Vec,
+ ///Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub metadata: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+ ///The server's preferences for which model to select. The client MAY ignore these preferences.
+ #[serde(
+ rename = "modelPreferences",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ pub model_preferences: ::std::option::Option,
+ #[serde(rename = "stopSequences", default, skip_serializing_if = "::std::vec::Vec::is_empty")]
+ pub stop_sequences: ::std::vec::Vec<::std::string::String>,
+ ///An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
+ #[serde(rename = "systemPrompt", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub system_prompt: ::std::option::Option<::std::string::String>,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub temperature: ::std::option::Option,
+}
+///A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.",
+/// "type": "string",
+/// "enum": [
+/// "allServers",
+/// "none",
+/// "thisServer"
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+pub enum CreateMessageRequestParamsIncludeContext {
+ #[serde(rename = "allServers")]
+ AllServers,
+ #[serde(rename = "none")]
+ None,
+ #[serde(rename = "thisServer")]
+ ThisServer,
+}
+impl ::std::fmt::Display for CreateMessageRequestParamsIncludeContext {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ match *self {
+ Self::AllServers => write!(f, "allServers"),
+ Self::None => write!(f, "none"),
+ Self::ThisServer => write!(f, "thisServer"),
+ }
+ }
+}
+///The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.",
+/// "type": "object",
+/// "required": [
+/// "content",
+/// "model",
+/// "role"
+/// ],
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "content": {
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/TextContent"
+/// },
+/// {
+/// "$ref": "#/definitions/ImageContent"
+/// },
+/// {
+/// "$ref": "#/definitions/AudioContent"
+/// }
+/// ]
+/// },
+/// "model": {
+/// "description": "The name of the model that generated the message.",
+/// "type": "string"
+/// },
+/// "role": {
+/// "$ref": "#/definitions/Role"
+/// },
+/// "stopReason": {
+/// "description": "The reason why sampling stopped, if known.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct CreateMessageResult {
+ pub content: CreateMessageResultContent,
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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.
+ pub model: ::std::string::String,
+ pub role: Role,
+ ///The reason why sampling stopped, if known.
+ #[serde(rename = "stopReason", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub stop_reason: ::std::option::Option<::std::string::String>,
+}
+///CreateMessageResultContent
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/TextContent"
+/// },
+/// {
+/// "$ref": "#/definitions/ImageContent"
+/// },
+/// {
+/// "$ref": "#/definitions/AudioContent"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum CreateMessageResultContent {
+ TextContent(TextContent),
+ ImageContent(ImageContent),
+ AudioContent(AudioContent),
+}
+impl ::std::convert::From for CreateMessageResultContent {
+ fn from(value: TextContent) -> Self {
+ Self::TextContent(value)
+ }
+}
+impl ::std::convert::From for CreateMessageResultContent {
+ fn from(value: ImageContent) -> Self {
+ Self::ImageContent(value)
+ }
+}
+impl ::std::convert::From for CreateMessageResultContent {
+ fn from(value: AudioContent) -> Self {
+ Self::AudioContent(value)
+ }
+}
+///An opaque token used to represent a cursor for pagination.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "An opaque token used to represent a cursor for pagination.",
+/// "type": "string"
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+#[serde(transparent)]
+pub struct Cursor(pub ::std::string::String);
+/**The contents of a resource, embedded into a prompt or tool call result.
+It is up to the client how best to render embedded resources for the benefit
+of the LLM and/or the user.*/
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The contents of a resource, embedded into a prompt or tool call result.\n\nIt is up to the client how best to render embedded resources for the benefit\nof the LLM and/or the user.",
+/// "type": "object",
+/// "required": [
+/// "resource",
+/// "type"
+/// ],
+/// "properties": {
+/// "annotations": {
+/// "description": "Optional annotations for the client.",
+/// "$ref": "#/definitions/Annotations"
+/// },
+/// "resource": {
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/TextResourceContents"
+/// },
+/// {
+/// "$ref": "#/definitions/BlobResourceContents"
+/// }
+/// ]
+/// },
+/// "type": {
+/// "type": "string",
+/// "const": "resource"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct EmbeddedResource {
+ ///Optional annotations for the client.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub annotations: ::std::option::Option,
+ pub resource: EmbeddedResourceResource,
+ #[serde(rename = "type")]
+ type_: ::std::string::String,
+}
+impl EmbeddedResource {
+ pub fn new(resource: EmbeddedResourceResource, annotations: ::std::option::Option) -> Self {
+ Self {
+ annotations,
+ resource,
+ type_: "resource".to_string(),
+ }
+ }
+ pub fn type_(&self) -> &::std::string::String {
+ &self.type_
+ }
+ pub fn type_name() -> ::std::string::String {
+ "resource".to_string()
+ }
+}
+///EmbeddedResourceResource
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/TextResourceContents"
+/// },
+/// {
+/// "$ref": "#/definitions/BlobResourceContents"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum EmbeddedResourceResource {
+ TextResourceContents(TextResourceContents),
+ BlobResourceContents(BlobResourceContents),
+}
+impl ::std::convert::From for EmbeddedResourceResource {
+ fn from(value: TextResourceContents) -> Self {
+ Self::TextResourceContents(value)
+ }
+}
+impl ::std::convert::From for EmbeddedResourceResource {
+ fn from(value: BlobResourceContents) -> Self {
+ Self::BlobResourceContents(value)
+ }
+}
+///EmptyResult
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "$ref": "#/definitions/Result"
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(transparent)]
+pub struct EmptyResult(pub Result);
+///Used by the client to get a prompt provided by the server.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Used by the client to get a prompt provided by the server.",
+/// "type": "object",
+/// "required": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "prompts/get"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "name"
+/// ],
+/// "properties": {
+/// "arguments": {
+/// "description": "Arguments to use for templating the prompt.",
+/// "type": "object",
+/// "additionalProperties": {
+/// "type": "string"
+/// }
+/// },
+/// "name": {
+/// "description": "The name of the prompt or prompt template.",
+/// "type": "string"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct GetPromptRequest {
+ method: ::std::string::String,
+ pub params: GetPromptRequestParams,
+}
+impl GetPromptRequest {
+ pub fn new(params: GetPromptRequestParams) -> Self {
+ Self {
+ method: "prompts/get".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "prompts/get".to_string()
+ }
+}
+///GetPromptRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "name"
+/// ],
+/// "properties": {
+/// "arguments": {
+/// "description": "Arguments to use for templating the prompt.",
+/// "type": "object",
+/// "additionalProperties": {
+/// "type": "string"
+/// }
+/// },
+/// "name": {
+/// "description": "The name of the prompt or prompt template.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct GetPromptRequestParams {
+ ///Arguments to use for templating the prompt.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub arguments: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
+ ///The name of the prompt or prompt template.
+ pub name: ::std::string::String,
+}
+///The server's response to a prompts/get request from the client.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The server's response to a prompts/get request from the client.",
+/// "type": "object",
+/// "required": [
+/// "messages"
+/// ],
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "description": {
+/// "description": "An optional description for the prompt.",
+/// "type": "string"
+/// },
+/// "messages": {
+/// "type": "array",
+/// "items": {
+/// "$ref": "#/definitions/PromptMessage"
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct GetPromptResult {
+ ///An optional description for the prompt.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub description: ::std::option::Option<::std::string::String>,
+ pub messages: ::std::vec::Vec,
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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 image provided to or from an LLM.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "An image provided to or from an LLM.",
+/// "type": "object",
+/// "required": [
+/// "data",
+/// "mimeType",
+/// "type"
+/// ],
+/// "properties": {
+/// "annotations": {
+/// "description": "Optional annotations for the client.",
+/// "$ref": "#/definitions/Annotations"
+/// },
+/// "data": {
+/// "description": "The base64-encoded image data.",
+/// "type": "string",
+/// "format": "byte"
+/// },
+/// "mimeType": {
+/// "description": "The MIME type of the image. Different providers may support different image types.",
+/// "type": "string"
+/// },
+/// "type": {
+/// "type": "string",
+/// "const": "image"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ImageContent {
+ ///Optional annotations for the client.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub annotations: ::std::option::Option,
+ ///The base64-encoded image data.
+ pub data: ::std::string::String,
+ ///The MIME type of the image. Different providers may support different image types.
+ #[serde(rename = "mimeType")]
+ pub mime_type: ::std::string::String,
+ #[serde(rename = "type")]
+ type_: ::std::string::String,
+}
+impl ImageContent {
+ pub fn new(
+ data: ::std::string::String,
+ mime_type: ::std::string::String,
+ annotations: ::std::option::Option,
+ ) -> Self {
+ Self {
+ annotations,
+ data,
+ mime_type,
+ type_: "image".to_string(),
+ }
+ }
+ pub fn type_(&self) -> &::std::string::String {
+ &self.type_
+ }
+ pub fn type_name() -> ::std::string::String {
+ "image".to_string()
+ }
+}
+///Describes the name and version of an MCP implementation.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Describes the name and version of an MCP implementation.",
+/// "type": "object",
+/// "required": [
+/// "name",
+/// "version"
+/// ],
+/// "properties": {
+/// "name": {
+/// "type": "string"
+/// },
+/// "version": {
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct Implementation {
+ pub name: ::std::string::String,
+ pub version: ::std::string::String,
+}
+///This request is sent from the client to the server when it first connects, asking it to begin initialization.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "This request is sent from the client to the server when it first connects, asking it to begin initialization.",
+/// "type": "object",
+/// "required": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "initialize"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "capabilities",
+/// "clientInfo",
+/// "protocolVersion"
+/// ],
+/// "properties": {
+/// "capabilities": {
+/// "$ref": "#/definitions/ClientCapabilities"
+/// },
+/// "clientInfo": {
+/// "$ref": "#/definitions/Implementation"
+/// },
+/// "protocolVersion": {
+/// "description": "The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.",
+/// "type": "string"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct InitializeRequest {
+ method: ::std::string::String,
+ pub params: InitializeRequestParams,
+}
+impl InitializeRequest {
+ pub fn new(params: InitializeRequestParams) -> Self {
+ Self {
+ method: "initialize".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "initialize".to_string()
+ }
+}
+///InitializeRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "capabilities",
+/// "clientInfo",
+/// "protocolVersion"
+/// ],
+/// "properties": {
+/// "capabilities": {
+/// "$ref": "#/definitions/ClientCapabilities"
+/// },
+/// "clientInfo": {
+/// "$ref": "#/definitions/Implementation"
+/// },
+/// "protocolVersion": {
+/// "description": "The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct InitializeRequestParams {
+ pub capabilities: ClientCapabilities,
+ #[serde(rename = "clientInfo")]
+ pub client_info: Implementation,
+ ///The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
+ #[serde(rename = "protocolVersion")]
+ pub protocol_version: ::std::string::String,
+}
+///After receiving an initialize request from the client, the server sends this response.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "After receiving an initialize request from the client, the server sends this response.",
+/// "type": "object",
+/// "required": [
+/// "capabilities",
+/// "protocolVersion",
+/// "serverInfo"
+/// ],
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "capabilities": {
+/// "$ref": "#/definitions/ServerCapabilities"
+/// },
+/// "instructions": {
+/// "description": "Instructions describing how to use the server and its features.\n\nThis 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.",
+/// "type": "string"
+/// },
+/// "protocolVersion": {
+/// "description": "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.",
+/// "type": "string"
+/// },
+/// "serverInfo": {
+/// "$ref": "#/definitions/Implementation"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct InitializeResult {
+ pub capabilities: ServerCapabilities,
+ /**Instructions describing how to use the server and its features.
+ 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>,
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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.
+ #[serde(rename = "protocolVersion")]
+ pub protocol_version: ::std::string::String,
+ #[serde(rename = "serverInfo")]
+ pub server_info: Implementation,
+}
+///This notification is sent from the client to the server after initialization has finished.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "This notification is sent from the client to the server after initialization has finished.",
+/// "type": "object",
+/// "required": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "notifications/initialized"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct InitializedNotification {
+ method: ::std::string::String,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub params: ::std::option::Option,
+}
+impl InitializedNotification {
+ pub fn new(params: ::std::option::Option) -> Self {
+ Self {
+ method: "notifications/initialized".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "notifications/initialized".to_string()
+ }
+}
+///InitializedNotificationParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct InitializedNotificationParams {
+ ///This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.
+ #[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")]
+ pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+}
+///A JSON-RPC batch request, as described in
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A JSON-RPC batch request, as described in ",
+/// "type": "array",
+/// "items": {
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/JSONRPCRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/JSONRPCNotification"
+/// }
+/// ]
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(transparent)]
+pub struct JsonrpcBatchRequest(pub ::std::vec::Vec);
+///JsonrpcBatchRequestItem
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/JSONRPCRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/JSONRPCNotification"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum JsonrpcBatchRequestItem {
+ Request(JsonrpcRequest),
+ Notification(JsonrpcNotification),
+}
+impl ::std::convert::From for JsonrpcBatchRequestItem {
+ fn from(value: JsonrpcRequest) -> Self {
+ Self::Request(value)
+ }
+}
+impl ::std::convert::From for JsonrpcBatchRequestItem {
+ fn from(value: JsonrpcNotification) -> Self {
+ Self::Notification(value)
+ }
+}
+///A JSON-RPC batch response, as described in
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A JSON-RPC batch response, as described in ",
+/// "type": "array",
+/// "items": {
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/JSONRPCResponse"
+/// },
+/// {
+/// "$ref": "#/definitions/JSONRPCError"
+/// }
+/// ]
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(transparent)]
+pub struct JsonrpcBatchResponse(pub ::std::vec::Vec);
+///JsonrpcBatchResponseItem
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/JSONRPCResponse"
+/// },
+/// {
+/// "$ref": "#/definitions/JSONRPCError"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum JsonrpcBatchResponseItem {
+ Response(JsonrpcResponse),
+ Error(JsonrpcError),
+}
+impl ::std::convert::From for JsonrpcBatchResponseItem {
+ fn from(value: JsonrpcResponse) -> Self {
+ Self::Response(value)
+ }
+}
+impl ::std::convert::From for JsonrpcBatchResponseItem {
+ fn from(value: JsonrpcError) -> Self {
+ Self::Error(value)
+ }
+}
+///A response to a request that indicates an error occurred.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A response to a request that indicates an error occurred.",
+/// "type": "object",
+/// "required": [
+/// "error",
+/// "id",
+/// "jsonrpc"
+/// ],
+/// "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"
+/// }
+/// }
+/// },
+/// "id": {
+/// "$ref": "#/definitions/RequestId"
+/// },
+/// "jsonrpc": {
+/// "type": "string",
+/// "const": "2.0"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct JsonrpcError {
+ pub error: RpcError,
+ pub id: RequestId,
+ jsonrpc: ::std::string::String,
+}
+impl JsonrpcError {
+ pub fn new(error: RpcError, id: RequestId) -> Self {
+ Self {
+ error,
+ id,
+ jsonrpc: JSONRPC_VERSION.to_string(),
+ }
+ }
+ pub fn jsonrpc(&self) -> &::std::string::String {
+ &self.jsonrpc
+ }
+}
+///Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.",
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/JSONRPCRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/JSONRPCNotification"
+/// },
+/// {
+/// "$ref": "#/definitions/JSONRPCBatchRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/JSONRPCResponse"
+/// },
+/// {
+/// "$ref": "#/definitions/JSONRPCError"
+/// },
+/// {
+/// "$ref": "#/definitions/JSONRPCBatchResponse"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum JsonrpcMessage {
+ Request(JsonrpcRequest),
+ Notification(JsonrpcNotification),
+ BatchRequest(JsonrpcBatchRequest),
+ Response(JsonrpcResponse),
+ Error(JsonrpcError),
+ BatchResponse(JsonrpcBatchResponse),
+}
+impl ::std::convert::From for JsonrpcMessage {
+ fn from(value: JsonrpcRequest) -> Self {
+ Self::Request(value)
+ }
+}
+impl ::std::convert::From for JsonrpcMessage {
+ fn from(value: JsonrpcNotification) -> Self {
+ Self::Notification(value)
+ }
+}
+impl ::std::convert::From for JsonrpcMessage {
+ fn from(value: JsonrpcBatchRequest) -> Self {
+ Self::BatchRequest(value)
+ }
+}
+impl ::std::convert::From for JsonrpcMessage {
+ fn from(value: JsonrpcResponse) -> Self {
+ Self::Response(value)
+ }
+}
+impl ::std::convert::From for JsonrpcMessage {
+ fn from(value: JsonrpcError) -> Self {
+ Self::Error(value)
+ }
+}
+impl ::std::convert::From for JsonrpcMessage {
+ fn from(value: JsonrpcBatchResponse) -> Self {
+ Self::BatchResponse(value)
+ }
+}
+///A notification which does not expect a response.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A notification which does not expect a response.",
+/// "type": "object",
+/// "required": [
+/// "jsonrpc",
+/// "method"
+/// ],
+/// "properties": {
+/// "jsonrpc": {
+/// "type": "string",
+/// "const": "2.0"
+/// },
+/// "method": {
+/// "type": "string"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct JsonrpcNotification {
+ 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 JsonrpcNotification {
+ pub fn new(method: ::std::string::String, params: ::std::option::Option) -> Self {
+ Self {
+ jsonrpc: JSONRPC_VERSION.to_string(),
+ method,
+ params,
+ }
+ }
+ pub fn jsonrpc(&self) -> &::std::string::String {
+ &self.jsonrpc
+ }
+}
+///JsonrpcNotificationParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct JsonrpcNotificationParams {
+ ///This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.
+ #[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")]
+ pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+}
+///A request that expects a response.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A request that expects a response.",
+/// "type": "object",
+/// "required": [
+/// "id",
+/// "jsonrpc",
+/// "method"
+/// ],
+/// "properties": {
+/// "id": {
+/// "$ref": "#/definitions/RequestId"
+/// },
+/// "jsonrpc": {
+/// "type": "string",
+/// "const": "2.0"
+/// },
+/// "method": {
+/// "type": "string"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "type": "object",
+/// "properties": {
+/// "progressToken": {
+/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
+/// "$ref": "#/definitions/ProgressToken"
+/// }
+/// }
+/// }
+/// },
+/// "additionalProperties": {}
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct JsonrpcRequest {
+ 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 JsonrpcRequest {
+ 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
+ }
+}
+///JsonrpcRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "type": "object",
+/// "properties": {
+/// "progressToken": {
+/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
+/// "$ref": "#/definitions/ProgressToken"
+/// }
+/// }
+/// }
+/// },
+/// "additionalProperties": {}
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct JsonrpcRequestParams {
+ #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub meta: ::std::option::Option,
+ #[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>>,
+}
+///JsonrpcRequestParamsMeta
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "progressToken": {
+/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
+/// "$ref": "#/definitions/ProgressToken"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct JsonrpcRequestParamsMeta {
+ ///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
+ #[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub progress_token: ::std::option::Option,
+}
+///A successful (non-error) response to a request.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A successful (non-error) response to a request.",
+/// "type": "object",
+/// "required": [
+/// "id",
+/// "jsonrpc",
+/// "result"
+/// ],
+/// "properties": {
+/// "id": {
+/// "$ref": "#/definitions/RequestId"
+/// },
+/// "jsonrpc": {
+/// "type": "string",
+/// "const": "2.0"
+/// },
+/// "result": {
+/// "$ref": "#/definitions/Result"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct JsonrpcResponse {
+ pub id: RequestId,
+ jsonrpc: ::std::string::String,
+ pub result: Result,
+}
+impl JsonrpcResponse {
+ pub fn new(id: RequestId, result: Result) -> Self {
+ Self {
+ id,
+ jsonrpc: JSONRPC_VERSION.to_string(),
+ result,
+ }
+ }
+ pub fn jsonrpc(&self) -> &::std::string::String {
+ &self.jsonrpc
+ }
+}
+///Sent from the client to request a list of prompts and prompt templates the server has.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Sent from the client to request a list of prompts and prompt templates the server has.",
+/// "type": "object",
+/// "required": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "prompts/list"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "cursor": {
+/// "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
+/// "type": "string"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ListPromptsRequest {
+ 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 {
+ Self {
+ method: "prompts/list".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "prompts/list".to_string()
+ }
+}
+///ListPromptsRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "cursor": {
+/// "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ListPromptsRequestParams {
+ /**An opaque token representing the current pagination position.
+ If provided, the server should return results starting after this cursor.*/
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub cursor: ::std::option::Option<::std::string::String>,
+}
+///The server's response to a prompts/list request from the client.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The server's response to a prompts/list request from the client.",
+/// "type": "object",
+/// "required": [
+/// "prompts"
+/// ],
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "nextCursor": {
+/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
+/// "type": "string"
+/// },
+/// "prompts": {
+/// "type": "array",
+/// "items": {
+/// "$ref": "#/definitions/Prompt"
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ListPromptsResult {
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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.
+ If present, there may be more results available.*/
+ #[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub next_cursor: ::std::option::Option<::std::string::String>,
+ pub prompts: ::std::vec::Vec,
+}
+///Sent from the client to request a list of resource templates the server has.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Sent from the client to request a list of resource templates the server has.",
+/// "type": "object",
+/// "required": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "resources/templates/list"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "cursor": {
+/// "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
+/// "type": "string"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ListResourceTemplatesRequest {
+ 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 {
+ Self {
+ method: "resources/templates/list".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "resources/templates/list".to_string()
+ }
+}
+///ListResourceTemplatesRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "cursor": {
+/// "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ListResourceTemplatesRequestParams {
+ /**An opaque token representing the current pagination position.
+ If provided, the server should return results starting after this cursor.*/
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub cursor: ::std::option::Option<::std::string::String>,
+}
+///The server's response to a resources/templates/list request from the client.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The server's response to a resources/templates/list request from the client.",
+/// "type": "object",
+/// "required": [
+/// "resourceTemplates"
+/// ],
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "nextCursor": {
+/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
+/// "type": "string"
+/// },
+/// "resourceTemplates": {
+/// "type": "array",
+/// "items": {
+/// "$ref": "#/definitions/ResourceTemplate"
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ListResourceTemplatesResult {
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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.
+ If present, there may be more results available.*/
+ #[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub next_cursor: ::std::option::Option<::std::string::String>,
+ #[serde(rename = "resourceTemplates")]
+ pub resource_templates: ::std::vec::Vec,
+}
+///Sent from the client to request a list of resources the server has.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Sent from the client to request a list of resources the server has.",
+/// "type": "object",
+/// "required": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "resources/list"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "cursor": {
+/// "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
+/// "type": "string"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ListResourcesRequest {
+ 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 {
+ Self {
+ method: "resources/list".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "resources/list".to_string()
+ }
+}
+///ListResourcesRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "cursor": {
+/// "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ListResourcesRequestParams {
+ /**An opaque token representing the current pagination position.
+ If provided, the server should return results starting after this cursor.*/
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub cursor: ::std::option::Option<::std::string::String>,
+}
+///The server's response to a resources/list request from the client.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The server's response to a resources/list request from the client.",
+/// "type": "object",
+/// "required": [
+/// "resources"
+/// ],
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "nextCursor": {
+/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
+/// "type": "string"
+/// },
+/// "resources": {
+/// "type": "array",
+/// "items": {
+/// "$ref": "#/definitions/Resource"
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ListResourcesResult {
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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.
+ If present, there may be more results available.*/
+ #[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub next_cursor: ::std::option::Option<::std::string::String>,
+ pub resources: ::std::vec::Vec,
+}
+/**Sent from the server to request a list of root URIs from the client. Roots allow
+servers to ask for specific directories or files to operate on. A common example
+for roots is providing a set of repositories or directories a server should operate
+on.
+This request is typically used when the server needs to understand the file system
+structure or access specific locations that the client has permission to read from.*/
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "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": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "roots/list"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "type": "object",
+/// "properties": {
+/// "progressToken": {
+/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
+/// "$ref": "#/definitions/ProgressToken"
+/// }
+/// }
+/// }
+/// },
+/// "additionalProperties": {}
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ListRootsRequest {
+ 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 {
+ Self {
+ method: "roots/list".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "roots/list".to_string()
+ }
+}
+///ListRootsRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "type": "object",
+/// "properties": {
+/// "progressToken": {
+/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
+/// "$ref": "#/definitions/ProgressToken"
+/// }
+/// }
+/// }
+/// },
+/// "additionalProperties": {}
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ListRootsRequestParams {
+ #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub meta: ::std::option::Option,
+ #[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>>,
+}
+///ListRootsRequestParamsMeta
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "progressToken": {
+/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
+/// "$ref": "#/definitions/ProgressToken"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ListRootsRequestParamsMeta {
+ ///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
+ #[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub progress_token: ::std::option::Option,
+}
+/**The client's response to a roots/list request from the server.
+This result contains an array of Root objects, each representing a root directory
+or file that the server can operate on.*/
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The client's response to a roots/list request from the server.\nThis result contains an array of Root objects, each representing a root directory\nor file that the server can operate on.",
+/// "type": "object",
+/// "required": [
+/// "roots"
+/// ],
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "roots": {
+/// "type": "array",
+/// "items": {
+/// "$ref": "#/definitions/Root"
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ListRootsResult {
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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,
+}
+///Sent from the client to request a list of tools the server has.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Sent from the client to request a list of tools the server has.",
+/// "type": "object",
+/// "required": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "tools/list"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "cursor": {
+/// "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
+/// "type": "string"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ListToolsRequest {
+ 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 {
+ Self {
+ method: "tools/list".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "tools/list".to_string()
+ }
+}
+///ListToolsRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "cursor": {
+/// "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ListToolsRequestParams {
+ /**An opaque token representing the current pagination position.
+ If provided, the server should return results starting after this cursor.*/
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub cursor: ::std::option::Option<::std::string::String>,
+}
+///The server's response to a tools/list request from the client.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The server's response to a tools/list request from the client.",
+/// "type": "object",
+/// "required": [
+/// "tools"
+/// ],
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "nextCursor": {
+/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
+/// "type": "string"
+/// },
+/// "tools": {
+/// "type": "array",
+/// "items": {
+/// "$ref": "#/definitions/Tool"
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ListToolsResult {
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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.
+ If present, there may be more results available.*/
+ #[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub next_cursor: ::std::option::Option<::std::string::String>,
+ pub tools: ::std::vec::Vec,
+}
+/**The severity of a log message.
+These map to syslog message severities, as specified in RFC-5424:
+*/
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The severity of a log message.\n\nThese map to syslog message severities, as specified in RFC-5424:\n",
+/// "type": "string",
+/// "enum": [
+/// "alert",
+/// "critical",
+/// "debug",
+/// "emergency",
+/// "error",
+/// "info",
+/// "notice",
+/// "warning"
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+pub enum LoggingLevel {
+ #[serde(rename = "alert")]
+ Alert,
+ #[serde(rename = "critical")]
+ Critical,
+ #[serde(rename = "debug")]
+ Debug,
+ #[serde(rename = "emergency")]
+ Emergency,
+ #[serde(rename = "error")]
+ Error,
+ #[serde(rename = "info")]
+ Info,
+ #[serde(rename = "notice")]
+ Notice,
+ #[serde(rename = "warning")]
+ Warning,
+}
+impl ::std::fmt::Display for LoggingLevel {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ match *self {
+ Self::Alert => write!(f, "alert"),
+ Self::Critical => write!(f, "critical"),
+ Self::Debug => write!(f, "debug"),
+ Self::Emergency => write!(f, "emergency"),
+ Self::Error => write!(f, "error"),
+ Self::Info => write!(f, "info"),
+ Self::Notice => write!(f, "notice"),
+ Self::Warning => write!(f, "warning"),
+ }
+ }
+}
+///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.
+///
+/// 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.",
+/// "type": "object",
+/// "required": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "notifications/message"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "data",
+/// "level"
+/// ],
+/// "properties": {
+/// "data": {
+/// "description": "The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here."
+/// },
+/// "level": {
+/// "description": "The severity of this log message.",
+/// "$ref": "#/definitions/LoggingLevel"
+/// },
+/// "logger": {
+/// "description": "An optional name of the logger issuing this message.",
+/// "type": "string"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct LoggingMessageNotification {
+ method: ::std::string::String,
+ pub params: LoggingMessageNotificationParams,
+}
+impl LoggingMessageNotification {
+ pub fn new(params: LoggingMessageNotificationParams) -> Self {
+ Self {
+ method: "notifications/message".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "notifications/message".to_string()
+ }
+}
+///LoggingMessageNotificationParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "data",
+/// "level"
+/// ],
+/// "properties": {
+/// "data": {
+/// "description": "The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here."
+/// },
+/// "level": {
+/// "description": "The severity of this log message.",
+/// "$ref": "#/definitions/LoggingLevel"
+/// },
+/// "logger": {
+/// "description": "An optional name of the logger issuing this message.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct LoggingMessageNotificationParams {
+ ///The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
+ pub data: ::serde_json::Value,
+ ///The severity of this log message.
+ pub level: LoggingLevel,
+ ///An optional name of the logger issuing this message.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub logger: ::std::option::Option<::std::string::String>,
+}
+/**Hints to use for model selection.
+Keys not declared here are currently left unspecified by the spec and are up
+to the client to interpret.*/
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Hints to use for model selection.\n\nKeys not declared here are currently left unspecified by the spec and are up\nto the client to interpret.",
+/// "type": "object",
+/// "properties": {
+/// "name": {
+/// "description": "A hint for a model name.\n\nThe client SHOULD treat this as a substring of a model name; for example:\n - claude-3-5-sonnet should match claude-3-5-sonnet-20241022\n - sonnet should match claude-3-5-sonnet-20241022, claude-3-sonnet-20240229, etc.\n - claude should match any Claude model\n\nThe client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:\n - gemini-1.5-flash could match claude-3-haiku-20240307",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ModelHint {
+ /**A hint for a model name.
+ The client SHOULD treat this as a substring of a model name; for example:
+ - claude-3-5-sonnet should match claude-3-5-sonnet-20241022
+ - sonnet should match claude-3-5-sonnet-20241022, claude-3-sonnet-20240229, etc.
+ - claude should match any Claude model
+ The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:
+ - gemini-1.5-flash could match claude-3-haiku-20240307*/
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub name: ::std::option::Option<::std::string::String>,
+}
+/**The server's preferences for model selection, requested of the client during sampling.
+Because LLMs can vary along multiple dimensions, choosing the "best" model is
+rarely straightforward. Different models excel in different areas—some are
+faster but less capable, others are more capable but more expensive, and so
+on. This interface allows servers to express their priorities across multiple
+dimensions to help clients make an appropriate selection for their use case.
+These preferences are always advisory. The client MAY ignore them. It is also
+up to the client to decide how to interpret these preferences and how to
+balance them against other considerations.*/
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The server's preferences for model selection, requested of the client during sampling.\n\nBecause LLMs can vary along multiple dimensions, choosing the \"best\" model is\nrarely straightforward. Different models excel in different areas—some are\nfaster but less capable, others are more capable but more expensive, and so\non. This interface allows servers to express their priorities across multiple\ndimensions to help clients make an appropriate selection for their use case.\n\nThese preferences are always advisory. The client MAY ignore them. It is also\nup to the client to decide how to interpret these preferences and how to\nbalance them against other considerations.",
+/// "type": "object",
+/// "properties": {
+/// "costPriority": {
+/// "description": "How much to prioritize cost when selecting a model. A value of 0 means cost\nis not important, while a value of 1 means cost is the most important\nfactor.",
+/// "type": "number",
+/// "maximum": 1.0,
+/// "minimum": 0.0
+/// },
+/// "hints": {
+/// "description": "Optional hints to use for model selection.\n\nIf multiple hints are specified, the client MUST evaluate them in order\n(such that the first match is taken).\n\nThe client SHOULD prioritize these hints over the numeric priorities, but\nMAY still use the priorities to select from ambiguous matches.",
+/// "type": "array",
+/// "items": {
+/// "$ref": "#/definitions/ModelHint"
+/// }
+/// },
+/// "intelligencePriority": {
+/// "description": "How much to prioritize intelligence and capabilities when selecting a\nmodel. A value of 0 means intelligence is not important, while a value of 1\nmeans intelligence is the most important factor.",
+/// "type": "number",
+/// "maximum": 1.0,
+/// "minimum": 0.0
+/// },
+/// "speedPriority": {
+/// "description": "How much to prioritize sampling speed (latency) when selecting a model. A\nvalue of 0 means speed is not important, while a value of 1 means speed is\nthe most important factor.",
+/// "type": "number",
+/// "maximum": 1.0,
+/// "minimum": 0.0
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ModelPreferences {
+ #[serde(rename = "costPriority", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub cost_priority: ::std::option::Option,
+ /**Optional hints to use for model selection.
+ If multiple hints are specified, the client MUST evaluate them in order
+ (such that the first match is taken).
+ The client SHOULD prioritize these hints over the numeric priorities, but
+ MAY still use the priorities to select from ambiguous matches.*/
+ #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
+ pub hints: ::std::vec::Vec,
+ #[serde(
+ rename = "intelligencePriority",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ pub intelligence_priority: ::std::option::Option,
+ #[serde(rename = "speedPriority", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub speed_priority: ::std::option::Option,
+}
+///Notification
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct Notification {
+ pub method: ::std::string::String,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub params: ::std::option::Option,
+}
+///NotificationParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct NotificationParams {
+ ///This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.
+ #[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")]
+ pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+}
+///PaginatedRequest
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "cursor": {
+/// "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
+/// "type": "string"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct PaginatedRequest {
+ pub method: ::std::string::String,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub params: ::std::option::Option,
+}
+///PaginatedRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "cursor": {
+/// "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct PaginatedRequestParams {
+ /**An opaque token representing the current pagination position.
+ If provided, the server should return results starting after this cursor.*/
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub cursor: ::std::option::Option<::std::string::String>,
+}
+///PaginatedResult
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "nextCursor": {
+/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct PaginatedResult {
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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.
+ If present, there may be more results available.*/
+ #[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub next_cursor: ::std::option::Option<::std::string::String>,
+}
+///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.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "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": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "ping"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "type": "object",
+/// "properties": {
+/// "progressToken": {
+/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
+/// "$ref": "#/definitions/ProgressToken"
+/// }
+/// }
+/// }
+/// },
+/// "additionalProperties": {}
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct PingRequest {
+ 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 {
+ Self {
+ method: "ping".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "ping".to_string()
+ }
+}
+///PingRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "type": "object",
+/// "properties": {
+/// "progressToken": {
+/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
+/// "$ref": "#/definitions/ProgressToken"
+/// }
+/// }
+/// }
+/// },
+/// "additionalProperties": {}
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct PingRequestParams {
+ #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub meta: ::std::option::Option,
+ #[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>>,
+}
+///PingRequestParamsMeta
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "progressToken": {
+/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
+/// "$ref": "#/definitions/ProgressToken"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct PingRequestParamsMeta {
+ ///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
+ #[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub progress_token: ::std::option::Option,
+}
+///An out-of-band notification used to inform the receiver of a progress update for a long-running request.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "An out-of-band notification used to inform the receiver of a progress update for a long-running request.",
+/// "type": "object",
+/// "required": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "notifications/progress"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "progress",
+/// "progressToken"
+/// ],
+/// "properties": {
+/// "message": {
+/// "description": "An optional message describing the current progress.",
+/// "type": "string"
+/// },
+/// "progress": {
+/// "description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
+/// "type": "number"
+/// },
+/// "progressToken": {
+/// "description": "The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.",
+/// "$ref": "#/definitions/ProgressToken"
+/// },
+/// "total": {
+/// "description": "Total number of items to process (or total progress required), if known.",
+/// "type": "number"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ProgressNotification {
+ method: ::std::string::String,
+ pub params: ProgressNotificationParams,
+}
+impl ProgressNotification {
+ pub fn new(params: ProgressNotificationParams) -> Self {
+ Self {
+ method: "notifications/progress".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "notifications/progress".to_string()
+ }
+}
+///ProgressNotificationParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "progress",
+/// "progressToken"
+/// ],
+/// "properties": {
+/// "message": {
+/// "description": "An optional message describing the current progress.",
+/// "type": "string"
+/// },
+/// "progress": {
+/// "description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
+/// "type": "number"
+/// },
+/// "progressToken": {
+/// "description": "The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.",
+/// "$ref": "#/definitions/ProgressToken"
+/// },
+/// "total": {
+/// "description": "Total number of items to process (or total progress required), if known.",
+/// "type": "number"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ProgressNotificationParams {
+ ///An optional message describing the current progress.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub message: ::std::option::Option<::std::string::String>,
+ pub progress: f64,
+ ///The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
+ #[serde(rename = "progressToken")]
+ pub progress_token: ProgressToken,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub total: ::std::option::Option,
+}
+///A progress token, used to associate progress notifications with the original request.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A progress token, used to associate progress notifications with the original request.",
+/// "type": [
+/// "string",
+/// "integer"
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum ProgressToken {
+ String(::std::string::String),
+ Integer(i64),
+}
+impl ::std::convert::From for ProgressToken {
+ fn from(value: i64) -> Self {
+ Self::Integer(value)
+ }
+}
+///A prompt or prompt template that the server offers.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A prompt or prompt template that the server offers.",
+/// "type": "object",
+/// "required": [
+/// "name"
+/// ],
+/// "properties": {
+/// "arguments": {
+/// "description": "A list of arguments to use for templating the prompt.",
+/// "type": "array",
+/// "items": {
+/// "$ref": "#/definitions/PromptArgument"
+/// }
+/// },
+/// "description": {
+/// "description": "An optional description of what this prompt provides",
+/// "type": "string"
+/// },
+/// "name": {
+/// "description": "The name of the prompt or prompt template.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct Prompt {
+ ///A list of arguments to use for templating the prompt.
+ #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
+ pub arguments: ::std::vec::Vec,
+ ///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>,
+ ///The name of the prompt or prompt template.
+ pub name: ::std::string::String,
+}
+///Describes an argument that a prompt can accept.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Describes an argument that a prompt can accept.",
+/// "type": "object",
+/// "required": [
+/// "name"
+/// ],
+/// "properties": {
+/// "description": {
+/// "description": "A human-readable description of the argument.",
+/// "type": "string"
+/// },
+/// "name": {
+/// "description": "The name of the argument.",
+/// "type": "string"
+/// },
+/// "required": {
+/// "description": "Whether this argument must be provided.",
+/// "type": "boolean"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct PromptArgument {
+ ///A human-readable description of the argument.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub description: ::std::option::Option<::std::string::String>,
+ ///The name of the argument.
+ pub name: ::std::string::String,
+ ///Whether this argument must be provided.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub required: ::std::option::Option,
+}
+///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.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "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": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "notifications/prompts/list_changed"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct PromptListChangedNotification {
+ method: ::std::string::String,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub params: ::std::option::Option,
+}
+impl PromptListChangedNotification {
+ pub fn new(params: ::std::option::Option) -> Self {
+ Self {
+ method: "notifications/prompts/list_changed".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "notifications/prompts/list_changed".to_string()
+ }
+}
+///PromptListChangedNotificationParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct PromptListChangedNotificationParams {
+ ///This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.
+ #[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")]
+ pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+}
+/**Describes a message returned as part of a prompt.
+This is similar to SamplingMessage, but also supports the embedding of
+resources from the MCP server.*/
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Describes a message returned as part of a prompt.\n\nThis is similar to SamplingMessage, but also supports the embedding of\nresources from the MCP server.",
+/// "type": "object",
+/// "required": [
+/// "content",
+/// "role"
+/// ],
+/// "properties": {
+/// "content": {
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/TextContent"
+/// },
+/// {
+/// "$ref": "#/definitions/ImageContent"
+/// },
+/// {
+/// "$ref": "#/definitions/AudioContent"
+/// },
+/// {
+/// "$ref": "#/definitions/EmbeddedResource"
+/// }
+/// ]
+/// },
+/// "role": {
+/// "$ref": "#/definitions/Role"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct PromptMessage {
+ pub content: PromptMessageContent,
+ pub role: Role,
+}
+///PromptMessageContent
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/TextContent"
+/// },
+/// {
+/// "$ref": "#/definitions/ImageContent"
+/// },
+/// {
+/// "$ref": "#/definitions/AudioContent"
+/// },
+/// {
+/// "$ref": "#/definitions/EmbeddedResource"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum PromptMessageContent {
+ TextContent(TextContent),
+ ImageContent(ImageContent),
+ AudioContent(AudioContent),
+ EmbeddedResource(EmbeddedResource),
+}
+impl ::std::convert::From for PromptMessageContent {
+ fn from(value: TextContent) -> Self {
+ Self::TextContent(value)
+ }
+}
+impl ::std::convert::From for PromptMessageContent {
+ fn from(value: ImageContent) -> Self {
+ Self::ImageContent(value)
+ }
+}
+impl ::std::convert::From for PromptMessageContent {
+ fn from(value: AudioContent) -> Self {
+ Self::AudioContent(value)
+ }
+}
+impl ::std::convert::From for PromptMessageContent {
+ fn from(value: EmbeddedResource) -> Self {
+ Self::EmbeddedResource(value)
+ }
+}
+///Identifies a prompt.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Identifies a prompt.",
+/// "type": "object",
+/// "required": [
+/// "name",
+/// "type"
+/// ],
+/// "properties": {
+/// "name": {
+/// "description": "The name of the prompt or prompt template",
+/// "type": "string"
+/// },
+/// "type": {
+/// "type": "string",
+/// "const": "ref/prompt"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct PromptReference {
+ ///The name of the prompt or prompt template
+ pub name: ::std::string::String,
+ #[serde(rename = "type")]
+ type_: ::std::string::String,
+}
+impl PromptReference {
+ pub fn new(name: ::std::string::String) -> Self {
+ Self {
+ name,
+ type_: "ref/prompt".to_string(),
+ }
+ }
+ pub fn type_(&self) -> &::std::string::String {
+ &self.type_
+ }
+ pub fn type_name() -> ::std::string::String {
+ "ref/prompt".to_string()
+ }
+}
+///Sent from the client to the server, to read a specific resource URI.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Sent from the client to the server, to read a specific resource URI.",
+/// "type": "object",
+/// "required": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "resources/read"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "uri"
+/// ],
+/// "properties": {
+/// "uri": {
+/// "description": "The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ReadResourceRequest {
+ method: ::std::string::String,
+ pub params: ReadResourceRequestParams,
+}
+impl ReadResourceRequest {
+ pub fn new(params: ReadResourceRequestParams) -> Self {
+ Self {
+ method: "resources/read".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "resources/read".to_string()
+ }
+}
+///ReadResourceRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "uri"
+/// ],
+/// "properties": {
+/// "uri": {
+/// "description": "The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ReadResourceRequestParams {
+ ///The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
+ pub uri: ::std::string::String,
+}
+///The server's response to a resources/read request from the client.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The server's response to a resources/read request from the client.",
+/// "type": "object",
+/// "required": [
+/// "contents"
+/// ],
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// },
+/// "contents": {
+/// "type": "array",
+/// "items": {
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/TextResourceContents"
+/// },
+/// {
+/// "$ref": "#/definitions/BlobResourceContents"
+/// }
+/// ]
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ReadResourceResult {
+ pub contents: ::std::vec::Vec,
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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>>,
+}
+///ReadResourceResultContentsItem
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/TextResourceContents"
+/// },
+/// {
+/// "$ref": "#/definitions/BlobResourceContents"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum ReadResourceResultContentsItem {
+ TextResourceContents(TextResourceContents),
+ BlobResourceContents(BlobResourceContents),
+}
+impl ::std::convert::From for ReadResourceResultContentsItem {
+ fn from(value: TextResourceContents) -> Self {
+ Self::TextResourceContents(value)
+ }
+}
+impl ::std::convert::From for ReadResourceResultContentsItem {
+ fn from(value: BlobResourceContents) -> Self {
+ Self::BlobResourceContents(value)
+ }
+}
+///Request
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "type": "object",
+/// "properties": {
+/// "progressToken": {
+/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
+/// "$ref": "#/definitions/ProgressToken"
+/// }
+/// }
+/// }
+/// },
+/// "additionalProperties": {}
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct Request {
+ pub method: ::std::string::String,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub params: ::std::option::Option,
+}
+///A uniquely identifying ID for a request in JSON-RPC.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A uniquely identifying ID for a request in JSON-RPC.",
+/// "type": [
+/// "string",
+/// "integer"
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum RequestId {
+ String(::std::string::String),
+ Integer(i64),
+}
+impl ::std::convert::From for RequestId {
+ fn from(value: i64) -> Self {
+ Self::Integer(value)
+ }
+}
+///RequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "type": "object",
+/// "properties": {
+/// "progressToken": {
+/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
+/// "$ref": "#/definitions/ProgressToken"
+/// }
+/// }
+/// }
+/// },
+/// "additionalProperties": {}
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct RequestParams {
+ #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub meta: ::std::option::Option,
+ #[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>>,
+}
+///RequestParamsMeta
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "progressToken": {
+/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
+/// "$ref": "#/definitions/ProgressToken"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct RequestParamsMeta {
+ ///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
+ #[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub progress_token: ::std::option::Option,
+}
+///A known resource that the server is capable of reading.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A known resource that the server is capable of reading.",
+/// "type": "object",
+/// "required": [
+/// "name",
+/// "uri"
+/// ],
+/// "properties": {
+/// "annotations": {
+/// "description": "Optional annotations for the client.",
+/// "$ref": "#/definitions/Annotations"
+/// },
+/// "description": {
+/// "description": "A description of what this resource represents.\n\nThis 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.",
+/// "type": "string"
+/// },
+/// "mimeType": {
+/// "description": "The MIME type of this resource, if known.",
+/// "type": "string"
+/// },
+/// "name": {
+/// "description": "A human-readable name for this resource.\n\nThis can be used by clients to populate UI elements.",
+/// "type": "string"
+/// },
+/// "size": {
+/// "description": "The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.\n\nThis can be used by Hosts to display file sizes and estimate context window usage.",
+/// "type": "integer"
+/// },
+/// "uri": {
+/// "description": "The URI of this resource.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct Resource {
+ ///Optional annotations for the client.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub annotations: ::std::option::Option,
+ /**A description of what this resource represents.
+ 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>,
+ ///The MIME type of this resource, if known.
+ #[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub mime_type: ::std::option::Option<::std::string::String>,
+ /**A human-readable name for this resource.
+ This can be used by clients to populate UI elements.*/
+ pub name: ::std::string::String,
+ /**The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
+ This can be used by Hosts to display file sizes and estimate context window usage.*/
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub size: ::std::option::Option,
+ ///The URI of this resource.
+ pub uri: ::std::string::String,
+}
+///The contents of a specific resource or sub-resource.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The contents of a specific resource or sub-resource.",
+/// "type": "object",
+/// "required": [
+/// "uri"
+/// ],
+/// "properties": {
+/// "mimeType": {
+/// "description": "The MIME type of this resource, if known.",
+/// "type": "string"
+/// },
+/// "uri": {
+/// "description": "The URI of this resource.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ResourceContents {
+ ///The MIME type of this resource, if known.
+ #[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub mime_type: ::std::option::Option<::std::string::String>,
+ ///The URI of this resource.
+ pub uri: ::std::string::String,
+}
+///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.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "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": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "notifications/resources/list_changed"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ResourceListChangedNotification {
+ method: ::std::string::String,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub params: ::std::option::Option,
+}
+impl ResourceListChangedNotification {
+ pub fn new(params: ::std::option::Option) -> Self {
+ Self {
+ method: "notifications/resources/list_changed".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "notifications/resources/list_changed".to_string()
+ }
+}
+///ResourceListChangedNotificationParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ResourceListChangedNotificationParams {
+ ///This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.
+ #[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")]
+ pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+}
+///A reference to a resource or resource template definition.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A reference to a resource or resource template definition.",
+/// "type": "object",
+/// "required": [
+/// "type",
+/// "uri"
+/// ],
+/// "properties": {
+/// "type": {
+/// "type": "string",
+/// "const": "ref/resource"
+/// },
+/// "uri": {
+/// "description": "The URI or URI template of the resource.",
+/// "type": "string",
+/// "format": "uri-template"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ResourceReference {
+ #[serde(rename = "type")]
+ type_: ::std::string::String,
+ ///The URI or URI template of the resource.
+ pub uri: ::std::string::String,
+}
+impl ResourceReference {
+ pub fn new(uri: ::std::string::String) -> Self {
+ Self {
+ type_: "ref/resource".to_string(),
+ uri,
+ }
+ }
+ pub fn type_(&self) -> &::std::string::String {
+ &self.type_
+ }
+ pub fn type_name() -> ::std::string::String {
+ "ref/resource".to_string()
+ }
+}
+///A template description for resources available on the server.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A template description for resources available on the server.",
+/// "type": "object",
+/// "required": [
+/// "name",
+/// "uriTemplate"
+/// ],
+/// "properties": {
+/// "annotations": {
+/// "description": "Optional annotations for the client.",
+/// "$ref": "#/definitions/Annotations"
+/// },
+/// "description": {
+/// "description": "A description of what this template is for.\n\nThis 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.",
+/// "type": "string"
+/// },
+/// "mimeType": {
+/// "description": "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.",
+/// "type": "string"
+/// },
+/// "name": {
+/// "description": "A human-readable name for the type of resource this template refers to.\n\nThis can be used by clients to populate UI elements.",
+/// "type": "string"
+/// },
+/// "uriTemplate": {
+/// "description": "A URI template (according to RFC 6570) that can be used to construct resource URIs.",
+/// "type": "string",
+/// "format": "uri-template"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ResourceTemplate {
+ ///Optional annotations for the client.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub annotations: ::std::option::Option,
+ /**A description of what this template is for.
+ 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>,
+ ///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.
+ #[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub mime_type: ::std::option::Option<::std::string::String>,
+ /**A human-readable name for the type of resource this template refers to.
+ This can be used by clients to populate UI elements.*/
+ pub name: ::std::string::String,
+ ///A URI template (according to RFC 6570) that can be used to construct resource URIs.
+ #[serde(rename = "uriTemplate")]
+ pub uri_template: ::std::string::String,
+}
+///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.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "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": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "notifications/resources/updated"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "uri"
+/// ],
+/// "properties": {
+/// "uri": {
+/// "description": "The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ResourceUpdatedNotification {
+ method: ::std::string::String,
+ pub params: ResourceUpdatedNotificationParams,
+}
+impl ResourceUpdatedNotification {
+ pub fn new(params: ResourceUpdatedNotificationParams) -> Self {
+ Self {
+ method: "notifications/resources/updated".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "notifications/resources/updated".to_string()
+ }
+}
+///ResourceUpdatedNotificationParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "uri"
+/// ],
+/// "properties": {
+/// "uri": {
+/// "description": "The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ResourceUpdatedNotificationParams {
+ ///The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
+ pub uri: ::std::string::String,
+}
+///Result
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct Result {
+ ///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
+ #[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")]
+ pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+}
+///The sender or recipient of messages and data in a conversation.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "The sender or recipient of messages and data in a conversation.",
+/// "type": "string",
+/// "enum": [
+/// "assistant",
+/// "user"
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+pub enum Role {
+ #[serde(rename = "assistant")]
+ Assistant,
+ #[serde(rename = "user")]
+ User,
+}
+impl ::std::fmt::Display for Role {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ match *self {
+ Self::Assistant => write!(f, "assistant"),
+ Self::User => write!(f, "user"),
+ }
+ }
+}
+///Represents a root directory or file that the server can operate on.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Represents a root directory or file that the server can operate on.",
+/// "type": "object",
+/// "required": [
+/// "uri"
+/// ],
+/// "properties": {
+/// "name": {
+/// "description": "An optional name for the root. This can be used to provide a human-readable\nidentifier for the root, which may be useful for display purposes or for\nreferencing the root in other parts of the application.",
+/// "type": "string"
+/// },
+/// "uri": {
+/// "description": "The URI identifying the root. This *must* start with file:// for now.\nThis restriction may be relaxed in future versions of the protocol to allow\nother URI schemes.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct Root {
+ /**An optional name for the root. This can be used to provide a human-readable
+ identifier for the root, which may be useful for display purposes or for
+ referencing the root in other parts of the application.*/
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub name: ::std::option::Option<::std::string::String>,
+ /**The URI identifying the root. This *must* start with file:// for now.
+ This restriction may be relaxed in future versions of the protocol to allow
+ other URI schemes.*/
+ pub uri: ::std::string::String,
+}
+/**A notification from the client to the server, informing it that the list of roots has changed.
+This notification should be sent whenever the client adds, removes, or modifies any root.
+The server should then request an updated list of roots using the ListRootsRequest.*/
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "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": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "notifications/roots/list_changed"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct RootsListChangedNotification {
+ method: ::std::string::String,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub params: ::std::option::Option,
+}
+impl RootsListChangedNotification {
+ pub fn new(params: ::std::option::Option) -> Self {
+ Self {
+ method: "notifications/roots/list_changed".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "notifications/roots/list_changed".to_string()
+ }
+}
+///RootsListChangedNotificationParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct RootsListChangedNotificationParams {
+ ///This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.
+ #[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")]
+ pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+}
+///RpcError
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "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"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct RpcError {
+ ///The error type that occurred.
+ pub code: i64,
+ ///Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub data: ::std::option::Option<::serde_json::Value>,
+ ///A short description of the error. The message SHOULD be limited to a concise single sentence.
+ pub message: ::std::string::String,
+}
+///Describes a message issued to or received from an LLM API.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Describes a message issued to or received from an LLM API.",
+/// "type": "object",
+/// "required": [
+/// "content",
+/// "role"
+/// ],
+/// "properties": {
+/// "content": {
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/TextContent"
+/// },
+/// {
+/// "$ref": "#/definitions/ImageContent"
+/// },
+/// {
+/// "$ref": "#/definitions/AudioContent"
+/// }
+/// ]
+/// },
+/// "role": {
+/// "$ref": "#/definitions/Role"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct SamplingMessage {
+ pub content: SamplingMessageContent,
+ pub role: Role,
+}
+///SamplingMessageContent
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/TextContent"
+/// },
+/// {
+/// "$ref": "#/definitions/ImageContent"
+/// },
+/// {
+/// "$ref": "#/definitions/AudioContent"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum SamplingMessageContent {
+ TextContent(TextContent),
+ ImageContent(ImageContent),
+ AudioContent(AudioContent),
+}
+impl ::std::convert::From for SamplingMessageContent {
+ fn from(value: TextContent) -> Self {
+ Self::TextContent(value)
+ }
+}
+impl ::std::convert::From for SamplingMessageContent {
+ fn from(value: ImageContent) -> Self {
+ Self::ImageContent(value)
+ }
+}
+impl ::std::convert::From for SamplingMessageContent {
+ fn from(value: AudioContent) -> Self {
+ Self::AudioContent(value)
+ }
+}
+///Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.",
+/// "type": "object",
+/// "properties": {
+/// "completions": {
+/// "description": "Present if the server supports argument autocompletion suggestions.",
+/// "type": "object",
+/// "additionalProperties": true
+/// },
+/// "experimental": {
+/// "description": "Experimental, non-standard capabilities that the server supports.",
+/// "type": "object",
+/// "additionalProperties": {
+/// "type": "object",
+/// "additionalProperties": true
+/// }
+/// },
+/// "logging": {
+/// "description": "Present if the server supports sending log messages to the client.",
+/// "type": "object",
+/// "additionalProperties": true
+/// },
+/// "prompts": {
+/// "description": "Present if the server offers any prompt templates.",
+/// "type": "object",
+/// "properties": {
+/// "listChanged": {
+/// "description": "Whether this server supports notifications for changes to the prompt list.",
+/// "type": "boolean"
+/// }
+/// }
+/// },
+/// "resources": {
+/// "description": "Present if the server offers any resources to read.",
+/// "type": "object",
+/// "properties": {
+/// "listChanged": {
+/// "description": "Whether this server supports notifications for changes to the resource list.",
+/// "type": "boolean"
+/// },
+/// "subscribe": {
+/// "description": "Whether this server supports subscribing to resource updates.",
+/// "type": "boolean"
+/// }
+/// }
+/// },
+/// "tools": {
+/// "description": "Present if the server offers any tools to call.",
+/// "type": "object",
+/// "properties": {
+/// "listChanged": {
+/// "description": "Whether this server supports notifications for changes to the tool list.",
+/// "type": "boolean"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ServerCapabilities {
+ ///Present if the server supports argument autocompletion suggestions.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub completions: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+ ///Experimental, non-standard capabilities that the server supports.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub experimental: ::std::option::Option<
+ ::std::collections::HashMap<::std::string::String, ::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+ >,
+ ///Present if the server supports sending log messages to the client.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub logging: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub prompts: ::std::option::Option,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub resources: ::std::option::Option,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub tools: ::std::option::Option,
+}
+///Present if the server offers any prompt templates.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Present if the server offers any prompt templates.",
+/// "type": "object",
+/// "properties": {
+/// "listChanged": {
+/// "description": "Whether this server supports notifications for changes to the prompt list.",
+/// "type": "boolean"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ServerCapabilitiesPrompts {
+ ///Whether this server supports notifications for changes to the prompt list.
+ #[serde(rename = "listChanged", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub list_changed: ::std::option::Option,
+}
+///Present if the server offers any resources to read.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Present if the server offers any resources to read.",
+/// "type": "object",
+/// "properties": {
+/// "listChanged": {
+/// "description": "Whether this server supports notifications for changes to the resource list.",
+/// "type": "boolean"
+/// },
+/// "subscribe": {
+/// "description": "Whether this server supports subscribing to resource updates.",
+/// "type": "boolean"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ServerCapabilitiesResources {
+ ///Whether this server supports notifications for changes to the resource list.
+ #[serde(rename = "listChanged", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub list_changed: ::std::option::Option,
+ ///Whether this server supports subscribing to resource updates.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub subscribe: ::std::option::Option,
+}
+///Present if the server offers any tools to call.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Present if the server offers any tools to call.",
+/// "type": "object",
+/// "properties": {
+/// "listChanged": {
+/// "description": "Whether this server supports notifications for changes to the tool list.",
+/// "type": "boolean"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ServerCapabilitiesTools {
+ ///Whether this server supports notifications for changes to the tool list.
+ #[serde(rename = "listChanged", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub list_changed: ::std::option::Option,
+}
+///ServerNotification
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/CancelledNotification"
+/// },
+/// {
+/// "$ref": "#/definitions/ProgressNotification"
+/// },
+/// {
+/// "$ref": "#/definitions/ResourceListChangedNotification"
+/// },
+/// {
+/// "$ref": "#/definitions/ResourceUpdatedNotification"
+/// },
+/// {
+/// "$ref": "#/definitions/PromptListChangedNotification"
+/// },
+/// {
+/// "$ref": "#/definitions/ToolListChangedNotification"
+/// },
+/// {
+/// "$ref": "#/definitions/LoggingMessageNotification"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum ServerNotification {
+ CancelledNotification(CancelledNotification),
+ ProgressNotification(ProgressNotification),
+ ResourceListChangedNotification(ResourceListChangedNotification),
+ ResourceUpdatedNotification(ResourceUpdatedNotification),
+ PromptListChangedNotification(PromptListChangedNotification),
+ ToolListChangedNotification(ToolListChangedNotification),
+ LoggingMessageNotification(LoggingMessageNotification),
+}
+impl ::std::convert::From for ServerNotification {
+ fn from(value: CancelledNotification) -> Self {
+ Self::CancelledNotification(value)
+ }
+}
+impl ::std::convert::From for ServerNotification {
+ fn from(value: ProgressNotification) -> Self {
+ Self::ProgressNotification(value)
+ }
+}
+impl ::std::convert::From for ServerNotification {
+ fn from(value: ResourceListChangedNotification) -> Self {
+ Self::ResourceListChangedNotification(value)
+ }
+}
+impl ::std::convert::From for ServerNotification {
+ fn from(value: ResourceUpdatedNotification) -> Self {
+ Self::ResourceUpdatedNotification(value)
+ }
+}
+impl ::std::convert::From for ServerNotification {
+ fn from(value: PromptListChangedNotification) -> Self {
+ Self::PromptListChangedNotification(value)
+ }
+}
+impl ::std::convert::From for ServerNotification {
+ fn from(value: ToolListChangedNotification) -> Self {
+ Self::ToolListChangedNotification(value)
+ }
+}
+impl ::std::convert::From for ServerNotification {
+ fn from(value: LoggingMessageNotification) -> Self {
+ Self::LoggingMessageNotification(value)
+ }
+}
+///ServerRequest
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/PingRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/CreateMessageRequest"
+/// },
+/// {
+/// "$ref": "#/definitions/ListRootsRequest"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum ServerRequest {
+ PingRequest(PingRequest),
+ CreateMessageRequest(CreateMessageRequest),
+ ListRootsRequest(ListRootsRequest),
+}
+impl ::std::convert::From for ServerRequest {
+ fn from(value: PingRequest) -> Self {
+ Self::PingRequest(value)
+ }
+}
+impl ::std::convert::From for ServerRequest {
+ fn from(value: CreateMessageRequest) -> Self {
+ Self::CreateMessageRequest(value)
+ }
+}
+impl ::std::convert::From for ServerRequest {
+ fn from(value: ListRootsRequest) -> Self {
+ Self::ListRootsRequest(value)
+ }
+}
+///ServerResult
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "anyOf": [
+/// {
+/// "$ref": "#/definitions/Result"
+/// },
+/// {
+/// "$ref": "#/definitions/InitializeResult"
+/// },
+/// {
+/// "$ref": "#/definitions/ListResourcesResult"
+/// },
+/// {
+/// "$ref": "#/definitions/ListResourceTemplatesResult"
+/// },
+/// {
+/// "$ref": "#/definitions/ReadResourceResult"
+/// },
+/// {
+/// "$ref": "#/definitions/ListPromptsResult"
+/// },
+/// {
+/// "$ref": "#/definitions/GetPromptResult"
+/// },
+/// {
+/// "$ref": "#/definitions/ListToolsResult"
+/// },
+/// {
+/// "$ref": "#/definitions/CallToolResult"
+/// },
+/// {
+/// "$ref": "#/definitions/CompleteResult"
+/// }
+/// ]
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum ServerResult {
+ InitializeResult(InitializeResult),
+ ListResourcesResult(ListResourcesResult),
+ ListResourceTemplatesResult(ListResourceTemplatesResult),
+ ReadResourceResult(ReadResourceResult),
+ ListPromptsResult(ListPromptsResult),
+ GetPromptResult(GetPromptResult),
+ ListToolsResult(ListToolsResult),
+ CallToolResult(CallToolResult),
+ CompleteResult(CompleteResult),
+ Result(Result),
+}
+impl ::std::convert::From for ServerResult {
+ fn from(value: InitializeResult) -> Self {
+ Self::InitializeResult(value)
+ }
+}
+impl ::std::convert::From for ServerResult {
+ fn from(value: ListResourcesResult) -> Self {
+ Self::ListResourcesResult(value)
+ }
+}
+impl ::std::convert::From for ServerResult {
+ fn from(value: ListResourceTemplatesResult) -> Self {
+ Self::ListResourceTemplatesResult(value)
+ }
+}
+impl ::std::convert::From for ServerResult {
+ fn from(value: ReadResourceResult) -> Self {
+ Self::ReadResourceResult(value)
+ }
+}
+impl ::std::convert::From for ServerResult {
+ fn from(value: ListPromptsResult) -> Self {
+ Self::ListPromptsResult(value)
+ }
+}
+impl ::std::convert::From for ServerResult {
+ fn from(value: GetPromptResult) -> Self {
+ Self::GetPromptResult(value)
+ }
+}
+impl ::std::convert::From for ServerResult {
+ fn from(value: ListToolsResult) -> Self {
+ Self::ListToolsResult(value)
+ }
+}
+impl ::std::convert::From for ServerResult {
+ fn from(value: CallToolResult) -> Self {
+ Self::CallToolResult(value)
+ }
+}
+impl ::std::convert::From for ServerResult {
+ fn from(value: CompleteResult) -> Self {
+ Self::CompleteResult(value)
+ }
+}
+impl ::std::convert::From for ServerResult {
+ fn from(value: Result) -> Self {
+ Self::Result(value)
+ }
+}
+///A request from the client to the server, to enable or adjust logging.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A request from the client to the server, to enable or adjust logging.",
+/// "type": "object",
+/// "required": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "logging/setLevel"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "level"
+/// ],
+/// "properties": {
+/// "level": {
+/// "description": "The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.",
+/// "$ref": "#/definitions/LoggingLevel"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct SetLevelRequest {
+ method: ::std::string::String,
+ pub params: SetLevelRequestParams,
+}
+impl SetLevelRequest {
+ pub fn new(params: SetLevelRequestParams) -> Self {
+ Self {
+ method: "logging/setLevel".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "logging/setLevel".to_string()
+ }
+}
+///SetLevelRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "level"
+/// ],
+/// "properties": {
+/// "level": {
+/// "description": "The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.",
+/// "$ref": "#/definitions/LoggingLevel"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct SetLevelRequestParams {
+ ///The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.
+ pub level: LoggingLevel,
+}
+///Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.",
+/// "type": "object",
+/// "required": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "resources/subscribe"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "uri"
+/// ],
+/// "properties": {
+/// "uri": {
+/// "description": "The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct SubscribeRequest {
+ method: ::std::string::String,
+ pub params: SubscribeRequestParams,
+}
+impl SubscribeRequest {
+ pub fn new(params: SubscribeRequestParams) -> Self {
+ Self {
+ method: "resources/subscribe".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "resources/subscribe".to_string()
+ }
+}
+///SubscribeRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "uri"
+/// ],
+/// "properties": {
+/// "uri": {
+/// "description": "The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct SubscribeRequestParams {
+ ///The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.
+ pub uri: ::std::string::String,
+}
+///Text provided to or from an LLM.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Text provided to or from an LLM.",
+/// "type": "object",
+/// "required": [
+/// "text",
+/// "type"
+/// ],
+/// "properties": {
+/// "annotations": {
+/// "description": "Optional annotations for the client.",
+/// "$ref": "#/definitions/Annotations"
+/// },
+/// "text": {
+/// "description": "The text content of the message.",
+/// "type": "string"
+/// },
+/// "type": {
+/// "type": "string",
+/// "const": "text"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct TextContent {
+ ///Optional annotations for the client.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub annotations: ::std::option::Option,
+ ///The text content of the message.
+ pub text: ::std::string::String,
+ #[serde(rename = "type")]
+ type_: ::std::string::String,
+}
+impl TextContent {
+ pub fn new(text: ::std::string::String, annotations: ::std::option::Option) -> Self {
+ Self {
+ annotations,
+ text,
+ type_: "text".to_string(),
+ }
+ }
+ pub fn type_(&self) -> &::std::string::String {
+ &self.type_
+ }
+ pub fn type_name() -> ::std::string::String {
+ "text".to_string()
+ }
+}
+///TextResourceContents
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "text",
+/// "uri"
+/// ],
+/// "properties": {
+/// "mimeType": {
+/// "description": "The MIME type of this resource, if known.",
+/// "type": "string"
+/// },
+/// "text": {
+/// "description": "The text of the item. This must only be set if the item can actually be represented as text (not binary data).",
+/// "type": "string"
+/// },
+/// "uri": {
+/// "description": "The URI of this resource.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct TextResourceContents {
+ ///The MIME type of this resource, if known.
+ #[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub mime_type: ::std::option::Option<::std::string::String>,
+ ///The text of the item. This must only be set if the item can actually be represented as text (not binary data).
+ pub text: ::std::string::String,
+ ///The URI of this resource.
+ pub uri: ::std::string::String,
+}
+///Definition for a tool the client can call.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Definition for a tool the client can call.",
+/// "type": "object",
+/// "required": [
+/// "inputSchema",
+/// "name"
+/// ],
+/// "properties": {
+/// "annotations": {
+/// "description": "Optional additional tool information.",
+/// "$ref": "#/definitions/ToolAnnotations"
+/// },
+/// "description": {
+/// "description": "A human-readable description of the tool.\n\nThis can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a \"hint\" to the model.",
+/// "type": "string"
+/// },
+/// "inputSchema": {
+/// "description": "A JSON Schema object defining the expected parameters for the tool.",
+/// "type": "object",
+/// "required": [
+/// "type"
+/// ],
+/// "properties": {
+/// "properties": {
+/// "type": "object",
+/// "additionalProperties": {
+/// "type": "object",
+/// "additionalProperties": true
+/// }
+/// },
+/// "required": {
+/// "type": "array",
+/// "items": {
+/// "type": "string"
+/// }
+/// },
+/// "type": {
+/// "type": "string",
+/// "const": "object"
+/// }
+/// }
+/// },
+/// "name": {
+/// "description": "The name of the tool.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct Tool {
+ ///Optional additional tool information.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub annotations: ::std::option::Option,
+ /**A human-readable description of the tool.
+ This can be used by clients to improve the LLM's understanding of available tools. 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>,
+ #[serde(rename = "inputSchema")]
+ pub input_schema: ToolInputSchema,
+ ///The name of the tool.
+ pub name: ::std::string::String,
+}
+/**Additional properties describing a Tool to clients.
+NOTE: all properties in ToolAnnotations are **hints**.
+They are not guaranteed to provide a faithful description of
+tool behavior (including descriptive properties like title).
+Clients should never make tool use decisions based on ToolAnnotations
+received from untrusted servers.*/
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "Additional properties describing a Tool to clients.\n\nNOTE: all properties in ToolAnnotations are **hints**.\nThey are not guaranteed to provide a faithful description of\ntool behavior (including descriptive properties like title).\n\nClients should never make tool use decisions based on ToolAnnotations\nreceived from untrusted servers.",
+/// "type": "object",
+/// "properties": {
+/// "destructiveHint": {
+/// "description": "If true, the tool may perform destructive updates to its environment.\nIf false, the tool performs only additive updates.\n\n(This property is meaningful only when readOnlyHint == false)\n\nDefault: true",
+/// "type": "boolean"
+/// },
+/// "idempotentHint": {
+/// "description": "If true, calling the tool repeatedly with the same arguments\nwill have no additional effect on the its environment.\n\n(This property is meaningful only when readOnlyHint == false)\n\nDefault: false",
+/// "type": "boolean"
+/// },
+/// "openWorldHint": {
+/// "description": "If true, this tool may interact with an \"open world\" of external\nentities. If false, the tool's domain of interaction is closed.\nFor example, the world of a web search tool is open, whereas that\nof a memory tool is not.\n\nDefault: true",
+/// "type": "boolean"
+/// },
+/// "readOnlyHint": {
+/// "description": "If true, the tool does not modify its environment.\n\nDefault: false",
+/// "type": "boolean"
+/// },
+/// "title": {
+/// "description": "A human-readable title for the tool.",
+/// "type": "string"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ToolAnnotations {
+ /**If true, the tool may perform destructive updates to its environment.
+ If false, the tool performs only additive updates.
+ (This property is meaningful only when readOnlyHint == false)
+ Default: true*/
+ #[serde(rename = "destructiveHint", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub destructive_hint: ::std::option::Option,
+ /**If true, calling the tool repeatedly with the same arguments
+ will have no additional effect on the its environment.
+ (This property is meaningful only when readOnlyHint == false)
+ Default: false*/
+ #[serde(rename = "idempotentHint", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub idempotent_hint: ::std::option::Option,
+ /**If true, this tool may interact with an "open world" of external
+ entities. If false, the tool's domain of interaction is closed.
+ For example, the world of a web search tool is open, whereas that
+ of a memory tool is not.
+ Default: true*/
+ #[serde(rename = "openWorldHint", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub open_world_hint: ::std::option::Option,
+ /**If true, the tool does not modify its environment.
+ Default: false*/
+ #[serde(rename = "readOnlyHint", default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub read_only_hint: ::std::option::Option,
+ ///A human-readable title for the tool.
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub title: ::std::option::Option<::std::string::String>,
+}
+///A JSON Schema object defining the expected parameters for the tool.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "description": "A JSON Schema object defining the expected parameters for the tool.",
+/// "type": "object",
+/// "required": [
+/// "type"
+/// ],
+/// "properties": {
+/// "properties": {
+/// "type": "object",
+/// "additionalProperties": {
+/// "type": "object",
+/// "additionalProperties": true
+/// }
+/// },
+/// "required": {
+/// "type": "array",
+/// "items": {
+/// "type": "string"
+/// }
+/// },
+/// "type": {
+/// "type": "string",
+/// "const": "object"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ToolInputSchema {
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub properties: ::std::option::Option<
+ ::std::collections::HashMap<::std::string::String, ::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+ >,
+ #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
+ pub required: ::std::vec::Vec<::std::string::String>,
+ #[serde(rename = "type")]
+ type_: ::std::string::String,
+}
+impl ToolInputSchema {
+ pub fn new(
+ required: ::std::vec::Vec<::std::string::String>,
+ properties: ::std::option::Option<
+ ::std::collections::HashMap<
+ ::std::string::String,
+ ::serde_json::Map<::std::string::String, ::serde_json::Value>,
+ >,
+ >,
+ ) -> Self {
+ Self {
+ properties,
+ required,
+ type_: "object".to_string(),
+ }
+ }
+ pub fn type_(&self) -> &::std::string::String {
+ &self.type_
+ }
+ pub fn type_name() -> ::std::string::String {
+ "object".to_string()
+ }
+}
+///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.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "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": [
+/// "method"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "notifications/tools/list_changed"
+/// },
+/// "params": {
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct ToolListChangedNotification {
+ method: ::std::string::String,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pub params: ::std::option::Option,
+}
+impl ToolListChangedNotification {
+ pub fn new(params: ::std::option::Option) -> Self {
+ Self {
+ method: "notifications/tools/list_changed".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "notifications/tools/list_changed".to_string()
+ }
+}
+///ToolListChangedNotificationParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "properties": {
+/// "_meta": {
+/// "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.",
+/// "type": "object",
+/// "additionalProperties": {}
+/// }
+/// },
+/// "additionalProperties": {}
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
+pub struct ToolListChangedNotificationParams {
+ ///This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.
+ #[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")]
+ pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
+}
+///Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "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": [
+/// "method",
+/// "params"
+/// ],
+/// "properties": {
+/// "method": {
+/// "type": "string",
+/// "const": "resources/unsubscribe"
+/// },
+/// "params": {
+/// "type": "object",
+/// "required": [
+/// "uri"
+/// ],
+/// "properties": {
+/// "uri": {
+/// "description": "The URI of the resource to unsubscribe from.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct UnsubscribeRequest {
+ method: ::std::string::String,
+ pub params: UnsubscribeRequestParams,
+}
+impl UnsubscribeRequest {
+ pub fn new(params: UnsubscribeRequestParams) -> Self {
+ Self {
+ method: "resources/unsubscribe".to_string(),
+ params,
+ }
+ }
+ pub fn method(&self) -> &::std::string::String {
+ &self.method
+ }
+ pub fn method_name() -> ::std::string::String {
+ "resources/unsubscribe".to_string()
+ }
+}
+///UnsubscribeRequestParams
+///
+/// JSON schema
+///
+/// ```json
+///{
+/// "type": "object",
+/// "required": [
+/// "uri"
+/// ],
+/// "properties": {
+/// "uri": {
+/// "description": "The URI of the resource to unsubscribe from.",
+/// "type": "string",
+/// "format": "uri"
+/// }
+/// }
+///}
+/// ```
+///
+#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
+pub struct UnsubscribeRequestParams {
+ ///The URI of the resource to unsubscribe from.
+ pub uri: ::std::string::String,
+}
+/// Implementing the Deserialize trait
+/// This allows enum to be deserialized into correct type based on the value of the "method"
+impl<'de> serde::Deserialize<'de> for ClientRequest {
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ let value: serde_json::Value = serde::Deserialize::deserialize(deserializer)?;
+ let method_option = value.get("method").and_then(|v| v.as_str());
+ if let Some(method) = method_option {
+ match method {
+ "initialize" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::InitializeRequest(req))
+ }
+ "ping" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::PingRequest(req))
+ }
+ "resources/list" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::ListResourcesRequest(req))
+ }
+ "resources/templates/list" => {
+ let req =
+ serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::ListResourceTemplatesRequest(req))
+ }
+ "resources/read" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::ReadResourceRequest(req))
+ }
+ "resources/subscribe" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::SubscribeRequest(req))
+ }
+ "resources/unsubscribe" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::UnsubscribeRequest(req))
+ }
+ "prompts/list" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::ListPromptsRequest(req))
+ }
+ "prompts/get" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::GetPromptRequest(req))
+ }
+ "tools/list" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::ListToolsRequest(req))
+ }
+ "tools/call" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::CallToolRequest(req))
+ }
+ "logging/setLevel" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::SetLevelRequest(req))
+ }
+ "completion/complete" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientRequest::CompleteRequest(req))
+ }
+ _ => Err(serde::de::Error::unknown_variant("method", &[""])),
+ }
+ } else {
+ Err(serde::de::Error::missing_field("method"))
+ }
+ }
+}
+impl ClientRequest {
+ pub fn method(&self) -> &str {
+ match self {
+ ClientRequest::InitializeRequest(request) => request.method(),
+ ClientRequest::PingRequest(request) => request.method(),
+ ClientRequest::ListResourcesRequest(request) => request.method(),
+ ClientRequest::ListResourceTemplatesRequest(request) => request.method(),
+ ClientRequest::ReadResourceRequest(request) => request.method(),
+ ClientRequest::SubscribeRequest(request) => request.method(),
+ ClientRequest::UnsubscribeRequest(request) => request.method(),
+ ClientRequest::ListPromptsRequest(request) => request.method(),
+ ClientRequest::GetPromptRequest(request) => request.method(),
+ ClientRequest::ListToolsRequest(request) => request.method(),
+ ClientRequest::CallToolRequest(request) => request.method(),
+ ClientRequest::SetLevelRequest(request) => request.method(),
+ ClientRequest::CompleteRequest(request) => request.method(),
+ }
+ }
+}
+/// Implementing the Deserialize trait
+/// This allows enum to be deserialized into correct type based on the value of the "method"
+impl<'de> serde::Deserialize<'de> for ClientNotification {
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ let value: serde_json::Value = serde::Deserialize::deserialize(deserializer)?;
+ let method_option = value.get("method").and_then(|v| v.as_str());
+ if let Some(method) = method_option {
+ match method {
+ "notifications/cancelled" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientNotification::CancelledNotification(req))
+ }
+ "notifications/initialized" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientNotification::InitializedNotification(req))
+ }
+ "notifications/progress" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientNotification::ProgressNotification(req))
+ }
+ "notifications/roots/list_changed" => {
+ let req =
+ serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ClientNotification::RootsListChangedNotification(req))
+ }
+ _ => Err(serde::de::Error::unknown_variant("method", &[""])),
+ }
+ } else {
+ Err(serde::de::Error::missing_field("method"))
+ }
+ }
+}
+impl ClientNotification {
+ pub fn method(&self) -> &str {
+ match self {
+ ClientNotification::CancelledNotification(request) => request.method(),
+ ClientNotification::InitializedNotification(request) => request.method(),
+ ClientNotification::ProgressNotification(request) => request.method(),
+ ClientNotification::RootsListChangedNotification(request) => request.method(),
+ }
+ }
+}
+/// Implementing the Deserialize trait
+/// This allows enum to be deserialized into correct type based on the value of the "method"
+impl<'de> serde::Deserialize<'de> for ServerRequest {
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ let value: serde_json::Value = serde::Deserialize::deserialize(deserializer)?;
+ let method_option = value.get("method").and_then(|v| v.as_str());
+ if let Some(method) = method_option {
+ match method {
+ "ping" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ServerRequest::PingRequest(req))
+ }
+ "sampling/createMessage" => {
+ let req = serde_json::from_value::(value).map_err(serde::de::Error::custom)?;
+ Ok(ServerRequest::CreateMessageRequest(req))
+ }
+ "roots/list" => {
+ let req = serde_json::from_value::