From 0c1fa8ff895f3b7f4bec4b17546aefd1fbeb7c81 Mon Sep 17 00:00:00 2001 From: jokemanfire Date: Sat, 14 Jun 2025 08:47:18 +0800 Subject: [PATCH 1/2] chore(deps): update schemars requirement from 0.8 to 0.9 --- crates/rmcp/Cargo.toml | 4 +- crates/rmcp/src/handler/server/tool.rs | 4 +- crates/rmcp/src/model.rs | 55 ++++++++++++-------------- examples/servers/Cargo.toml | 2 +- examples/transport/Cargo.toml | 2 +- 5 files changed, 32 insertions(+), 35 deletions(-) diff --git a/crates/rmcp/Cargo.toml b/crates/rmcp/Cargo.toml index 34bffc8f..f9be1ebb 100644 --- a/crates/rmcp/Cargo.toml +++ b/crates/rmcp/Cargo.toml @@ -28,7 +28,7 @@ paste = { version = "1", optional = true } oauth2 = { version = "5.0", optional = true } # for auto generate schema -schemars = { version = "0.8", optional = true, features = ["chrono"] } +schemars = { version = "0.9", optional = true } # for image encoding base64 = { version = "0.22", optional = true } @@ -133,7 +133,7 @@ schemars = ["dep:schemars"] [dev-dependencies] tokio = { version = "1", features = ["full"] } -schemars = { version = "0.8" } +schemars = { version = "0.9", features = ["chrono04"] } anyhow = "1.0" tracing-subscriber = { version = "0.3", features = [ diff --git a/crates/rmcp/src/handler/server/tool.rs b/crates/rmcp/src/handler/server/tool.rs index 5f33a742..b0533b23 100644 --- a/crates/rmcp/src/handler/server/tool.rs +++ b/crates/rmcp/src/handler/server/tool.rs @@ -183,11 +183,11 @@ pub type DynCallToolHandler = dyn for<'s> Fn(ToolCallContext<'s, S>) -> BoxFu pub struct Parameters

(pub P); impl JsonSchema for Parameters

{ - fn schema_name() -> String { + fn schema_name() -> Cow<'static, str> { P::schema_name() } - fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema { + fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::Schema { P::json_schema(generator) } } diff --git a/crates/rmcp/src/model.rs b/crates/rmcp/src/model.rs index 8a1046f1..a28a1fba 100644 --- a/crates/rmcp/src/model.rs +++ b/crates/rmcp/src/model.rs @@ -98,18 +98,19 @@ macro_rules! const_string { #[cfg(feature = "schemars")] impl schemars::JsonSchema for $name { - fn schema_name() -> String { - stringify!($name).to_string() + fn schema_name() -> Cow<'static, str> { + Cow::Borrowed(stringify!($name)) } - fn json_schema(_: &mut schemars::SchemaGenerator) -> schemars::schema::Schema { - // Create a schema for a constant value of type String - schemars::schema::Schema::Object(schemars::schema::SchemaObject { - instance_type: Some(schemars::schema::InstanceType::String.into()), - format: Some("const".to_string()), - const_value: Some(serde_json::Value::String($value.into())), - ..Default::default() - }) + fn json_schema(_: &mut schemars::SchemaGenerator) -> schemars::Schema { + use serde_json::{Map, json}; + + let mut schema_map = Map::new(); + schema_map.insert("type".to_string(), json!("string")); + schema_map.insert("format".to_string(), json!("const")); + schema_map.insert("const".to_string(), json!($value)); + + schemars::Schema::from(schema_map) } } }; @@ -233,27 +234,23 @@ impl<'de> Deserialize<'de> for NumberOrString { #[cfg(feature = "schemars")] impl schemars::JsonSchema for NumberOrString { - fn schema_name() -> String { - "NumberOrString".to_string() + fn schema_name() -> Cow<'static, str> { + Cow::Borrowed("NumberOrString") } - fn json_schema(_: &mut schemars::SchemaGenerator) -> schemars::schema::Schema { - schemars::schema::Schema::Object(schemars::schema::SchemaObject { - subschemas: Some(Box::new(schemars::schema::SubschemaValidation { - one_of: Some(vec![ - schemars::schema::Schema::Object(schemars::schema::SchemaObject { - instance_type: Some(schemars::schema::InstanceType::Number.into()), - ..Default::default() - }), - schemars::schema::Schema::Object(schemars::schema::SchemaObject { - instance_type: Some(schemars::schema::InstanceType::String.into()), - ..Default::default() - }), - ]), - ..Default::default() - })), - ..Default::default() - }) + fn json_schema(_: &mut schemars::SchemaGenerator) -> schemars::Schema { + use serde_json::{Map, json}; + + let mut number_schema = Map::new(); + number_schema.insert("type".to_string(), json!("number")); + + let mut string_schema = Map::new(); + string_schema.insert("type".to_string(), json!("string")); + + let mut schema_map = Map::new(); + schema_map.insert("oneOf".to_string(), json!([number_schema, string_schema])); + + schemars::Schema::from(schema_map) } } diff --git a/examples/servers/Cargo.toml b/examples/servers/Cargo.toml index 35d63622..962f2b19 100644 --- a/examples/servers/Cargo.toml +++ b/examples/servers/Cargo.toml @@ -33,7 +33,7 @@ tracing-subscriber = { version = "0.3", features = [ futures = "0.3" rand = { version = "0.9", features = ["std"] } axum = { version = "0.8", features = ["macros"] } -schemars = { version = "0.8", optional = true } +schemars = { version = "0.9", optional = true } reqwest = { version = "0.12", features = ["json"] } chrono = "0.4" uuid = { version = "1.6", features = ["v4", "serde"] } diff --git a/examples/transport/Cargo.toml b/examples/transport/Cargo.toml index e64a34bd..053a9ce5 100644 --- a/examples/transport/Cargo.toml +++ b/examples/transport/Cargo.toml @@ -37,7 +37,7 @@ tracing-subscriber = { version = "0.3", features = [ ] } futures = "0.3" rand = { version = "0.9" } -schemars = { version = "0.8", optional = true } +schemars = { version = "0.9", optional = true } hyper = { version = "1", features = ["client", "server", "http1"] } hyper-util = { version = "0.1", features = ["tokio"] } tokio-tungstenite = "0.27.0" From cc6234f16fbb474821a27aff3e5bed2966c98c45 Mon Sep 17 00:00:00 2001 From: jokemanfire Date: Sat, 14 Jun 2025 11:07:52 +0800 Subject: [PATCH 2/2] fix: adapt the new openApi structure --- crates/rmcp/Cargo.toml | 4 +- crates/rmcp/src/handler/server/tool.rs | 11 +- crates/rmcp/tests/test_message_schema.rs | 12 +- .../client_json_rpc_message_schema.json | 916 ++++++++++-------- .../server_json_rpc_message_schema.json | 816 ++++++++-------- 5 files changed, 938 insertions(+), 821 deletions(-) diff --git a/crates/rmcp/Cargo.toml b/crates/rmcp/Cargo.toml index f9be1ebb..2c7ece94 100644 --- a/crates/rmcp/Cargo.toml +++ b/crates/rmcp/Cargo.toml @@ -28,7 +28,7 @@ paste = { version = "1", optional = true } oauth2 = { version = "5.0", optional = true } # for auto generate schema -schemars = { version = "0.9", optional = true } +schemars = { version = "1.0", optional = true } # for image encoding base64 = { version = "0.22", optional = true } @@ -133,7 +133,7 @@ schemars = ["dep:schemars"] [dev-dependencies] tokio = { version = "1", features = ["full"] } -schemars = { version = "0.9", features = ["chrono04"] } +schemars = { version = "1.0", features = ["chrono04"] } anyhow = "1.0" tracing-subscriber = { version = "0.3", features = [ diff --git a/crates/rmcp/src/handler/server/tool.rs b/crates/rmcp/src/handler/server/tool.rs index b0533b23..65433454 100644 --- a/crates/rmcp/src/handler/server/tool.rs +++ b/crates/rmcp/src/handler/server/tool.rs @@ -3,7 +3,7 @@ use std::{ }; use futures::future::{BoxFuture, FutureExt}; -use schemars::JsonSchema; +use schemars::{JsonSchema, transform::AddNullable}; use serde::{Deserialize, Serialize, de::DeserializeOwned}; use tokio_util::sync::CancellationToken; @@ -11,17 +11,16 @@ pub use super::router::tool::{ToolRoute, ToolRouter}; use crate::{ RoleServer, model::{CallToolRequestParam, CallToolResult, IntoContents, JsonObject}, + schemars::generate::SchemaSettings, service::RequestContext, }; - /// A shortcut for generating a JSON schema for a type. pub fn schema_for_type() -> JsonObject { // explicitly to align json schema version to official specifications. // https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2025-03-26/schema.json - let mut settings = schemars::r#gen::SchemaSettings::draft07(); - settings.option_nullable = true; - settings.option_add_null_type = false; - settings.visitors = Vec::default(); + // TODO: update to 2020-12 waiting for the mcp spec update + let mut settings = SchemaSettings::draft07(); + settings.transforms = vec![Box::new(AddNullable::default())]; let generator = settings.into_generator(); let schema = generator.into_root_schema_for::(); let object = serde_json::to_value(schema).expect("failed to serialize schema"); diff --git a/crates/rmcp/tests/test_message_schema.rs b/crates/rmcp/tests/test_message_schema.rs index 86e93657..f05c263c 100644 --- a/crates/rmcp/tests/test_message_schema.rs +++ b/crates/rmcp/tests/test_message_schema.rs @@ -1,6 +1,6 @@ mod tests { use rmcp::model::{ClientJsonRpcMessage, ServerJsonRpcMessage}; - use schemars::schema_for; + use schemars::generate::SchemaSettings; fn compare_schemas(name: &str, actual: &str, expected_file: &str) { let expected = match std::fs::read_to_string(expected_file) { @@ -48,7 +48,10 @@ mod tests { #[test] fn test_client_json_rpc_message_schema() { - let schema = schema_for!(ClientJsonRpcMessage); + let settings = SchemaSettings::draft07(); + let schema = settings + .into_generator() + .into_root_schema_for::(); let schema_str = serde_json::to_string_pretty(&schema).expect("Failed to serialize schema"); compare_schemas( @@ -60,7 +63,10 @@ mod tests { #[test] fn test_server_json_rpc_message_schema() { - let schema = schema_for!(ServerJsonRpcMessage); + let settings = SchemaSettings::draft07(); + let schema = settings + .into_generator() + .into_root_schema_for::(); let schema_str = serde_json::to_string_pretty(&schema).expect("Failed to serialize schema"); compare_schemas( diff --git a/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json b/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json index 652e2990..2ddebc7e 100644 --- a/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json +++ b/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json @@ -1,13 +1,13 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "JsonRpcMessage_for_ClientRequest_and_ClientResult_and_ClientNotification", - "description": "Represents any JSON-RPC message that can be sent or received.\n\nThis enum covers all possible message types in the JSON-RPC protocol: individual requests/responses, notifications, batch operations, and errors. It serves as the top-level message container for MCP communication.", + "title": "JsonRpcMessage", + "description": "Represents any JSON-RPC message that can be sent or received.\n\nThis enum covers all possible message types in the JSON-RPC protocol:\nindividual requests/responses, notifications, batch operations, and errors.\nIt serves as the top-level message container for MCP communication.", "anyOf": [ { "description": "A single request expecting a response", "allOf": [ { - "$ref": "#/definitions/JsonRpcRequest_for_ClientRequest" + "$ref": "#/definitions/JsonRpcRequest" } ] }, @@ -15,7 +15,7 @@ "description": "A response to a previous request", "allOf": [ { - "$ref": "#/definitions/JsonRpcResponse_for_ClientResult" + "$ref": "#/definitions/JsonRpcResponse" } ] }, @@ -23,7 +23,7 @@ "description": "A one-way notification (no response expected)", "allOf": [ { - "$ref": "#/definitions/JsonRpcNotification_for_ClientNotification" + "$ref": "#/definitions/JsonRpcNotification" } ] }, @@ -31,14 +31,14 @@ "description": "Multiple requests sent together", "type": "array", "items": { - "$ref": "#/definitions/JsonRpcBatchRequestItem_for_ClientRequest_and_ClientNotification" + "$ref": "#/definitions/JsonRpcBatchRequestItem" } }, { "description": "Multiple responses sent together", "type": "array", "items": { - "$ref": "#/definitions/JsonRpcBatchResponseItem_for_ClientResult" + "$ref": "#/definitions/JsonRpcBatchResponseItem" } }, { @@ -51,101 +51,93 @@ } ], "definitions": { - "Annotated_for_RawContent": { + "Annotated": { "type": "object", + "properties": { + "annotations": { + "anyOf": [ + { + "$ref": "#/definitions/Annotations" + }, + { + "type": "null" + } + ] + } + }, "oneOf": [ { "type": "object", - "required": [ - "text", - "type" - ], "properties": { - "text": { - "type": "string" - }, "type": { "type": "string", - "enum": [ - "text" - ] + "const": "text" } - } + }, + "allOf": [ + { + "$ref": "#/definitions/RawTextContent" + } + ], + "required": [ + "type" + ] }, { "type": "object", - "required": [ - "data", - "mimeType", - "type" - ], "properties": { - "data": { - "description": "The base64-encoded image", - "type": "string" - }, - "mimeType": { - "type": "string" - }, "type": { "type": "string", - "enum": [ - "image" - ] + "const": "image" } - } + }, + "allOf": [ + { + "$ref": "#/definitions/RawImageContent" + } + ], + "required": [ + "type" + ] }, { "type": "object", - "required": [ - "resource", - "type" - ], "properties": { - "resource": { - "$ref": "#/definitions/ResourceContents" - }, "type": { "type": "string", - "enum": [ - "resource" - ] + "const": "resource" } - } + }, + "allOf": [ + { + "$ref": "#/definitions/RawEmbeddedResource" + } + ], + "required": [ + "type" + ] }, { "type": "object", - "required": [ - "data", - "mimeType", - "type" - ], "properties": { - "annotations": { - "anyOf": [ - { - "$ref": "#/definitions/Annotations" - }, - { - "type": "null" - } - ] - }, - "data": { - "type": "string" - }, - "mimeType": { - "type": "string" - }, "type": { "type": "string", - "enum": [ - "audio" - ] + "const": "audio" } - } + }, + "allOf": [ + { + "$ref": "#/definitions/Annotated2" + } + ], + "required": [ + "type" + ] } - ], + ] + }, + "Annotated2": { + "type": "object", "properties": { "annotations": { "anyOf": [ @@ -156,8 +148,18 @@ "type": "null" } ] + }, + "data": { + "type": "string" + }, + "mimeType": { + "type": "string" } - } + }, + "required": [ + "data", + "mimeType" + ] }, "Annotations": { "type": "object", @@ -189,10 +191,6 @@ }, "ArgumentInfo": { "type": "object", - "required": [ - "name", - "value" - ], "properties": { "name": { "type": "string" @@ -200,7 +198,11 @@ "value": { "type": "string" } - } + }, + "required": [ + "name", + "value" + ] }, "CallToolRequestMethod": { "type": "string", @@ -208,11 +210,8 @@ "const": "tools/call" }, "CallToolRequestParam": { - "description": "Parameters for calling a tool provided by an MCP server.\n\nContains the tool name and optional arguments needed to execute the tool operation.", + "description": "Parameters for calling a tool provided by an MCP server.\n\nContains the tool name and optional arguments needed to execute\nthe tool operation.", "type": "object", - "required": [ - "name" - ], "properties": { "arguments": { "description": "Arguments to pass to the tool (must match the tool's input schema)", @@ -226,7 +225,10 @@ "description": "The name of the tool to call", "type": "string" } - } + }, + "required": [ + "name" + ] }, "CancelledNotificationMethod": { "type": "string", @@ -235,9 +237,6 @@ }, "CancelledNotificationParam": { "type": "object", - "required": [ - "requestId" - ], "properties": { "reason": { "type": [ @@ -248,11 +247,14 @@ "requestId": { "$ref": "#/definitions/NumberOrString" } - } + }, + "required": [ + "requestId" + ] }, "ClientCapabilities": { "title": "Builder", - "description": "```rust # use rmcp::model::ClientCapabilities; let cap = ClientCapabilities::builder() .enable_experimental() .enable_roots() .enable_roots_list_changed() .build(); ```", + "description": "```rust\n# use rmcp::model::ClientCapabilities;\nlet cap = ClientCapabilities::builder()\n .enable_experimental()\n .enable_roots()\n .enable_roots_list_changed()\n .build();\n```", "type": "object", "properties": { "experimental": { @@ -304,10 +306,6 @@ }, "CompleteRequestParam": { "type": "object", - "required": [ - "argument", - "ref" - ], "properties": { "argument": { "$ref": "#/definitions/ArgumentInfo" @@ -315,22 +313,21 @@ "ref": { "$ref": "#/definitions/Reference" } - } + }, + "required": [ + "ref", + "argument" + ] }, "CreateMessageResult": { - "description": "The result of a sampling/createMessage request containing the generated response.\n\nThis structure contains the generated message along with metadata about how the generation was performed and why it stopped.", + "description": "The result of a sampling/createMessage request containing the generated response.\n\nThis structure contains the generated message along with metadata about\nhow the generation was performed and why it stopped.", "type": "object", - "required": [ - "content", - "model", - "role" - ], "properties": { "content": { "description": "The actual content of the message (text, image, etc.)", "allOf": [ { - "$ref": "#/definitions/Annotated_for_RawContent" + "$ref": "#/definitions/Annotated" } ] }, @@ -353,33 +350,46 @@ "null" ] } - } + }, + "required": [ + "model", + "role", + "content" + ] }, "EmptyObject": { "description": "This is commonly used for representing empty objects in MCP messages.\n\nwithout returning any specific data.", "type": "object" }, + "ErrorCode": { + "description": "Standard JSON-RPC error codes used throughout the MCP protocol.\n\nThese codes follow the JSON-RPC 2.0 specification and provide\nstandardized error reporting across all MCP implementations.", + "type": "integer", + "format": "int32" + }, "ErrorData": { - "description": "Error information for JSON-RPC error responses.\n\nThis structure follows the JSON-RPC 2.0 specification for error reporting, providing a standardized way to communicate errors between clients and servers.", + "description": "Error information for JSON-RPC error responses.\n\nThis structure follows the JSON-RPC 2.0 specification for error reporting,\nproviding a standardized way to communicate errors between clients and servers.", "type": "object", - "required": [ - "code", - "message" - ], "properties": { "code": { "description": "The error type that occurred (using standard JSON-RPC error codes)", - "type": "integer", - "format": "int32" + "allOf": [ + { + "$ref": "#/definitions/ErrorCode" + } + ] }, "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.)." + "description": "Additional information about the error. The value of this member is defined by the\nsender (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" } - } + }, + "required": [ + "code", + "message" + ] }, "GetPromptRequestMethod": { "type": "string", @@ -389,9 +399,6 @@ "GetPromptRequestParam": { "description": "Parameters for retrieving a specific prompt", "type": "object", - "required": [ - "name" - ], "properties": { "arguments": { "type": [ @@ -403,14 +410,13 @@ "name": { "type": "string" } - } + }, + "required": [ + "name" + ] }, "Implementation": { "type": "object", - "required": [ - "name", - "version" - ], "properties": { "name": { "type": "string" @@ -418,16 +424,15 @@ "version": { "type": "string" } - } + }, + "required": [ + "name", + "version" + ] }, "InitializeRequestParam": { - "description": "Parameters sent by a client when initializing a connection to an MCP server.\n\nThis contains the client's protocol version, capabilities, and implementation information, allowing the server to understand what the client supports.", + "description": "Parameters sent by a client when initializing a connection to an MCP server.\n\nThis contains the client's protocol version, capabilities, and implementation\ninformation, allowing the server to understand what the client supports.", "type": "object", - "required": [ - "capabilities", - "clientInfo", - "protocolVersion" - ], "properties": { "capabilities": { "description": "The capabilities this client supports (sampling, roots, etc.)", @@ -453,7 +458,12 @@ } ] } - } + }, + "required": [ + "protocolVersion", + "capabilities", + "clientInfo" + ] }, "InitializeResultMethod": { "type": "string", @@ -465,20 +475,20 @@ "format": "const", "const": "notifications/initialized" }, - "JsonRpcBatchRequestItem_for_ClientRequest_and_ClientNotification": { + "JsonRpcBatchRequestItem": { "anyOf": [ { - "$ref": "#/definitions/JsonRpcRequest_for_ClientRequest" + "$ref": "#/definitions/JsonRpcRequest" }, { - "$ref": "#/definitions/JsonRpcNotification_for_ClientNotification" + "$ref": "#/definitions/JsonRpcNotification" } ] }, - "JsonRpcBatchResponseItem_for_ClientResult": { + "JsonRpcBatchResponseItem": { "anyOf": [ { - "$ref": "#/definitions/JsonRpcResponse_for_ClientResult" + "$ref": "#/definitions/JsonRpcResponse" }, { "$ref": "#/definitions/JsonRpcError" @@ -487,11 +497,6 @@ }, "JsonRpcError": { "type": "object", - "required": [ - "error", - "id", - "jsonrpc" - ], "properties": { "error": { "$ref": "#/definitions/ErrorData" @@ -502,96 +507,96 @@ "jsonrpc": { "$ref": "#/definitions/JsonRpcVersion2_0" } - } + }, + "required": [ + "jsonrpc", + "id", + "error" + ] }, - "JsonRpcNotification_for_ClientNotification": { + "JsonRpcNotification": { "type": "object", + "properties": { + "jsonrpc": { + "$ref": "#/definitions/JsonRpcVersion2_0" + } + }, "anyOf": [ { - "$ref": "#/definitions/Notification_for_CancelledNotificationMethod_and_CancelledNotificationParam" + "$ref": "#/definitions/Notification" }, { - "$ref": "#/definitions/Notification_for_ProgressNotificationMethod_and_ProgressNotificationParam" + "$ref": "#/definitions/Notification2" }, { - "$ref": "#/definitions/NotificationNoParam_for_InitializedNotificationMethod" + "$ref": "#/definitions/NotificationNoParam" }, { - "$ref": "#/definitions/NotificationNoParam_for_RootsListChangedNotificationMethod" + "$ref": "#/definitions/NotificationNoParam2" } ], "required": [ "jsonrpc" - ], + ] + }, + "JsonRpcRequest": { + "type": "object", "properties": { + "id": { + "$ref": "#/definitions/NumberOrString" + }, "jsonrpc": { "$ref": "#/definitions/JsonRpcVersion2_0" } - } - }, - "JsonRpcRequest_for_ClientRequest": { - "type": "object", + }, "anyOf": [ { - "$ref": "#/definitions/RequestNoParam_for_PingRequestMethod" + "$ref": "#/definitions/RequestNoParam" }, { - "$ref": "#/definitions/Request_for_InitializeResultMethod_and_InitializeRequestParam" + "$ref": "#/definitions/Request" }, { - "$ref": "#/definitions/Request_for_CompleteRequestMethod_and_CompleteRequestParam" + "$ref": "#/definitions/Request2" }, { - "$ref": "#/definitions/Request_for_SetLevelRequestMethod_and_SetLevelRequestParam" + "$ref": "#/definitions/Request3" }, { - "$ref": "#/definitions/Request_for_GetPromptRequestMethod_and_GetPromptRequestParam" + "$ref": "#/definitions/Request4" }, { - "$ref": "#/definitions/RequestOptionalParam_for_ListPromptsRequestMethod_and_PaginatedRequestParam" + "$ref": "#/definitions/RequestOptionalParam" }, { - "$ref": "#/definitions/RequestOptionalParam_for_ListResourcesRequestMethod_and_PaginatedRequestParam" + "$ref": "#/definitions/RequestOptionalParam2" }, { - "$ref": "#/definitions/RequestOptionalParam_for_ListResourceTemplatesRequestMethod_and_PaginatedRequestParam" + "$ref": "#/definitions/RequestOptionalParam3" }, { - "$ref": "#/definitions/Request_for_ReadResourceRequestMethod_and_ReadResourceRequestParam" + "$ref": "#/definitions/Request5" }, { - "$ref": "#/definitions/Request_for_SubscribeRequestMethod_and_SubscribeRequestParam" + "$ref": "#/definitions/Request6" }, { - "$ref": "#/definitions/Request_for_UnsubscribeRequestMethod_and_UnsubscribeRequestParam" + "$ref": "#/definitions/Request7" }, { - "$ref": "#/definitions/Request_for_CallToolRequestMethod_and_CallToolRequestParam" + "$ref": "#/definitions/Request8" }, { - "$ref": "#/definitions/RequestOptionalParam_for_ListToolsRequestMethod_and_PaginatedRequestParam" + "$ref": "#/definitions/RequestOptionalParam4" } ], "required": [ - "id", - "jsonrpc" - ], - "properties": { - "id": { - "$ref": "#/definitions/NumberOrString" - }, - "jsonrpc": { - "$ref": "#/definitions/JsonRpcVersion2_0" - } - } + "jsonrpc", + "id" + ] }, - "JsonRpcResponse_for_ClientResult": { + "JsonRpcResponse": { "type": "object", - "required": [ - "id", - "jsonrpc", - "result" - ], "properties": { "id": { "$ref": "#/definitions/NumberOrString" @@ -602,7 +607,12 @@ "result": { "$ref": "#/definitions/ClientResult" } - } + }, + "required": [ + "jsonrpc", + "id", + "result" + ] }, "JsonRpcVersion2_0": { "type": "string", @@ -626,9 +636,6 @@ }, "ListRootsResult": { "type": "object", - "required": [ - "roots" - ], "properties": { "roots": { "type": "array", @@ -636,7 +643,10 @@ "$ref": "#/definitions/Root" } } - } + }, + "required": [ + "roots" + ] }, "ListToolsRequestMethod": { "type": "string", @@ -657,34 +667,8 @@ "emergency" ] }, - "NotificationNoParam_for_InitializedNotificationMethod": { - "type": "object", - "required": [ - "method" - ], - "properties": { - "method": { - "$ref": "#/definitions/InitializedNotificationMethod" - } - } - }, - "NotificationNoParam_for_RootsListChangedNotificationMethod": { - "type": "object", - "required": [ - "method" - ], - "properties": { - "method": { - "$ref": "#/definitions/RootsListChangedNotificationMethod" - } - } - }, - "Notification_for_CancelledNotificationMethod_and_CancelledNotificationParam": { + "Notification": { "type": "object", - "required": [ - "method", - "params" - ], "properties": { "method": { "$ref": "#/definitions/CancelledNotificationMethod" @@ -692,14 +676,14 @@ "params": { "$ref": "#/definitions/CancelledNotificationParam" } - } - }, - "Notification_for_ProgressNotificationMethod_and_ProgressNotificationParam": { - "type": "object", + }, "required": [ "method", "params" - ], + ] + }, + "Notification2": { + "type": "object", "properties": { "method": { "$ref": "#/definitions/ProgressNotificationMethod" @@ -707,15 +691,41 @@ "params": { "$ref": "#/definitions/ProgressNotificationParam" } - } + }, + "required": [ + "method", + "params" + ] }, - "NumberOrString": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" + "NotificationNoParam": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/InitializedNotificationMethod" + } + }, + "required": [ + "method" + ] + }, + "NotificationNoParam2": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/RootsListChangedNotificationMethod" + } + }, + "required": [ + "method" + ] + }, + "NumberOrString": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" } ] }, @@ -742,10 +752,6 @@ }, "ProgressNotificationParam": { "type": "object", - "required": [ - "progress", - "progressToken" - ], "properties": { "message": { "description": "An optional message describing the current progress.", @@ -758,10 +764,10 @@ "description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.", "type": "integer", "format": "uint32", - "minimum": 0.0 + "minimum": 0 }, "progressToken": { - "$ref": "#/definitions/NumberOrString" + "$ref": "#/definitions/ProgressToken" }, "total": { "description": "Total number of items to process (or total progress required), if known", @@ -770,14 +776,75 @@ "null" ], "format": "uint32", - "minimum": 0.0 + "minimum": 0 } - } + }, + "required": [ + "progressToken", + "progress" + ] + }, + "ProgressToken": { + "description": "A token used to track the progress of long-running operations.\n\nProgress tokens allow clients and servers to associate progress notifications\nwith specific requests, enabling real-time updates on operation status.", + "allOf": [ + { + "$ref": "#/definitions/NumberOrString" + } + ] + }, + "PromptReference": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] }, "ProtocolVersion": { - "description": "Represents the MCP protocol version used for communication.\n\nThis ensures compatibility between clients and servers by specifying which version of the Model Context Protocol is being used.", + "description": "Represents the MCP protocol version used for communication.\n\nThis ensures compatibility between clients and servers by specifying\nwhich version of the Model Context Protocol is being used.", "type": "string" }, + "RawEmbeddedResource": { + "type": "object", + "properties": { + "resource": { + "$ref": "#/definitions/ResourceContents" + } + }, + "required": [ + "resource" + ] + }, + "RawImageContent": { + "type": "object", + "properties": { + "data": { + "description": "The base64-encoded image", + "type": "string" + }, + "mimeType": { + "type": "string" + } + }, + "required": [ + "data", + "mimeType" + ] + }, + "RawTextContent": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + }, + "required": [ + "text" + ] + }, "ReadResourceRequestMethod": { "type": "string", "format": "const", @@ -786,287 +853,281 @@ "ReadResourceRequestParam": { "description": "Parameters for reading a specific resource", "type": "object", - "required": [ - "uri" - ], "properties": { "uri": { "description": "The URI of the resource to read", "type": "string" } - } + }, + "required": [ + "uri" + ] }, "Reference": { "oneOf": [ { "type": "object", - "required": [ - "type", - "uri" - ], "properties": { "type": { "type": "string", - "enum": [ - "ref/resource" - ] - }, - "uri": { - "type": "string" + "const": "ref/resource" } - } + }, + "allOf": [ + { + "$ref": "#/definitions/ResourceReference" + } + ], + "required": [ + "type" + ] }, { "type": "object", - "required": [ - "name", - "type" - ], "properties": { - "name": { - "type": "string" - }, "type": { "type": "string", - "enum": [ - "ref/prompt" - ] + "const": "ref/prompt" } - } + }, + "allOf": [ + { + "$ref": "#/definitions/PromptReference" + } + ], + "required": [ + "type" + ] } ] }, - "RequestNoParam_for_PingRequestMethod": { + "Request": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)", "type": "object", - "required": [ - "method" - ], "properties": { "method": { - "$ref": "#/definitions/PingRequestMethod" + "$ref": "#/definitions/InitializeResultMethod" + }, + "params": { + "$ref": "#/definitions/InitializeRequestParam" } - } + }, + "required": [ + "method", + "params" + ] }, - "RequestOptionalParam_for_ListPromptsRequestMethod_and_PaginatedRequestParam": { + "Request2": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)", "type": "object", - "required": [ - "method" - ], "properties": { "method": { - "$ref": "#/definitions/ListPromptsRequestMethod" + "$ref": "#/definitions/CompleteRequestMethod" }, "params": { - "anyOf": [ - { - "$ref": "#/definitions/PaginatedRequestParam" - }, - { - "type": "null" - } - ] + "$ref": "#/definitions/CompleteRequestParam" } - } + }, + "required": [ + "method", + "params" + ] }, - "RequestOptionalParam_for_ListResourceTemplatesRequestMethod_and_PaginatedRequestParam": { + "Request3": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)", "type": "object", - "required": [ - "method" - ], "properties": { "method": { - "$ref": "#/definitions/ListResourceTemplatesRequestMethod" + "$ref": "#/definitions/SetLevelRequestMethod" }, "params": { - "anyOf": [ - { - "$ref": "#/definitions/PaginatedRequestParam" - }, - { - "type": "null" - } - ] + "$ref": "#/definitions/SetLevelRequestParam" } - } + }, + "required": [ + "method", + "params" + ] }, - "RequestOptionalParam_for_ListResourcesRequestMethod_and_PaginatedRequestParam": { + "Request4": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)", "type": "object", - "required": [ - "method" - ], "properties": { "method": { - "$ref": "#/definitions/ListResourcesRequestMethod" + "$ref": "#/definitions/GetPromptRequestMethod" }, "params": { - "anyOf": [ - { - "$ref": "#/definitions/PaginatedRequestParam" - }, - { - "type": "null" - } - ] + "$ref": "#/definitions/GetPromptRequestParam" } - } + }, + "required": [ + "method", + "params" + ] }, - "RequestOptionalParam_for_ListToolsRequestMethod_and_PaginatedRequestParam": { + "Request5": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)", "type": "object", - "required": [ - "method" - ], "properties": { "method": { - "$ref": "#/definitions/ListToolsRequestMethod" + "$ref": "#/definitions/ReadResourceRequestMethod" }, "params": { - "anyOf": [ - { - "$ref": "#/definitions/PaginatedRequestParam" - }, - { - "type": "null" - } - ] + "$ref": "#/definitions/ReadResourceRequestParam" } - } - }, - "Request_for_CallToolRequestMethod_and_CallToolRequestParam": { - "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", - "type": "object", + }, "required": [ "method", "params" - ], + ] + }, + "Request6": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)", + "type": "object", "properties": { "method": { - "$ref": "#/definitions/CallToolRequestMethod" + "$ref": "#/definitions/SubscribeRequestMethod" }, "params": { - "$ref": "#/definitions/CallToolRequestParam" + "$ref": "#/definitions/SubscribeRequestParam" } - } - }, - "Request_for_CompleteRequestMethod_and_CompleteRequestParam": { - "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", - "type": "object", + }, "required": [ "method", "params" - ], + ] + }, + "Request7": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)", + "type": "object", "properties": { "method": { - "$ref": "#/definitions/CompleteRequestMethod" + "$ref": "#/definitions/UnsubscribeRequestMethod" }, "params": { - "$ref": "#/definitions/CompleteRequestParam" + "$ref": "#/definitions/UnsubscribeRequestParam" } - } - }, - "Request_for_GetPromptRequestMethod_and_GetPromptRequestParam": { - "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", - "type": "object", + }, "required": [ "method", "params" - ], + ] + }, + "Request8": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)", + "type": "object", "properties": { "method": { - "$ref": "#/definitions/GetPromptRequestMethod" + "$ref": "#/definitions/CallToolRequestMethod" }, "params": { - "$ref": "#/definitions/GetPromptRequestParam" + "$ref": "#/definitions/CallToolRequestParam" } - } - }, - "Request_for_InitializeResultMethod_and_InitializeRequestParam": { - "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", - "type": "object", + }, "required": [ "method", "params" - ], + ] + }, + "RequestNoParam": { + "type": "object", "properties": { "method": { - "$ref": "#/definitions/InitializeResultMethod" - }, - "params": { - "$ref": "#/definitions/InitializeRequestParam" + "$ref": "#/definitions/PingRequestMethod" } - } + }, + "required": [ + "method" + ] }, - "Request_for_ReadResourceRequestMethod_and_ReadResourceRequestParam": { - "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", + "RequestOptionalParam": { "type": "object", - "required": [ - "method", - "params" - ], "properties": { "method": { - "$ref": "#/definitions/ReadResourceRequestMethod" + "$ref": "#/definitions/ListPromptsRequestMethod" }, "params": { - "$ref": "#/definitions/ReadResourceRequestParam" + "anyOf": [ + { + "$ref": "#/definitions/PaginatedRequestParam" + }, + { + "type": "null" + } + ] } - } + }, + "required": [ + "method" + ] }, - "Request_for_SetLevelRequestMethod_and_SetLevelRequestParam": { - "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", + "RequestOptionalParam2": { "type": "object", - "required": [ - "method", - "params" - ], "properties": { "method": { - "$ref": "#/definitions/SetLevelRequestMethod" + "$ref": "#/definitions/ListResourcesRequestMethod" }, "params": { - "$ref": "#/definitions/SetLevelRequestParam" + "anyOf": [ + { + "$ref": "#/definitions/PaginatedRequestParam" + }, + { + "type": "null" + } + ] } - } + }, + "required": [ + "method" + ] }, - "Request_for_SubscribeRequestMethod_and_SubscribeRequestParam": { - "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", + "RequestOptionalParam3": { "type": "object", - "required": [ - "method", - "params" - ], "properties": { "method": { - "$ref": "#/definitions/SubscribeRequestMethod" + "$ref": "#/definitions/ListResourceTemplatesRequestMethod" }, "params": { - "$ref": "#/definitions/SubscribeRequestParam" + "anyOf": [ + { + "$ref": "#/definitions/PaginatedRequestParam" + }, + { + "type": "null" + } + ] } - } + }, + "required": [ + "method" + ] }, - "Request_for_UnsubscribeRequestMethod_and_UnsubscribeRequestParam": { - "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", + "RequestOptionalParam4": { "type": "object", - "required": [ - "method", - "params" - ], "properties": { "method": { - "$ref": "#/definitions/UnsubscribeRequestMethod" + "$ref": "#/definitions/ListToolsRequestMethod" }, "params": { - "$ref": "#/definitions/UnsubscribeRequestParam" + "anyOf": [ + { + "$ref": "#/definitions/PaginatedRequestParam" + }, + { + "type": "null" + } + ] } - } + }, + "required": [ + "method" + ] }, "ResourceContents": { "anyOf": [ { "type": "object", - "required": [ - "text", - "uri" - ], "properties": { "mime_type": { "type": [ @@ -1080,14 +1141,14 @@ "uri": { "type": "string" } - } + }, + "required": [ + "uri", + "text" + ] }, { "type": "object", - "required": [ - "blob", - "uri" - ], "properties": { "blob": { "type": "string" @@ -1101,34 +1162,42 @@ "uri": { "type": "string" } - } + }, + "required": [ + "uri", + "blob" + ] } ] }, + "ResourceReference": { + "type": "object", + "properties": { + "uri": { + "type": "string" + } + }, + "required": [ + "uri" + ] + }, "Role": { - "description": "Represents the role of a participant in a conversation or message exchange.\n\nUsed in sampling and chat contexts to distinguish between different types of message senders in the conversation flow.", + "description": "Represents the role of a participant in a conversation or message exchange.\n\nUsed in sampling and chat contexts to distinguish between different\ntypes of message senders in the conversation flow.", "oneOf": [ { "description": "A human user or client making a request", "type": "string", - "enum": [ - "user" - ] + "const": "user" }, { "description": "An AI assistant or server providing a response", "type": "string", - "enum": [ - "assistant" - ] + "const": "assistant" } ] }, "Root": { "type": "object", - "required": [ - "uri" - ], "properties": { "name": { "type": [ @@ -1139,7 +1208,10 @@ "uri": { "type": "string" } - } + }, + "required": [ + "uri" + ] }, "RootsCapabilities": { "type": "object", @@ -1165,9 +1237,6 @@ "SetLevelRequestParam": { "description": "Parameters for setting the logging level", "type": "object", - "required": [ - "level" - ], "properties": { "level": { "description": "The desired logging level", @@ -1177,7 +1246,10 @@ } ] } - } + }, + "required": [ + "level" + ] }, "SubscribeRequestMethod": { "type": "string", @@ -1187,15 +1259,15 @@ "SubscribeRequestParam": { "description": "Parameters for subscribing to resource updates", "type": "object", - "required": [ - "uri" - ], "properties": { "uri": { "description": "The URI of the resource to subscribe to", "type": "string" } - } + }, + "required": [ + "uri" + ] }, "UnsubscribeRequestMethod": { "type": "string", @@ -1205,15 +1277,15 @@ "UnsubscribeRequestParam": { "description": "Parameters for unsubscribing from resource updates", "type": "object", - "required": [ - "uri" - ], "properties": { "uri": { "description": "The URI of the resource to unsubscribe from", "type": "string" } - } + }, + "required": [ + "uri" + ] } } } \ No newline at end of file diff --git a/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json b/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json index 3535c73b..5cac39cb 100644 --- a/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json +++ b/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json @@ -1,13 +1,13 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "JsonRpcMessage_for_ServerRequest_and_ServerResult_and_ServerNotification", - "description": "Represents any JSON-RPC message that can be sent or received.\n\nThis enum covers all possible message types in the JSON-RPC protocol: individual requests/responses, notifications, batch operations, and errors. It serves as the top-level message container for MCP communication.", + "title": "JsonRpcMessage", + "description": "Represents any JSON-RPC message that can be sent or received.\n\nThis enum covers all possible message types in the JSON-RPC protocol:\nindividual requests/responses, notifications, batch operations, and errors.\nIt serves as the top-level message container for MCP communication.", "anyOf": [ { "description": "A single request expecting a response", "allOf": [ { - "$ref": "#/definitions/JsonRpcRequest_for_ServerRequest" + "$ref": "#/definitions/JsonRpcRequest" } ] }, @@ -15,7 +15,7 @@ "description": "A response to a previous request", "allOf": [ { - "$ref": "#/definitions/JsonRpcResponse_for_ServerResult" + "$ref": "#/definitions/JsonRpcResponse" } ] }, @@ -23,7 +23,7 @@ "description": "A one-way notification (no response expected)", "allOf": [ { - "$ref": "#/definitions/JsonRpcNotification_for_ServerNotification" + "$ref": "#/definitions/JsonRpcNotification" } ] }, @@ -31,14 +31,14 @@ "description": "Multiple requests sent together", "type": "array", "items": { - "$ref": "#/definitions/JsonRpcBatchRequestItem_for_ServerRequest_and_ServerNotification" + "$ref": "#/definitions/JsonRpcBatchRequestItem" } }, { "description": "Multiple responses sent together", "type": "array", "items": { - "$ref": "#/definitions/JsonRpcBatchResponseItem_for_ServerResult" + "$ref": "#/definitions/JsonRpcBatchResponseItem" } }, { @@ -51,101 +51,93 @@ } ], "definitions": { - "Annotated_for_RawContent": { + "Annotated": { "type": "object", + "properties": { + "annotations": { + "anyOf": [ + { + "$ref": "#/definitions/Annotations" + }, + { + "type": "null" + } + ] + } + }, "oneOf": [ { "type": "object", - "required": [ - "text", - "type" - ], "properties": { - "text": { - "type": "string" - }, "type": { "type": "string", - "enum": [ - "text" - ] + "const": "text" } - } + }, + "allOf": [ + { + "$ref": "#/definitions/RawTextContent" + } + ], + "required": [ + "type" + ] }, { "type": "object", - "required": [ - "data", - "mimeType", - "type" - ], "properties": { - "data": { - "description": "The base64-encoded image", - "type": "string" - }, - "mimeType": { - "type": "string" - }, "type": { "type": "string", - "enum": [ - "image" - ] + "const": "image" } - } + }, + "allOf": [ + { + "$ref": "#/definitions/RawImageContent" + } + ], + "required": [ + "type" + ] }, { "type": "object", - "required": [ - "resource", - "type" - ], "properties": { - "resource": { - "$ref": "#/definitions/ResourceContents" - }, "type": { "type": "string", - "enum": [ - "resource" - ] + "const": "resource" } - } + }, + "allOf": [ + { + "$ref": "#/definitions/RawEmbeddedResource" + } + ], + "required": [ + "type" + ] }, { "type": "object", - "required": [ - "data", - "mimeType", - "type" - ], "properties": { - "annotations": { - "anyOf": [ - { - "$ref": "#/definitions/Annotations" - }, - { - "type": "null" - } - ] - }, - "data": { - "type": "string" - }, - "mimeType": { - "type": "string" - }, "type": { "type": "string", - "enum": [ - "audio" - ] + "const": "audio" } - } + }, + "allOf": [ + { + "$ref": "#/definitions/Annotated2" + } + ], + "required": [ + "type" + ] } - ], + ] + }, + "Annotated2": { + "type": "object", "properties": { "annotations": { "anyOf": [ @@ -156,14 +148,21 @@ "type": "null" } ] + }, + "data": { + "type": "string" + }, + "mimeType": { + "type": "string" } - } + }, + "required": [ + "data", + "mimeType" + ] }, - "Annotated_for_RawEmbeddedResource": { + "Annotated3": { "type": "object", - "required": [ - "resource" - ], "properties": { "annotations": { "anyOf": [ @@ -178,15 +177,14 @@ "resource": { "$ref": "#/definitions/ResourceContents" } - } + }, + "required": [ + "resource" + ] }, - "Annotated_for_RawResource": { + "Annotated4": { "description": "Represents a resource in the extension with metadata", "type": "object", - "required": [ - "name", - "uri" - ], "properties": { "annotations": { "anyOf": [ @@ -223,20 +221,20 @@ "null" ], "format": "uint32", - "minimum": 0.0 + "minimum": 0 }, "uri": { "description": "URI representing the resource location (e.g., \"file:///path/to/file\" or \"str:///content\")", "type": "string" } - } + }, + "required": [ + "uri", + "name" + ] }, - "Annotated_for_RawResourceTemplate": { + "Annotated5": { "type": "object", - "required": [ - "name", - "uriTemplate" - ], "properties": { "annotations": { "anyOf": [ @@ -266,7 +264,11 @@ "uriTemplate": { "type": "string" } - } + }, + "required": [ + "uriTemplate", + "name" + ] }, "Annotations": { "type": "object", @@ -297,17 +299,14 @@ } }, "CallToolResult": { - "description": "The result of a tool call operation.\n\nContains the content returned by the tool execution and an optional flag indicating whether the operation resulted in an error.", + "description": "The result of a tool call operation.\n\nContains the content returned by the tool execution and an optional\nflag indicating whether the operation resulted in an error.", "type": "object", - "required": [ - "content" - ], "properties": { "content": { "description": "The content returned by the tool (text, images, etc.)", "type": "array", "items": { - "$ref": "#/definitions/Annotated_for_RawContent" + "$ref": "#/definitions/Annotated" } }, "isError": { @@ -317,7 +316,10 @@ "null" ] } - } + }, + "required": [ + "content" + ] }, "CancelledNotificationMethod": { "type": "string", @@ -326,9 +328,6 @@ }, "CancelledNotificationParam": { "type": "object", - "required": [ - "requestId" - ], "properties": { "reason": { "type": [ @@ -339,24 +338,24 @@ "requestId": { "$ref": "#/definitions/NumberOrString" } - } + }, + "required": [ + "requestId" + ] }, "CompleteResult": { "type": "object", - "required": [ - "completion" - ], "properties": { "completion": { "$ref": "#/definitions/CompletionInfo" } - } + }, + "required": [ + "completion" + ] }, "CompletionInfo": { "type": "object", - "required": [ - "values" - ], "properties": { "hasMore": { "type": [ @@ -370,7 +369,7 @@ "null" ], "format": "uint32", - "minimum": 0.0 + "minimum": 0 }, "values": { "type": "array", @@ -378,31 +377,28 @@ "type": "string" } } - } + }, + "required": [ + "values" + ] }, "ContextInclusion": { - "description": "Specifies how much context should be included in sampling requests.\n\nThis allows clients to control what additional context information should be provided to the LLM when processing sampling requests.", + "description": "Specifies how much context should be included in sampling requests.\n\nThis allows clients to control what additional context information\nshould be provided to the LLM when processing sampling requests.", "oneOf": [ { "description": "Include context from all connected MCP servers", "type": "string", - "enum": [ - "allServers" - ] + "const": "allServers" }, { "description": "Include no additional context", "type": "string", - "enum": [ - "none" - ] + "const": "none" }, { "description": "Include context only from the requesting server", "type": "string", - "enum": [ - "thisServer" - ] + "const": "thisServer" } ] }, @@ -412,12 +408,8 @@ "const": "sampling/createMessage" }, "CreateMessageRequestParam": { - "description": "Parameters for creating a message through LLM sampling.\n\nThis structure contains all the necessary information for a client to generate an LLM response, including conversation history, model preferences, and generation parameters.", + "description": "Parameters for creating a message through LLM sampling.\n\nThis structure contains all the necessary information for a client to\ngenerate an LLM response, including conversation history, model preferences,\nand generation parameters.", "type": "object", - "required": [ - "maxTokens", - "messages" - ], "properties": { "includeContext": { "description": "How much context to include from MCP servers", @@ -434,7 +426,7 @@ "description": "Maximum number of tokens to generate", "type": "integer", "format": "uint32", - "minimum": 0.0 + "minimum": 0 }, "messages": { "description": "The conversation history and current messages", @@ -482,39 +474,48 @@ ], "format": "float" } - } + }, + "required": [ + "messages", + "maxTokens" + ] }, "EmptyObject": { "description": "This is commonly used for representing empty objects in MCP messages.\n\nwithout returning any specific data.", "type": "object" }, + "ErrorCode": { + "description": "Standard JSON-RPC error codes used throughout the MCP protocol.\n\nThese codes follow the JSON-RPC 2.0 specification and provide\nstandardized error reporting across all MCP implementations.", + "type": "integer", + "format": "int32" + }, "ErrorData": { - "description": "Error information for JSON-RPC error responses.\n\nThis structure follows the JSON-RPC 2.0 specification for error reporting, providing a standardized way to communicate errors between clients and servers.", + "description": "Error information for JSON-RPC error responses.\n\nThis structure follows the JSON-RPC 2.0 specification for error reporting,\nproviding a standardized way to communicate errors between clients and servers.", "type": "object", - "required": [ - "code", - "message" - ], "properties": { "code": { "description": "The error type that occurred (using standard JSON-RPC error codes)", - "type": "integer", - "format": "int32" + "allOf": [ + { + "$ref": "#/definitions/ErrorCode" + } + ] }, "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.)." + "description": "Additional information about the error. The value of this member is defined by the\nsender (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" } - } + }, + "required": [ + "code", + "message" + ] }, "GetPromptResult": { "type": "object", - "required": [ - "messages" - ], "properties": { "description": { "type": [ @@ -528,14 +529,13 @@ "$ref": "#/definitions/PromptMessage" } } - } + }, + "required": [ + "messages" + ] }, "Implementation": { "type": "object", - "required": [ - "name", - "version" - ], "properties": { "name": { "type": "string" @@ -543,16 +543,15 @@ "version": { "type": "string" } - } + }, + "required": [ + "name", + "version" + ] }, "InitializeResult": { - "description": "The server's response to an initialization request.\n\nContains the server's protocol version, capabilities, and implementation information, along with optional instructions for the client.", + "description": "The server's response to an initialization request.\n\nContains the server's protocol version, capabilities, and implementation\ninformation, along with optional instructions for the client.", "type": "object", - "required": [ - "capabilities", - "protocolVersion", - "serverInfo" - ], "properties": { "capabilities": { "description": "The capabilities this server provides (tools, resources, prompts, etc.)", @@ -585,22 +584,27 @@ } ] } - } + }, + "required": [ + "protocolVersion", + "capabilities", + "serverInfo" + ] }, - "JsonRpcBatchRequestItem_for_ServerRequest_and_ServerNotification": { + "JsonRpcBatchRequestItem": { "anyOf": [ { - "$ref": "#/definitions/JsonRpcRequest_for_ServerRequest" + "$ref": "#/definitions/JsonRpcRequest" }, { - "$ref": "#/definitions/JsonRpcNotification_for_ServerNotification" + "$ref": "#/definitions/JsonRpcNotification" } ] }, - "JsonRpcBatchResponseItem_for_ServerResult": { + "JsonRpcBatchResponseItem": { "anyOf": [ { - "$ref": "#/definitions/JsonRpcResponse_for_ServerResult" + "$ref": "#/definitions/JsonRpcResponse" }, { "$ref": "#/definitions/JsonRpcError" @@ -609,11 +613,6 @@ }, "JsonRpcError": { "type": "object", - "required": [ - "error", - "id", - "jsonrpc" - ], "properties": { "error": { "$ref": "#/definitions/ErrorData" @@ -624,75 +623,75 @@ "jsonrpc": { "$ref": "#/definitions/JsonRpcVersion2_0" } - } + }, + "required": [ + "jsonrpc", + "id", + "error" + ] }, - "JsonRpcNotification_for_ServerNotification": { + "JsonRpcNotification": { "type": "object", + "properties": { + "jsonrpc": { + "$ref": "#/definitions/JsonRpcVersion2_0" + } + }, "anyOf": [ { - "$ref": "#/definitions/Notification_for_CancelledNotificationMethod_and_CancelledNotificationParam" + "$ref": "#/definitions/Notification" }, { - "$ref": "#/definitions/Notification_for_ProgressNotificationMethod_and_ProgressNotificationParam" + "$ref": "#/definitions/Notification2" }, { - "$ref": "#/definitions/Notification_for_LoggingMessageNotificationMethod_and_LoggingMessageNotificationParam" + "$ref": "#/definitions/Notification3" }, { - "$ref": "#/definitions/Notification_for_ResourceUpdatedNotificationMethod_and_ResourceUpdatedNotificationParam" + "$ref": "#/definitions/Notification4" }, { - "$ref": "#/definitions/NotificationNoParam_for_ResourceListChangedNotificationMethod" + "$ref": "#/definitions/NotificationNoParam" }, { - "$ref": "#/definitions/NotificationNoParam_for_ToolListChangedNotificationMethod" + "$ref": "#/definitions/NotificationNoParam2" }, { - "$ref": "#/definitions/NotificationNoParam_for_PromptListChangedNotificationMethod" + "$ref": "#/definitions/NotificationNoParam3" } ], "required": [ "jsonrpc" - ], + ] + }, + "JsonRpcRequest": { + "type": "object", "properties": { + "id": { + "$ref": "#/definitions/NumberOrString" + }, "jsonrpc": { "$ref": "#/definitions/JsonRpcVersion2_0" } - } - }, - "JsonRpcRequest_for_ServerRequest": { - "type": "object", + }, "anyOf": [ { - "$ref": "#/definitions/RequestNoParam_for_PingRequestMethod" + "$ref": "#/definitions/RequestNoParam" }, { - "$ref": "#/definitions/Request_for_CreateMessageRequestMethod_and_CreateMessageRequestParam" + "$ref": "#/definitions/Request" }, { - "$ref": "#/definitions/RequestNoParam_for_ListRootsRequestMethod" + "$ref": "#/definitions/RequestNoParam2" } ], "required": [ - "id", - "jsonrpc" - ], - "properties": { - "id": { - "$ref": "#/definitions/NumberOrString" - }, - "jsonrpc": { - "$ref": "#/definitions/JsonRpcVersion2_0" - } - } + "jsonrpc", + "id" + ] }, - "JsonRpcResponse_for_ServerResult": { + "JsonRpcResponse": { "type": "object", - "required": [ - "id", - "jsonrpc", - "result" - ], "properties": { "id": { "$ref": "#/definitions/NumberOrString" @@ -703,7 +702,12 @@ "result": { "$ref": "#/definitions/ServerResult" } - } + }, + "required": [ + "jsonrpc", + "id", + "result" + ] }, "JsonRpcVersion2_0": { "type": "string", @@ -712,9 +716,6 @@ }, "ListPromptsResult": { "type": "object", - "required": [ - "prompts" - ], "properties": { "nextCursor": { "type": [ @@ -728,13 +729,13 @@ "$ref": "#/definitions/Prompt" } } - } + }, + "required": [ + "prompts" + ] }, "ListResourceTemplatesResult": { "type": "object", - "required": [ - "resourceTemplates" - ], "properties": { "nextCursor": { "type": [ @@ -745,16 +746,16 @@ "resourceTemplates": { "type": "array", "items": { - "$ref": "#/definitions/Annotated_for_RawResourceTemplate" + "$ref": "#/definitions/Annotated5" } } - } + }, + "required": [ + "resourceTemplates" + ] }, "ListResourcesResult": { "type": "object", - "required": [ - "resources" - ], "properties": { "nextCursor": { "type": [ @@ -765,10 +766,13 @@ "resources": { "type": "array", "items": { - "$ref": "#/definitions/Annotated_for_RawResource" + "$ref": "#/definitions/Annotated4" } } - } + }, + "required": [ + "resources" + ] }, "ListRootsRequestMethod": { "type": "string", @@ -777,9 +781,6 @@ }, "ListToolsResult": { "type": "object", - "required": [ - "tools" - ], "properties": { "nextCursor": { "type": [ @@ -793,7 +794,10 @@ "$ref": "#/definitions/Tool" } } - } + }, + "required": [ + "tools" + ] }, "LoggingLevel": { "description": "Logging levels supported by the MCP protocol", @@ -817,10 +821,6 @@ "LoggingMessageNotificationParam": { "description": "Parameters for a logging message notification", "type": "object", - "required": [ - "data", - "level" - ], "properties": { "data": { "description": "The actual log data" @@ -840,10 +840,14 @@ "null" ] } - } + }, + "required": [ + "level", + "data" + ] }, "ModelHint": { - "description": "A hint suggesting a preferred model name or family.\n\nModel hints are advisory suggestions that help clients choose appropriate models. They can be specific model names or general families like \"claude\" or \"gpt\".", + "description": "A hint suggesting a preferred model name or family.\n\nModel hints are advisory suggestions that help clients choose appropriate\nmodels. They can be specific model names or general families like \"claude\" or \"gpt\".", "type": "object", "properties": { "name": { @@ -856,7 +860,7 @@ } }, "ModelPreferences": { - "description": "Preferences for model selection and behavior in sampling requests.\n\nThis allows servers to express their preferences for which model to use and how to balance different priorities when the client has multiple model options available.", + "description": "Preferences for model selection and behavior in sampling requests.\n\nThis allows servers to express their preferences for which model to use\nand how to balance different priorities when the client has multiple\nmodel options available.", "type": "object", "properties": { "costPriority": { @@ -895,98 +899,98 @@ } } }, - "NotificationNoParam_for_PromptListChangedNotificationMethod": { + "Notification": { "type": "object", - "required": [ - "method" - ], "properties": { "method": { - "$ref": "#/definitions/PromptListChangedNotificationMethod" + "$ref": "#/definitions/CancelledNotificationMethod" + }, + "params": { + "$ref": "#/definitions/CancelledNotificationParam" } - } - }, - "NotificationNoParam_for_ResourceListChangedNotificationMethod": { - "type": "object", + }, "required": [ - "method" - ], - "properties": { - "method": { - "$ref": "#/definitions/ResourceListChangedNotificationMethod" - } - } + "method", + "params" + ] }, - "NotificationNoParam_for_ToolListChangedNotificationMethod": { + "Notification2": { "type": "object", - "required": [ - "method" - ], "properties": { "method": { - "$ref": "#/definitions/ToolListChangedNotificationMethod" + "$ref": "#/definitions/ProgressNotificationMethod" + }, + "params": { + "$ref": "#/definitions/ProgressNotificationParam" } - } - }, - "Notification_for_CancelledNotificationMethod_and_CancelledNotificationParam": { - "type": "object", + }, "required": [ "method", "params" - ], + ] + }, + "Notification3": { + "type": "object", "properties": { "method": { - "$ref": "#/definitions/CancelledNotificationMethod" + "$ref": "#/definitions/LoggingMessageNotificationMethod" }, "params": { - "$ref": "#/definitions/CancelledNotificationParam" + "$ref": "#/definitions/LoggingMessageNotificationParam" } - } - }, - "Notification_for_LoggingMessageNotificationMethod_and_LoggingMessageNotificationParam": { - "type": "object", + }, "required": [ "method", "params" - ], + ] + }, + "Notification4": { + "type": "object", "properties": { "method": { - "$ref": "#/definitions/LoggingMessageNotificationMethod" + "$ref": "#/definitions/ResourceUpdatedNotificationMethod" }, "params": { - "$ref": "#/definitions/LoggingMessageNotificationParam" + "$ref": "#/definitions/ResourceUpdatedNotificationParam" } - } - }, - "Notification_for_ProgressNotificationMethod_and_ProgressNotificationParam": { - "type": "object", + }, "required": [ "method", "params" - ], + ] + }, + "NotificationNoParam": { + "type": "object", "properties": { "method": { - "$ref": "#/definitions/ProgressNotificationMethod" - }, - "params": { - "$ref": "#/definitions/ProgressNotificationParam" + "$ref": "#/definitions/ResourceListChangedNotificationMethod" } - } + }, + "required": [ + "method" + ] }, - "Notification_for_ResourceUpdatedNotificationMethod_and_ResourceUpdatedNotificationParam": { + "NotificationNoParam2": { "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/ToolListChangedNotificationMethod" + } + }, "required": [ - "method", - "params" - ], + "method" + ] + }, + "NotificationNoParam3": { + "type": "object", "properties": { "method": { - "$ref": "#/definitions/ResourceUpdatedNotificationMethod" - }, - "params": { - "$ref": "#/definitions/ResourceUpdatedNotificationParam" + "$ref": "#/definitions/PromptListChangedNotificationMethod" } - } + }, + "required": [ + "method" + ] }, "NumberOrString": { "oneOf": [ @@ -1010,10 +1014,6 @@ }, "ProgressNotificationParam": { "type": "object", - "required": [ - "progress", - "progressToken" - ], "properties": { "message": { "description": "An optional message describing the current progress.", @@ -1026,10 +1026,10 @@ "description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.", "type": "integer", "format": "uint32", - "minimum": 0.0 + "minimum": 0 }, "progressToken": { - "$ref": "#/definitions/NumberOrString" + "$ref": "#/definitions/ProgressToken" }, "total": { "description": "Total number of items to process (or total progress required), if known", @@ -1038,16 +1038,25 @@ "null" ], "format": "uint32", - "minimum": 0.0 + "minimum": 0 } - } + }, + "required": [ + "progressToken", + "progress" + ] + }, + "ProgressToken": { + "description": "A token used to track the progress of long-running operations.\n\nProgress tokens allow clients and servers to associate progress notifications\nwith specific requests, enabling real-time updates on operation status.", + "allOf": [ + { + "$ref": "#/definitions/NumberOrString" + } + ] }, "Prompt": { "description": "A prompt that can be used to generate text from a model", "type": "object", - "required": [ - "name" - ], "properties": { "arguments": { "description": "Optional arguments that can be passed to customize the prompt", @@ -1070,14 +1079,14 @@ "description": "The name of the prompt", "type": "string" } - } + }, + "required": [ + "name" + ] }, "PromptArgument": { "description": "Represents a prompt argument that can be passed to customize the prompt", "type": "object", - "required": [ - "name" - ], "properties": { "description": { "description": "A description of what the argument is used for", @@ -1097,7 +1106,10 @@ "null" ] } - } + }, + "required": [ + "name" + ] }, "PromptListChangedNotificationMethod": { "type": "string", @@ -1107,10 +1119,6 @@ "PromptMessage": { "description": "A message in a prompt conversation", "type": "object", - "required": [ - "content", - "role" - ], "properties": { "content": { "description": "The content of the message", @@ -1128,7 +1136,11 @@ } ] } - } + }, + "required": [ + "role", + "content" + ] }, "PromptMessageContent": { "description": "Content types that can be included in prompt messages", @@ -1136,30 +1148,23 @@ { "description": "Plain text content", "type": "object", - "required": [ - "text", - "type" - ], "properties": { "text": { "type": "string" }, "type": { "type": "string", - "enum": [ - "text" - ] + "const": "text" } - } + }, + "required": [ + "type", + "text" + ] }, { "description": "Image content with base64-encoded data", "type": "object", - "required": [ - "data", - "mimeType", - "type" - ], "properties": { "annotations": { "anyOf": [ @@ -1180,30 +1185,31 @@ }, "type": { "type": "string", - "enum": [ - "image" - ] + "const": "image" } - } + }, + "required": [ + "type", + "data", + "mimeType" + ] }, { "description": "Embedded server-side resource", "type": "object", - "required": [ - "resource", - "type" - ], "properties": { "resource": { - "$ref": "#/definitions/Annotated_for_RawEmbeddedResource" + "$ref": "#/definitions/Annotated3" }, "type": { "type": "string", - "enum": [ - "resource" - ] + "const": "resource" } - } + }, + "required": [ + "type", + "resource" + ] } ] }, @@ -1227,15 +1233,50 @@ } }, "ProtocolVersion": { - "description": "Represents the MCP protocol version used for communication.\n\nThis ensures compatibility between clients and servers by specifying which version of the Model Context Protocol is being used.", + "description": "Represents the MCP protocol version used for communication.\n\nThis ensures compatibility between clients and servers by specifying\nwhich version of the Model Context Protocol is being used.", "type": "string" }, + "RawEmbeddedResource": { + "type": "object", + "properties": { + "resource": { + "$ref": "#/definitions/ResourceContents" + } + }, + "required": [ + "resource" + ] + }, + "RawImageContent": { + "type": "object", + "properties": { + "data": { + "description": "The base64-encoded image", + "type": "string" + }, + "mimeType": { + "type": "string" + } + }, + "required": [ + "data", + "mimeType" + ] + }, + "RawTextContent": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + }, + "required": [ + "text" + ] + }, "ReadResourceResult": { "description": "Result containing the contents of a read resource", "type": "object", - "required": [ - "contents" - ], "properties": { "contents": { "description": "The actual content of the resource", @@ -1244,54 +1285,53 @@ "$ref": "#/definitions/ResourceContents" } } - } + }, + "required": [ + "contents" + ] }, - "RequestNoParam_for_ListRootsRequestMethod": { + "Request": { + "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)", "type": "object", - "required": [ - "method" - ], "properties": { "method": { - "$ref": "#/definitions/ListRootsRequestMethod" + "$ref": "#/definitions/CreateMessageRequestMethod" + }, + "params": { + "$ref": "#/definitions/CreateMessageRequestParam" } - } + }, + "required": [ + "method", + "params" + ] }, - "RequestNoParam_for_PingRequestMethod": { + "RequestNoParam": { "type": "object", - "required": [ - "method" - ], "properties": { "method": { "$ref": "#/definitions/PingRequestMethod" } - } + }, + "required": [ + "method" + ] }, - "Request_for_CreateMessageRequestMethod_and_CreateMessageRequestParam": { - "description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing: - `method`: The name of the method being called - `params`: The parameters for the method - `extensions`: Additional context data (similar to HTTP headers)", + "RequestNoParam2": { "type": "object", - "required": [ - "method", - "params" - ], "properties": { "method": { - "$ref": "#/definitions/CreateMessageRequestMethod" - }, - "params": { - "$ref": "#/definitions/CreateMessageRequestParam" + "$ref": "#/definitions/ListRootsRequestMethod" } - } + }, + "required": [ + "method" + ] }, "ResourceContents": { "anyOf": [ { "type": "object", - "required": [ - "text", - "uri" - ], "properties": { "mime_type": { "type": [ @@ -1305,14 +1345,14 @@ "uri": { "type": "string" } - } + }, + "required": [ + "uri", + "text" + ] }, { "type": "object", - "required": [ - "blob", - "uri" - ], "properties": { "blob": { "type": "string" @@ -1326,7 +1366,11 @@ "uri": { "type": "string" } - } + }, + "required": [ + "uri", + "blob" + ] } ] }, @@ -1343,15 +1387,15 @@ "ResourceUpdatedNotificationParam": { "description": "Parameters for a resource update notification", "type": "object", - "required": [ - "uri" - ], "properties": { "uri": { "description": "The URI of the resource that was updated", "type": "string" } - } + }, + "required": [ + "uri" + ] }, "ResourcesCapability": { "type": "object", @@ -1371,37 +1415,29 @@ } }, "Role": { - "description": "Represents the role of a participant in a conversation or message exchange.\n\nUsed in sampling and chat contexts to distinguish between different types of message senders in the conversation flow.", + "description": "Represents the role of a participant in a conversation or message exchange.\n\nUsed in sampling and chat contexts to distinguish between different\ntypes of message senders in the conversation flow.", "oneOf": [ { "description": "A human user or client making a request", "type": "string", - "enum": [ - "user" - ] + "const": "user" }, { "description": "An AI assistant or server providing a response", "type": "string", - "enum": [ - "assistant" - ] + "const": "assistant" } ] }, "SamplingMessage": { - "description": "A message in a sampling conversation, containing a role and content.\n\nThis represents a single message in a conversation flow, used primarily in LLM sampling requests where the conversation history is important for generating appropriate responses.", + "description": "A message in a sampling conversation, containing a role and content.\n\nThis represents a single message in a conversation flow, used primarily\nin LLM sampling requests where the conversation history is important\nfor generating appropriate responses.", "type": "object", - "required": [ - "content", - "role" - ], "properties": { "content": { "description": "The actual content of the message (text, image, etc.)", "allOf": [ { - "$ref": "#/definitions/Annotated_for_RawContent" + "$ref": "#/definitions/Annotated" } ] }, @@ -1413,11 +1449,15 @@ } ] } - } + }, + "required": [ + "role", + "content" + ] }, "ServerCapabilities": { "title": "Builder", - "description": "```rust # use rmcp::model::ServerCapabilities; let cap = ServerCapabilities::builder() .enable_logging() .enable_experimental() .enable_prompts() .enable_resources() .enable_tools() .enable_tool_list_changed() .build(); ```", + "description": "```rust\n# use rmcp::model::ServerCapabilities;\nlet cap = ServerCapabilities::builder()\n .enable_logging()\n .enable_experimental()\n .enable_prompts()\n .enable_resources()\n .enable_tools()\n .enable_tool_list_changed()\n .build();\n```", "type": "object", "properties": { "completions": { @@ -1513,10 +1553,6 @@ "Tool": { "description": "A tool that can be used by a model.", "type": "object", - "required": [ - "inputSchema", - "name" - ], "properties": { "annotations": { "description": "Optional additional tool information.", @@ -1545,28 +1581,32 @@ "description": "The name of the tool", "type": "string" } - } + }, + "required": [ + "name", + "inputSchema" + ] }, "ToolAnnotations": { - "description": "Additional properties describing a Tool to clients.\n\nNOTE: all properties in ToolAnnotations are **hints**. They are not guaranteed to provide a faithful description of tool behavior (including descriptive properties like `title`).\n\nClients should never make tool use decisions based on ToolAnnotations received 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": { - "description": "If true, the tool may perform destructive updates to its environment. If false, the tool performs only additive updates.\n\n(This property is meaningful only when `readOnlyHint == false`)\n\nDefault: true A human-readable description of the tool's purpose.", + "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\nA human-readable description of the tool's purpose.", "type": [ "boolean", "null" ] }, "idempotentHint": { - "description": "If true, calling the tool repeatedly with the same arguments will 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", "null" ] }, "openWorldHint": { - "description": "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.\n\nDefault: true", + "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", "null"