diff --git a/crates/rmcp/src/model.rs b/crates/rmcp/src/model.rs index 45764f803..c61cbee1e 100644 --- a/crates/rmcp/src/model.rs +++ b/crates/rmcp/src/model.rs @@ -149,6 +149,7 @@ impl ProtocolVersion { pub const V_2025_06_18: Self = Self(Cow::Borrowed("2025-06-18")); pub const V_2025_03_26: Self = Self(Cow::Borrowed("2025-03-26")); pub const V_2024_11_05: Self = Self(Cow::Borrowed("2024-11-05")); + // Keep LATEST at 2025-03-26 until full 2025-06-18 compliance and automated testing are in place. pub const LATEST: Self = Self::V_2025_03_26; } diff --git a/crates/rmcp/src/model/annotated.rs b/crates/rmcp/src/model/annotated.rs index d0f53f75b..f9921146a 100644 --- a/crates/rmcp/src/model/annotated.rs +++ b/crates/rmcp/src/model/annotated.rs @@ -16,8 +16,8 @@ pub struct Annotations { pub audience: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub priority: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub timestamp: Option>, + #[serde(skip_serializing_if = "Option::is_none", rename = "lastModified")] + pub last_modified: Option>, } impl Annotations { @@ -30,7 +30,7 @@ impl Annotations { ); Annotations { priority: Some(priority), - timestamp: Some(timestamp), + last_modified: Some(timestamp), audience: None, } } @@ -72,7 +72,7 @@ impl Annotated { self.annotations.as_ref().and_then(|a| a.priority) } pub fn timestamp(&self) -> Option> { - self.annotations.as_ref().and_then(|a| a.timestamp) + self.annotations.as_ref().and_then(|a| a.last_modified) } pub fn with_audience(self, audience: Vec) -> Annotated where @@ -92,7 +92,7 @@ impl Annotated { annotations: Some(Annotations { audience: Some(audience), priority: None, - timestamp: None, + last_modified: None, }), } } @@ -114,7 +114,7 @@ impl Annotated { raw: self.raw, annotations: Some(Annotations { priority: Some(priority), - timestamp: None, + last_modified: None, audience: None, }), } @@ -128,7 +128,7 @@ impl Annotated { Annotated { raw: self.raw, annotations: Some(Annotations { - timestamp: Some(timestamp), + last_modified: Some(timestamp), ..annotations }), } @@ -136,7 +136,7 @@ impl Annotated { Annotated { raw: self.raw, annotations: Some(Annotations { - timestamp: Some(timestamp), + last_modified: Some(timestamp), priority: None, audience: None, }), @@ -211,7 +211,7 @@ pub trait AnnotateAble: sealed::Sealed { Self: Sized, { self.annotate(Annotations { - timestamp: Some(timestamp), + last_modified: Some(timestamp), ..Default::default() }) } diff --git a/crates/rmcp/src/model/content.rs b/crates/rmcp/src/model/content.rs index dfc90ed12..378526b0f 100644 --- a/crates/rmcp/src/model/content.rs +++ b/crates/rmcp/src/model/content.rs @@ -11,6 +11,9 @@ use super::{AnnotateAble, Annotated, resource::ResourceContents}; #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct RawTextContent { pub text: String, + /// Optional protocol-level metadata for this content block + #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] + pub meta: Option, } pub type TextContent = Annotated; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] @@ -20,6 +23,9 @@ pub struct RawImageContent { /// The base64-encoded image pub data: String, pub mime_type: String, + /// Optional protocol-level metadata for this content block + #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] + pub meta: Option, } pub type ImageContent = Annotated; @@ -27,6 +33,7 @@ pub type ImageContent = Annotated; #[serde(rename_all = "camelCase")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct RawEmbeddedResource { + /// Optional protocol-level metadata for this content block #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] pub meta: Option, pub resource: ResourceContents, @@ -79,13 +86,17 @@ impl RawContent { } pub fn text>(text: S) -> Self { - RawContent::Text(RawTextContent { text: text.into() }) + RawContent::Text(RawTextContent { + text: text.into(), + meta: None, + }) } pub fn image, T: Into>(data: S, mime_type: T) -> Self { RawContent::Image(RawImageContent { data: data.into(), mime_type: mime_type.into(), + meta: None, }) } @@ -209,6 +220,7 @@ mod tests { let image_content = RawImageContent { data: "base64data".to_string(), mime_type: "image/png".to_string(), + meta: None, }; let json = serde_json::to_string(&image_content).unwrap(); diff --git a/crates/rmcp/src/model/prompt.rs b/crates/rmcp/src/model/prompt.rs index 7b8eff337..d7f13bb8e 100644 --- a/crates/rmcp/src/model/prompt.rs +++ b/crates/rmcp/src/model/prompt.rs @@ -114,49 +114,59 @@ impl PromptMessage { content: PromptMessageContent::Text { text: text.into() }, } } + + /// Create a new image message. `meta` and `annotations` are optional. #[cfg(feature = "base64")] pub fn new_image( role: PromptMessageRole, data: &[u8], mime_type: &str, + meta: Option, annotations: Option, ) -> Self { - let mime_type = mime_type.into(); - let base64 = BASE64_STANDARD.encode(data); - Self { role, content: PromptMessageContent::Image { image: RawImageContent { data: base64, - mime_type, + mime_type: mime_type.into(), + meta, } .optional_annotate(annotations), }, } } - /// Create a new resource message + /// Create a new resource message. `resource_meta`, `resource_content_meta`, and `annotations` are optional. pub fn new_resource( role: PromptMessageRole, uri: String, - mime_type: String, + mime_type: Option, text: Option, + resource_meta: Option, + resource_content_meta: Option, annotations: Option, ) -> Self { - let resource_contents = ResourceContents::TextResourceContents { - uri, - mime_type: Some(mime_type), - text: text.unwrap_or_default(), - meta: None, + let resource_contents = match text { + Some(t) => ResourceContents::TextResourceContents { + uri, + mime_type, + text: t, + meta: resource_content_meta, + }, + None => ResourceContents::BlobResourceContents { + uri, + mime_type, + blob: String::new(), + meta: resource_content_meta, + }, }; - Self { role, content: PromptMessageContent::Resource { resource: RawEmbeddedResource { - meta: None, + meta: resource_meta, resource: resource_contents, } .optional_annotate(annotations), @@ -164,6 +174,16 @@ impl PromptMessage { } } + /// Note: PromptMessage text content does not carry protocol-level _meta per current schema. + /// This function exists for API symmetry but ignores the meta parameter. + pub fn new_text_with_meta>( + role: PromptMessageRole, + text: S, + _meta: Option, + ) -> Self { + Self::new_text(role, text) + } + /// Create a new resource link message pub fn new_resource_link(role: PromptMessageRole, resource: super::resource::Resource) -> Self { Self { @@ -184,6 +204,7 @@ mod tests { let image_content = RawImageContent { data: "base64data".to_string(), mime_type: "image/png".to_string(), + meta: None, }; let json = serde_json::to_string(&image_content).unwrap(); diff --git a/crates/rmcp/tests/test_embedded_resource_meta.rs b/crates/rmcp/tests/test_embedded_resource_meta.rs index 77dae459e..7535e358f 100644 --- a/crates/rmcp/tests/test_embedded_resource_meta.rs +++ b/crates/rmcp/tests/test_embedded_resource_meta.rs @@ -4,20 +4,20 @@ use serde_json::json; #[test] fn serialize_embedded_text_resource_with_meta() { // Inner contents meta - let mut inner_meta = Meta::new(); - inner_meta.insert("inner".to_string(), json!(2)); + let mut resource_content_meta = Meta::new(); + resource_content_meta.insert("inner".to_string(), json!(2)); // Top-level embedded resource meta - let mut top_meta = Meta::new(); - top_meta.insert("top".to_string(), json!(1)); + let mut resource_meta = Meta::new(); + resource_meta.insert("top".to_string(), json!(1)); let content: Content = RawContent::Resource(rmcp::model::RawEmbeddedResource { - meta: Some(top_meta), + meta: Some(resource_meta), resource: ResourceContents::TextResourceContents { uri: "str://example".to_string(), mime_type: Some("text/plain".to_string()), text: "hello".to_string(), - meta: Some(inner_meta), + meta: Some(resource_content_meta), }, }) .no_annotation(); @@ -97,19 +97,19 @@ fn deserialize_embedded_text_resource_with_meta() { #[test] fn serialize_embedded_blob_resource_with_meta() { - let mut inner_meta = Meta::new(); - inner_meta.insert("blob_inner".to_string(), json!(true)); + let mut resource_content_meta = Meta::new(); + resource_content_meta.insert("blob_inner".to_string(), json!(true)); - let mut top_meta = Meta::new(); - top_meta.insert("blob_top".to_string(), json!("t")); + let mut resource_meta = Meta::new(); + resource_meta.insert("blob_top".to_string(), json!("t")); let content: Content = RawContent::Resource(rmcp::model::RawEmbeddedResource { - meta: Some(top_meta), + meta: Some(resource_meta), resource: ResourceContents::BlobResourceContents { uri: "str://blob".to_string(), mime_type: Some("application/octet-stream".to_string()), blob: "Zm9v".to_string(), - meta: Some(inner_meta), + meta: Some(resource_content_meta), }, }) .no_annotation(); 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 0fefb1238..bc1dd40f3 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 @@ -176,19 +176,19 @@ "$ref": "#/definitions/Role" } }, - "priority": { + "lastModified": { "type": [ - "number", + "string", "null" ], - "format": "float" + "format": "date-time" }, - "timestamp": { + "priority": { "type": [ - "string", + "number", "null" ], - "format": "date-time" + "format": "float" } } }, @@ -859,6 +859,7 @@ "type": "object", "properties": { "_meta": { + "description": "Optional protocol-level metadata for this content block", "type": [ "object", "null" @@ -876,6 +877,14 @@ "RawImageContent": { "type": "object", "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, "data": { "description": "The base64-encoded image", "type": "string" @@ -933,6 +942,14 @@ "RawTextContent": { "type": "object", "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, "text": { "type": "string" } diff --git a/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema_current.json b/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema_current.json new file mode 100644 index 000000000..bc1dd40f3 --- /dev/null +++ b/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema_current.json @@ -0,0 +1,1418 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "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" + } + ] + }, + { + "description": "A response to a previous request", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcResponse" + } + ] + }, + { + "description": "A one-way notification (no response expected)", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcNotification" + } + ] + }, + { + "description": "An error response", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcError" + } + ] + } + ], + "definitions": { + "Annotated": { + "type": "object", + "properties": { + "annotations": { + "anyOf": [ + { + "$ref": "#/definitions/Annotations" + }, + { + "type": "null" + } + ] + } + }, + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + } + }, + "allOf": [ + { + "$ref": "#/definitions/RawTextContent" + } + ], + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "image" + } + }, + "allOf": [ + { + "$ref": "#/definitions/RawImageContent" + } + ], + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "resource" + } + }, + "allOf": [ + { + "$ref": "#/definitions/RawEmbeddedResource" + } + ], + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "audio" + } + }, + "allOf": [ + { + "$ref": "#/definitions/Annotated2" + } + ], + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "resource_link" + } + }, + "allOf": [ + { + "$ref": "#/definitions/RawResource" + } + ], + "required": [ + "type" + ] + } + ] + }, + "Annotated2": { + "type": "object", + "properties": { + "annotations": { + "anyOf": [ + { + "$ref": "#/definitions/Annotations" + }, + { + "type": "null" + } + ] + }, + "data": { + "type": "string" + }, + "mimeType": { + "type": "string" + } + }, + "required": [ + "data", + "mimeType" + ] + }, + "Annotations": { + "type": "object", + "properties": { + "audience": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Role" + } + }, + "lastModified": { + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "priority": { + "type": [ + "number", + "null" + ], + "format": "float" + } + } + }, + "ArgumentInfo": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "name", + "value" + ] + }, + "CallToolRequestMethod": { + "type": "string", + "format": "const", + "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\nthe tool operation.", + "type": "object", + "properties": { + "arguments": { + "description": "Arguments to pass to the tool (must match the tool's input schema)", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "name": { + "description": "The name of the tool to call", + "type": "string" + } + }, + "required": [ + "name" + ] + }, + "CancelledNotificationMethod": { + "type": "string", + "format": "const", + "const": "notifications/cancelled" + }, + "CancelledNotificationParam": { + "type": "object", + "properties": { + "reason": { + "type": [ + "string", + "null" + ] + }, + "requestId": { + "$ref": "#/definitions/NumberOrString" + } + }, + "required": [ + "requestId" + ] + }, + "ClientCapabilities": { + "title": "Builder", + "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": { + "elicitation": { + "description": "Capability to handle elicitation requests from servers for interactive user input", + "anyOf": [ + { + "$ref": "#/definitions/ElicitationCapability" + }, + { + "type": "null" + } + ] + }, + "experimental": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "object", + "additionalProperties": true + } + }, + "roots": { + "anyOf": [ + { + "$ref": "#/definitions/RootsCapabilities" + }, + { + "type": "null" + } + ] + }, + "sampling": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + } + } + }, + "ClientResult": { + "anyOf": [ + { + "$ref": "#/definitions/CreateMessageResult" + }, + { + "$ref": "#/definitions/ListRootsResult" + }, + { + "$ref": "#/definitions/CreateElicitationResult" + }, + { + "$ref": "#/definitions/EmptyObject" + } + ] + }, + "CompleteRequestMethod": { + "type": "string", + "format": "const", + "const": "completion/complete" + }, + "CompleteRequestParam": { + "type": "object", + "properties": { + "argument": { + "$ref": "#/definitions/ArgumentInfo" + }, + "ref": { + "$ref": "#/definitions/Reference" + } + }, + "required": [ + "ref", + "argument" + ] + }, + "CreateElicitationResult": { + "description": "The result returned by a client in response to an elicitation request.\n\nContains the user's decision (accept/decline/cancel) and optionally their input data\nif they chose to accept the request.", + "type": "object", + "properties": { + "action": { + "description": "The user's decision on how to handle the elicitation request", + "allOf": [ + { + "$ref": "#/definitions/ElicitationAction" + } + ] + }, + "content": { + "description": "The actual data provided by the user, if they accepted the request.\nMust conform to the JSON schema specified in the original request.\nOnly present when action is Accept." + } + }, + "required": [ + "action" + ] + }, + "CreateMessageResult": { + "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", + "properties": { + "content": { + "description": "The actual content of the message (text, image, etc.)", + "allOf": [ + { + "$ref": "#/definitions/Annotated" + } + ] + }, + "model": { + "description": "The identifier of the model that generated the response", + "type": "string" + }, + "role": { + "description": "The role of the message sender (User or Assistant)", + "allOf": [ + { + "$ref": "#/definitions/Role" + } + ] + }, + "stopReason": { + "description": "The reason why generation stopped (e.g., \"endTurn\", \"maxTokens\")", + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "model", + "role", + "content" + ] + }, + "ElicitationAction": { + "description": "Represents the possible actions a user can take in response to an elicitation request.\n\nWhen a server requests user input through elicitation, the user can:\n- Accept: Provide the requested information and continue\n- Decline: Refuse to provide the information but continue the operation\n- Cancel: Stop the entire operation", + "oneOf": [ + { + "description": "User accepts the request and provides the requested information", + "type": "string", + "const": "accept" + }, + { + "description": "User declines to provide the information but allows the operation to continue", + "type": "string", + "const": "decline" + }, + { + "description": "User cancels the entire operation", + "type": "string", + "const": "cancel" + } + ] + }, + "ElicitationCapability": { + "description": "Capability for handling elicitation requests from servers.\n\nElicitation allows servers to request interactive input from users during tool execution.\nThis capability indicates that a client can handle elicitation requests and present\nappropriate UI to users for collecting the requested information.", + "type": "object", + "properties": { + "schemaValidation": { + "description": "Whether the client supports JSON Schema validation for elicitation responses.\nWhen true, the client will validate user input against the requested_schema\nbefore sending the response back to the server.", + "type": [ + "boolean", + "null" + ] + } + } + }, + "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,\nproviding a standardized way to communicate errors between clients and servers.", + "type": "object", + "properties": { + "code": { + "description": "The error type that occurred (using standard JSON-RPC error codes)", + "allOf": [ + { + "$ref": "#/definitions/ErrorCode" + } + ] + }, + "data": { + "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", + "format": "const", + "const": "prompts/get" + }, + "GetPromptRequestParam": { + "description": "Parameters for retrieving a specific prompt", + "type": "object", + "properties": { + "arguments": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + }, + "Implementation": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "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\ninformation, allowing the server to understand what the client supports.", + "type": "object", + "properties": { + "capabilities": { + "description": "The capabilities this client supports (sampling, roots, etc.)", + "allOf": [ + { + "$ref": "#/definitions/ClientCapabilities" + } + ] + }, + "clientInfo": { + "description": "Information about the client implementation", + "allOf": [ + { + "$ref": "#/definitions/Implementation" + } + ] + }, + "protocolVersion": { + "description": "The MCP protocol version this client supports", + "allOf": [ + { + "$ref": "#/definitions/ProtocolVersion" + } + ] + } + }, + "required": [ + "protocolVersion", + "capabilities", + "clientInfo" + ] + }, + "InitializeResultMethod": { + "type": "string", + "format": "const", + "const": "initialize" + }, + "InitializedNotificationMethod": { + "type": "string", + "format": "const", + "const": "notifications/initialized" + }, + "JsonRpcError": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorData" + }, + "id": { + "$ref": "#/definitions/NumberOrString" + }, + "jsonrpc": { + "$ref": "#/definitions/JsonRpcVersion2_0" + } + }, + "required": [ + "jsonrpc", + "id", + "error" + ] + }, + "JsonRpcNotification": { + "type": "object", + "properties": { + "jsonrpc": { + "$ref": "#/definitions/JsonRpcVersion2_0" + } + }, + "anyOf": [ + { + "$ref": "#/definitions/Notification" + }, + { + "$ref": "#/definitions/Notification2" + }, + { + "$ref": "#/definitions/NotificationNoParam" + }, + { + "$ref": "#/definitions/NotificationNoParam2" + } + ], + "required": [ + "jsonrpc" + ] + }, + "JsonRpcRequest": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/NumberOrString" + }, + "jsonrpc": { + "$ref": "#/definitions/JsonRpcVersion2_0" + } + }, + "anyOf": [ + { + "$ref": "#/definitions/RequestNoParam" + }, + { + "$ref": "#/definitions/Request" + }, + { + "$ref": "#/definitions/Request2" + }, + { + "$ref": "#/definitions/Request3" + }, + { + "$ref": "#/definitions/Request4" + }, + { + "$ref": "#/definitions/RequestOptionalParam" + }, + { + "$ref": "#/definitions/RequestOptionalParam2" + }, + { + "$ref": "#/definitions/RequestOptionalParam3" + }, + { + "$ref": "#/definitions/Request5" + }, + { + "$ref": "#/definitions/Request6" + }, + { + "$ref": "#/definitions/Request7" + }, + { + "$ref": "#/definitions/Request8" + }, + { + "$ref": "#/definitions/RequestOptionalParam4" + } + ], + "required": [ + "jsonrpc", + "id" + ] + }, + "JsonRpcResponse": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/NumberOrString" + }, + "jsonrpc": { + "$ref": "#/definitions/JsonRpcVersion2_0" + }, + "result": { + "$ref": "#/definitions/ClientResult" + } + }, + "required": [ + "jsonrpc", + "id", + "result" + ] + }, + "JsonRpcVersion2_0": { + "type": "string", + "format": "const", + "const": "2.0" + }, + "ListPromptsRequestMethod": { + "type": "string", + "format": "const", + "const": "prompts/list" + }, + "ListResourceTemplatesRequestMethod": { + "type": "string", + "format": "const", + "const": "resources/templates/list" + }, + "ListResourcesRequestMethod": { + "type": "string", + "format": "const", + "const": "resources/list" + }, + "ListRootsResult": { + "type": "object", + "properties": { + "roots": { + "type": "array", + "items": { + "$ref": "#/definitions/Root" + } + } + }, + "required": [ + "roots" + ] + }, + "ListToolsRequestMethod": { + "type": "string", + "format": "const", + "const": "tools/list" + }, + "LoggingLevel": { + "description": "Logging levels supported by the MCP protocol", + "type": "string", + "enum": [ + "debug", + "info", + "notice", + "warning", + "error", + "critical", + "alert", + "emergency" + ] + }, + "Notification": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/CancelledNotificationMethod" + }, + "params": { + "$ref": "#/definitions/CancelledNotificationParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "Notification2": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/ProgressNotificationMethod" + }, + "params": { + "$ref": "#/definitions/ProgressNotificationParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "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" + } + ] + }, + "PaginatedRequestParam": { + "type": "object", + "properties": { + "cursor": { + "type": [ + "string", + "null" + ] + } + } + }, + "PingRequestMethod": { + "type": "string", + "format": "const", + "const": "ping" + }, + "ProgressNotificationMethod": { + "type": "string", + "format": "const", + "const": "notifications/progress" + }, + "ProgressNotificationParam": { + "type": "object", + "properties": { + "message": { + "description": "An optional message describing the current progress.", + "type": [ + "string", + "null" + ] + }, + "progress": { + "description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.", + "type": "number", + "format": "double" + }, + "progressToken": { + "$ref": "#/definitions/ProgressToken" + }, + "total": { + "description": "Total number of items to process (or total progress required), if known", + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "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\nwhich version of the Model Context Protocol is being used.", + "type": "string" + }, + "RawEmbeddedResource": { + "type": "object", + "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "resource": { + "$ref": "#/definitions/ResourceContents" + } + }, + "required": [ + "resource" + ] + }, + "RawImageContent": { + "type": "object", + "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "data": { + "description": "The base64-encoded image", + "type": "string" + }, + "mimeType": { + "type": "string" + } + }, + "required": [ + "data", + "mimeType" + ] + }, + "RawResource": { + "description": "Represents a resource in the extension with metadata", + "type": "object", + "properties": { + "description": { + "description": "Optional description of the resource", + "type": [ + "string", + "null" + ] + }, + "mimeType": { + "description": "MIME type of the resource content (\"text\" or \"blob\")", + "type": [ + "string", + "null" + ] + }, + "name": { + "description": "Name of the resource", + "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 us", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "uri": { + "description": "URI representing the resource location (e.g., \"file:///path/to/file\" or \"str:///content\")", + "type": "string" + } + }, + "required": [ + "uri", + "name" + ] + }, + "RawTextContent": { + "type": "object", + "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "text": { + "type": "string" + } + }, + "required": [ + "text" + ] + }, + "ReadResourceRequestMethod": { + "type": "string", + "format": "const", + "const": "resources/read" + }, + "ReadResourceRequestParam": { + "description": "Parameters for reading a specific resource", + "type": "object", + "properties": { + "uri": { + "description": "The URI of the resource to read", + "type": "string" + } + }, + "required": [ + "uri" + ] + }, + "Reference": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ref/resource" + } + }, + "allOf": [ + { + "$ref": "#/definitions/ResourceReference" + } + ], + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ref/prompt" + } + }, + "allOf": [ + { + "$ref": "#/definitions/PromptReference" + } + ], + "required": [ + "type" + ] + } + ] + }, + "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", + "properties": { + "method": { + "$ref": "#/definitions/InitializeResultMethod" + }, + "params": { + "$ref": "#/definitions/InitializeRequestParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "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", + "properties": { + "method": { + "$ref": "#/definitions/CompleteRequestMethod" + }, + "params": { + "$ref": "#/definitions/CompleteRequestParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "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", + "properties": { + "method": { + "$ref": "#/definitions/SetLevelRequestMethod" + }, + "params": { + "$ref": "#/definitions/SetLevelRequestParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "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", + "properties": { + "method": { + "$ref": "#/definitions/GetPromptRequestMethod" + }, + "params": { + "$ref": "#/definitions/GetPromptRequestParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "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", + "properties": { + "method": { + "$ref": "#/definitions/ReadResourceRequestMethod" + }, + "params": { + "$ref": "#/definitions/ReadResourceRequestParam" + } + }, + "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/SubscribeRequestMethod" + }, + "params": { + "$ref": "#/definitions/SubscribeRequestParam" + } + }, + "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/UnsubscribeRequestMethod" + }, + "params": { + "$ref": "#/definitions/UnsubscribeRequestParam" + } + }, + "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/CallToolRequestMethod" + }, + "params": { + "$ref": "#/definitions/CallToolRequestParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "RequestNoParam": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/PingRequestMethod" + } + }, + "required": [ + "method" + ] + }, + "RequestOptionalParam": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/ListPromptsRequestMethod" + }, + "params": { + "anyOf": [ + { + "$ref": "#/definitions/PaginatedRequestParam" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "method" + ] + }, + "RequestOptionalParam2": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/ListResourcesRequestMethod" + }, + "params": { + "anyOf": [ + { + "$ref": "#/definitions/PaginatedRequestParam" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "method" + ] + }, + "RequestOptionalParam3": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/ListResourceTemplatesRequestMethod" + }, + "params": { + "anyOf": [ + { + "$ref": "#/definitions/PaginatedRequestParam" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "method" + ] + }, + "RequestOptionalParam4": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/ListToolsRequestMethod" + }, + "params": { + "anyOf": [ + { + "$ref": "#/definitions/PaginatedRequestParam" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "method" + ] + }, + "ResourceContents": { + "anyOf": [ + { + "type": "object", + "properties": { + "_meta": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "mimeType": { + "type": [ + "string", + "null" + ] + }, + "text": { + "type": "string" + }, + "uri": { + "type": "string" + } + }, + "required": [ + "uri", + "text" + ] + }, + { + "type": "object", + "properties": { + "_meta": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "blob": { + "type": "string" + }, + "mimeType": { + "type": [ + "string", + "null" + ] + }, + "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\ntypes of message senders in the conversation flow.", + "oneOf": [ + { + "description": "A human user or client making a request", + "type": "string", + "const": "user" + }, + { + "description": "An AI assistant or server providing a response", + "type": "string", + "const": "assistant" + } + ] + }, + "Root": { + "type": "object", + "properties": { + "name": { + "type": [ + "string", + "null" + ] + }, + "uri": { + "type": "string" + } + }, + "required": [ + "uri" + ] + }, + "RootsCapabilities": { + "type": "object", + "properties": { + "listChanged": { + "type": [ + "boolean", + "null" + ] + } + } + }, + "RootsListChangedNotificationMethod": { + "type": "string", + "format": "const", + "const": "notifications/roots/list_changed" + }, + "SetLevelRequestMethod": { + "type": "string", + "format": "const", + "const": "logging/setLevel" + }, + "SetLevelRequestParam": { + "description": "Parameters for setting the logging level", + "type": "object", + "properties": { + "level": { + "description": "The desired logging level", + "allOf": [ + { + "$ref": "#/definitions/LoggingLevel" + } + ] + } + }, + "required": [ + "level" + ] + }, + "SubscribeRequestMethod": { + "type": "string", + "format": "const", + "const": "resources/subscribe" + }, + "SubscribeRequestParam": { + "description": "Parameters for subscribing to resource updates", + "type": "object", + "properties": { + "uri": { + "description": "The URI of the resource to subscribe to", + "type": "string" + } + }, + "required": [ + "uri" + ] + }, + "UnsubscribeRequestMethod": { + "type": "string", + "format": "const", + "const": "resources/unsubscribe" + }, + "UnsubscribeRequestParam": { + "description": "Parameters for unsubscribing from resource updates", + "type": "object", + "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 5c1bc0d2a..0b9812e28 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 @@ -168,6 +168,7 @@ "type": "object", "properties": { "_meta": { + "description": "Optional protocol-level metadata for this content block", "type": [ "object", "null" @@ -292,19 +293,19 @@ "$ref": "#/definitions/Role" } }, - "priority": { + "lastModified": { "type": [ - "number", + "string", "null" ], - "format": "float" + "format": "date-time" }, - "timestamp": { + "priority": { "type": [ - "string", + "number", "null" ], - "format": "date-time" + "format": "float" } } }, @@ -1232,6 +1233,14 @@ "description": "Image content with base64-encoded data", "type": "object", "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, "annotations": { "anyOf": [ { @@ -1362,6 +1371,7 @@ "type": "object", "properties": { "_meta": { + "description": "Optional protocol-level metadata for this content block", "type": [ "object", "null" @@ -1379,6 +1389,14 @@ "RawImageContent": { "type": "object", "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, "data": { "description": "The base64-encoded image", "type": "string" @@ -1436,6 +1454,14 @@ "RawTextContent": { "type": "object", "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, "text": { "type": "string" } diff --git a/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema_current.json b/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema_current.json new file mode 100644 index 000000000..0b9812e28 --- /dev/null +++ b/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema_current.json @@ -0,0 +1,1885 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "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" + } + ] + }, + { + "description": "A response to a previous request", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcResponse" + } + ] + }, + { + "description": "A one-way notification (no response expected)", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcNotification" + } + ] + }, + { + "description": "An error response", + "allOf": [ + { + "$ref": "#/definitions/JsonRpcError" + } + ] + } + ], + "definitions": { + "Annotated": { + "type": "object", + "properties": { + "annotations": { + "anyOf": [ + { + "$ref": "#/definitions/Annotations" + }, + { + "type": "null" + } + ] + } + }, + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + } + }, + "allOf": [ + { + "$ref": "#/definitions/RawTextContent" + } + ], + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "image" + } + }, + "allOf": [ + { + "$ref": "#/definitions/RawImageContent" + } + ], + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "resource" + } + }, + "allOf": [ + { + "$ref": "#/definitions/RawEmbeddedResource" + } + ], + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "audio" + } + }, + "allOf": [ + { + "$ref": "#/definitions/Annotated2" + } + ], + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "resource_link" + } + }, + "allOf": [ + { + "$ref": "#/definitions/RawResource" + } + ], + "required": [ + "type" + ] + } + ] + }, + "Annotated2": { + "type": "object", + "properties": { + "annotations": { + "anyOf": [ + { + "$ref": "#/definitions/Annotations" + }, + { + "type": "null" + } + ] + }, + "data": { + "type": "string" + }, + "mimeType": { + "type": "string" + } + }, + "required": [ + "data", + "mimeType" + ] + }, + "Annotated3": { + "type": "object", + "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "annotations": { + "anyOf": [ + { + "$ref": "#/definitions/Annotations" + }, + { + "type": "null" + } + ] + }, + "resource": { + "$ref": "#/definitions/ResourceContents" + } + }, + "required": [ + "resource" + ] + }, + "Annotated4": { + "description": "Represents a resource in the extension with metadata", + "type": "object", + "properties": { + "annotations": { + "anyOf": [ + { + "$ref": "#/definitions/Annotations" + }, + { + "type": "null" + } + ] + }, + "description": { + "description": "Optional description of the resource", + "type": [ + "string", + "null" + ] + }, + "mimeType": { + "description": "MIME type of the resource content (\"text\" or \"blob\")", + "type": [ + "string", + "null" + ] + }, + "name": { + "description": "Name of the resource", + "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 us", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "uri": { + "description": "URI representing the resource location (e.g., \"file:///path/to/file\" or \"str:///content\")", + "type": "string" + } + }, + "required": [ + "uri", + "name" + ] + }, + "Annotated5": { + "type": "object", + "properties": { + "annotations": { + "anyOf": [ + { + "$ref": "#/definitions/Annotations" + }, + { + "type": "null" + } + ] + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "mimeType": { + "type": [ + "string", + "null" + ] + }, + "name": { + "type": "string" + }, + "uriTemplate": { + "type": "string" + } + }, + "required": [ + "uriTemplate", + "name" + ] + }, + "Annotations": { + "type": "object", + "properties": { + "audience": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Role" + } + }, + "lastModified": { + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "priority": { + "type": [ + "number", + "null" + ], + "format": "float" + } + } + }, + "CallToolResult": { + "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", + "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this result", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "content": { + "description": "The content returned by the tool (text, images, etc.)", + "type": "array", + "items": { + "$ref": "#/definitions/Annotated" + } + }, + "isError": { + "description": "Whether this result represents an error condition", + "type": [ + "boolean", + "null" + ] + }, + "structuredContent": { + "description": "An optional JSON object that represents the structured result of the tool call" + } + }, + "required": [ + "content" + ] + }, + "CancelledNotificationMethod": { + "type": "string", + "format": "const", + "const": "notifications/cancelled" + }, + "CancelledNotificationParam": { + "type": "object", + "properties": { + "reason": { + "type": [ + "string", + "null" + ] + }, + "requestId": { + "$ref": "#/definitions/NumberOrString" + } + }, + "required": [ + "requestId" + ] + }, + "CompleteResult": { + "type": "object", + "properties": { + "completion": { + "$ref": "#/definitions/CompletionInfo" + } + }, + "required": [ + "completion" + ] + }, + "CompletionInfo": { + "type": "object", + "properties": { + "hasMore": { + "type": [ + "boolean", + "null" + ] + }, + "total": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "values": { + "type": "array", + "items": { + "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\nshould be provided to the LLM when processing sampling requests.", + "oneOf": [ + { + "description": "Include context from all connected MCP servers", + "type": "string", + "const": "allServers" + }, + { + "description": "Include no additional context", + "type": "string", + "const": "none" + }, + { + "description": "Include context only from the requesting server", + "type": "string", + "const": "thisServer" + } + ] + }, + "CreateElicitationRequestParam": { + "description": "Parameters for creating an elicitation request to gather user input.\n\nThis structure contains everything needed to request interactive input from a user:\n- A human-readable message explaining what information is needed\n- A JSON schema defining the expected structure of the response", + "type": "object", + "properties": { + "message": { + "description": "Human-readable message explaining what input is needed from the user.\nThis should be clear and provide sufficient context for the user to understand\nwhat information they need to provide.", + "type": "string" + }, + "requestedSchema": { + "description": "JSON Schema defining the expected structure and validation rules for the user's response.\nThis allows clients to validate input and provide appropriate UI controls.\nMust be a valid JSON Schema Draft 2020-12 object.", + "type": "object", + "additionalProperties": true + } + }, + "required": [ + "message", + "requestedSchema" + ] + }, + "CreateElicitationResult": { + "description": "The result returned by a client in response to an elicitation request.\n\nContains the user's decision (accept/decline/cancel) and optionally their input data\nif they chose to accept the request.", + "type": "object", + "properties": { + "action": { + "description": "The user's decision on how to handle the elicitation request", + "allOf": [ + { + "$ref": "#/definitions/ElicitationAction" + } + ] + }, + "content": { + "description": "The actual data provided by the user, if they accepted the request.\nMust conform to the JSON schema specified in the original request.\nOnly present when action is Accept." + } + }, + "required": [ + "action" + ] + }, + "CreateMessageRequestMethod": { + "type": "string", + "format": "const", + "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\ngenerate an LLM response, including conversation history, model preferences,\nand generation parameters.", + "type": "object", + "properties": { + "includeContext": { + "description": "How much context to include from MCP servers", + "anyOf": [ + { + "$ref": "#/definitions/ContextInclusion" + }, + { + "type": "null" + } + ] + }, + "maxTokens": { + "description": "Maximum number of tokens to generate", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "messages": { + "description": "The conversation history and current messages", + "type": "array", + "items": { + "$ref": "#/definitions/SamplingMessage" + } + }, + "metadata": { + "description": "Additional metadata for the request" + }, + "modelPreferences": { + "description": "Preferences for model selection and behavior", + "anyOf": [ + { + "$ref": "#/definitions/ModelPreferences" + }, + { + "type": "null" + } + ] + }, + "stopSequences": { + "description": "Sequences that should stop generation", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "systemPrompt": { + "description": "System prompt to guide the model's behavior", + "type": [ + "string", + "null" + ] + }, + "temperature": { + "description": "Temperature for controlling randomness (0.0 to 1.0)", + "type": [ + "number", + "null" + ], + "format": "float" + } + }, + "required": [ + "messages", + "maxTokens" + ] + }, + "ElicitationAction": { + "description": "Represents the possible actions a user can take in response to an elicitation request.\n\nWhen a server requests user input through elicitation, the user can:\n- Accept: Provide the requested information and continue\n- Decline: Refuse to provide the information but continue the operation\n- Cancel: Stop the entire operation", + "oneOf": [ + { + "description": "User accepts the request and provides the requested information", + "type": "string", + "const": "accept" + }, + { + "description": "User declines to provide the information but allows the operation to continue", + "type": "string", + "const": "decline" + }, + { + "description": "User cancels the entire operation", + "type": "string", + "const": "cancel" + } + ] + }, + "ElicitationCreateRequestMethod": { + "type": "string", + "format": "const", + "const": "elicitation/create" + }, + "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,\nproviding a standardized way to communicate errors between clients and servers.", + "type": "object", + "properties": { + "code": { + "description": "The error type that occurred (using standard JSON-RPC error codes)", + "allOf": [ + { + "$ref": "#/definitions/ErrorCode" + } + ] + }, + "data": { + "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", + "properties": { + "description": { + "type": [ + "string", + "null" + ] + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/definitions/PromptMessage" + } + } + }, + "required": [ + "messages" + ] + }, + "Implementation": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "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\ninformation, along with optional instructions for the client.", + "type": "object", + "properties": { + "capabilities": { + "description": "The capabilities this server provides (tools, resources, prompts, etc.)", + "allOf": [ + { + "$ref": "#/definitions/ServerCapabilities" + } + ] + }, + "instructions": { + "description": "Optional human-readable instructions about using this server", + "type": [ + "string", + "null" + ] + }, + "protocolVersion": { + "description": "The MCP protocol version this server supports", + "allOf": [ + { + "$ref": "#/definitions/ProtocolVersion" + } + ] + }, + "serverInfo": { + "description": "Information about the server implementation", + "allOf": [ + { + "$ref": "#/definitions/Implementation" + } + ] + } + }, + "required": [ + "protocolVersion", + "capabilities", + "serverInfo" + ] + }, + "JsonRpcError": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorData" + }, + "id": { + "$ref": "#/definitions/NumberOrString" + }, + "jsonrpc": { + "$ref": "#/definitions/JsonRpcVersion2_0" + } + }, + "required": [ + "jsonrpc", + "id", + "error" + ] + }, + "JsonRpcNotification": { + "type": "object", + "properties": { + "jsonrpc": { + "$ref": "#/definitions/JsonRpcVersion2_0" + } + }, + "anyOf": [ + { + "$ref": "#/definitions/Notification" + }, + { + "$ref": "#/definitions/Notification2" + }, + { + "$ref": "#/definitions/Notification3" + }, + { + "$ref": "#/definitions/Notification4" + }, + { + "$ref": "#/definitions/NotificationNoParam" + }, + { + "$ref": "#/definitions/NotificationNoParam2" + }, + { + "$ref": "#/definitions/NotificationNoParam3" + } + ], + "required": [ + "jsonrpc" + ] + }, + "JsonRpcRequest": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/NumberOrString" + }, + "jsonrpc": { + "$ref": "#/definitions/JsonRpcVersion2_0" + } + }, + "anyOf": [ + { + "$ref": "#/definitions/RequestNoParam" + }, + { + "$ref": "#/definitions/Request" + }, + { + "$ref": "#/definitions/RequestNoParam2" + }, + { + "$ref": "#/definitions/Request2" + } + ], + "required": [ + "jsonrpc", + "id" + ] + }, + "JsonRpcResponse": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/NumberOrString" + }, + "jsonrpc": { + "$ref": "#/definitions/JsonRpcVersion2_0" + }, + "result": { + "$ref": "#/definitions/ServerResult" + } + }, + "required": [ + "jsonrpc", + "id", + "result" + ] + }, + "JsonRpcVersion2_0": { + "type": "string", + "format": "const", + "const": "2.0" + }, + "ListPromptsResult": { + "type": "object", + "properties": { + "nextCursor": { + "type": [ + "string", + "null" + ] + }, + "prompts": { + "type": "array", + "items": { + "$ref": "#/definitions/Prompt" + } + } + }, + "required": [ + "prompts" + ] + }, + "ListResourceTemplatesResult": { + "type": "object", + "properties": { + "nextCursor": { + "type": [ + "string", + "null" + ] + }, + "resourceTemplates": { + "type": "array", + "items": { + "$ref": "#/definitions/Annotated5" + } + } + }, + "required": [ + "resourceTemplates" + ] + }, + "ListResourcesResult": { + "type": "object", + "properties": { + "nextCursor": { + "type": [ + "string", + "null" + ] + }, + "resources": { + "type": "array", + "items": { + "$ref": "#/definitions/Annotated4" + } + } + }, + "required": [ + "resources" + ] + }, + "ListRootsRequestMethod": { + "type": "string", + "format": "const", + "const": "roots/list" + }, + "ListToolsResult": { + "type": "object", + "properties": { + "nextCursor": { + "type": [ + "string", + "null" + ] + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/definitions/Tool" + } + } + }, + "required": [ + "tools" + ] + }, + "LoggingLevel": { + "description": "Logging levels supported by the MCP protocol", + "type": "string", + "enum": [ + "debug", + "info", + "notice", + "warning", + "error", + "critical", + "alert", + "emergency" + ] + }, + "LoggingMessageNotificationMethod": { + "type": "string", + "format": "const", + "const": "notifications/message" + }, + "LoggingMessageNotificationParam": { + "description": "Parameters for a logging message notification", + "type": "object", + "properties": { + "data": { + "description": "The actual log data" + }, + "level": { + "description": "The severity level of this log message", + "allOf": [ + { + "$ref": "#/definitions/LoggingLevel" + } + ] + }, + "logger": { + "description": "Optional logger name that generated this message", + "type": [ + "string", + "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\nmodels. They can be specific model names or general families like \"claude\" or \"gpt\".", + "type": "object", + "properties": { + "name": { + "description": "The suggested model name or family identifier", + "type": [ + "string", + "null" + ] + } + } + }, + "ModelPreferences": { + "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": { + "description": "Priority for cost optimization (0.0 to 1.0, higher = prefer cheaper models)", + "type": [ + "number", + "null" + ], + "format": "float" + }, + "hints": { + "description": "Specific model names or families to prefer (e.g., \"claude\", \"gpt\")", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/ModelHint" + } + }, + "intelligencePriority": { + "description": "Priority for intelligence/capability (0.0 to 1.0, higher = prefer more capable models)", + "type": [ + "number", + "null" + ], + "format": "float" + }, + "speedPriority": { + "description": "Priority for speed/latency (0.0 to 1.0, higher = prefer faster models)", + "type": [ + "number", + "null" + ], + "format": "float" + } + } + }, + "Notification": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/CancelledNotificationMethod" + }, + "params": { + "$ref": "#/definitions/CancelledNotificationParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "Notification2": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/ProgressNotificationMethod" + }, + "params": { + "$ref": "#/definitions/ProgressNotificationParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "Notification3": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/LoggingMessageNotificationMethod" + }, + "params": { + "$ref": "#/definitions/LoggingMessageNotificationParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "Notification4": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/ResourceUpdatedNotificationMethod" + }, + "params": { + "$ref": "#/definitions/ResourceUpdatedNotificationParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "NotificationNoParam": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/ResourceListChangedNotificationMethod" + } + }, + "required": [ + "method" + ] + }, + "NotificationNoParam2": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/ToolListChangedNotificationMethod" + } + }, + "required": [ + "method" + ] + }, + "NotificationNoParam3": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/PromptListChangedNotificationMethod" + } + }, + "required": [ + "method" + ] + }, + "NumberOrString": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "PingRequestMethod": { + "type": "string", + "format": "const", + "const": "ping" + }, + "ProgressNotificationMethod": { + "type": "string", + "format": "const", + "const": "notifications/progress" + }, + "ProgressNotificationParam": { + "type": "object", + "properties": { + "message": { + "description": "An optional message describing the current progress.", + "type": [ + "string", + "null" + ] + }, + "progress": { + "description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.", + "type": "number", + "format": "double" + }, + "progressToken": { + "$ref": "#/definitions/ProgressToken" + }, + "total": { + "description": "Total number of items to process (or total progress required), if known", + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "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", + "properties": { + "arguments": { + "description": "Optional arguments that can be passed to customize the prompt", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/PromptArgument" + } + }, + "description": { + "description": "Optional description of what the prompt does", + "type": [ + "string", + "null" + ] + }, + "name": { + "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", + "properties": { + "description": { + "description": "A description of what the argument is used for", + "type": [ + "string", + "null" + ] + }, + "name": { + "description": "The name of the argument", + "type": "string" + }, + "required": { + "description": "Whether this argument is required", + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "name" + ] + }, + "PromptListChangedNotificationMethod": { + "type": "string", + "format": "const", + "const": "notifications/prompts/list_changed" + }, + "PromptMessage": { + "description": "A message in a prompt conversation", + "type": "object", + "properties": { + "content": { + "description": "The content of the message", + "allOf": [ + { + "$ref": "#/definitions/PromptMessageContent" + } + ] + }, + "role": { + "description": "The role of the message sender", + "allOf": [ + { + "$ref": "#/definitions/PromptMessageRole" + } + ] + } + }, + "required": [ + "role", + "content" + ] + }, + "PromptMessageContent": { + "description": "Content types that can be included in prompt messages", + "oneOf": [ + { + "description": "Plain text content", + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "type": { + "type": "string", + "const": "text" + } + }, + "required": [ + "type", + "text" + ] + }, + { + "description": "Image content with base64-encoded data", + "type": "object", + "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "annotations": { + "anyOf": [ + { + "$ref": "#/definitions/Annotations" + }, + { + "type": "null" + } + ] + }, + "data": { + "description": "The base64-encoded image", + "type": "string" + }, + "mimeType": { + "type": "string" + }, + "type": { + "type": "string", + "const": "image" + } + }, + "required": [ + "type", + "data", + "mimeType" + ] + }, + { + "description": "Embedded server-side resource", + "type": "object", + "properties": { + "resource": { + "$ref": "#/definitions/Annotated3" + }, + "type": { + "type": "string", + "const": "resource" + } + }, + "required": [ + "type", + "resource" + ] + }, + { + "description": "A link to a resource that can be fetched separately", + "type": "object", + "properties": { + "annotations": { + "anyOf": [ + { + "$ref": "#/definitions/Annotations" + }, + { + "type": "null" + } + ] + }, + "description": { + "description": "Optional description of the resource", + "type": [ + "string", + "null" + ] + }, + "mimeType": { + "description": "MIME type of the resource content (\"text\" or \"blob\")", + "type": [ + "string", + "null" + ] + }, + "name": { + "description": "Name of the resource", + "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 us", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "type": { + "type": "string", + "const": "resource_link" + }, + "uri": { + "description": "URI representing the resource location (e.g., \"file:///path/to/file\" or \"str:///content\")", + "type": "string" + } + }, + "required": [ + "type", + "uri", + "name" + ] + } + ] + }, + "PromptMessageRole": { + "description": "Represents the role of a message sender in a prompt conversation", + "type": "string", + "enum": [ + "user", + "assistant" + ] + }, + "PromptsCapability": { + "type": "object", + "properties": { + "listChanged": { + "type": [ + "boolean", + "null" + ] + } + } + }, + "ProtocolVersion": { + "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": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "resource": { + "$ref": "#/definitions/ResourceContents" + } + }, + "required": [ + "resource" + ] + }, + "RawImageContent": { + "type": "object", + "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "data": { + "description": "The base64-encoded image", + "type": "string" + }, + "mimeType": { + "type": "string" + } + }, + "required": [ + "data", + "mimeType" + ] + }, + "RawResource": { + "description": "Represents a resource in the extension with metadata", + "type": "object", + "properties": { + "description": { + "description": "Optional description of the resource", + "type": [ + "string", + "null" + ] + }, + "mimeType": { + "description": "MIME type of the resource content (\"text\" or \"blob\")", + "type": [ + "string", + "null" + ] + }, + "name": { + "description": "Name of the resource", + "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 us", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "uri": { + "description": "URI representing the resource location (e.g., \"file:///path/to/file\" or \"str:///content\")", + "type": "string" + } + }, + "required": [ + "uri", + "name" + ] + }, + "RawTextContent": { + "type": "object", + "properties": { + "_meta": { + "description": "Optional protocol-level metadata for this content block", + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "text": { + "type": "string" + } + }, + "required": [ + "text" + ] + }, + "ReadResourceResult": { + "description": "Result containing the contents of a read resource", + "type": "object", + "properties": { + "contents": { + "description": "The actual content of the resource", + "type": "array", + "items": { + "$ref": "#/definitions/ResourceContents" + } + } + }, + "required": [ + "contents" + ] + }, + "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", + "properties": { + "method": { + "$ref": "#/definitions/CreateMessageRequestMethod" + }, + "params": { + "$ref": "#/definitions/CreateMessageRequestParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "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", + "properties": { + "method": { + "$ref": "#/definitions/ElicitationCreateRequestMethod" + }, + "params": { + "$ref": "#/definitions/CreateElicitationRequestParam" + } + }, + "required": [ + "method", + "params" + ] + }, + "RequestNoParam": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/PingRequestMethod" + } + }, + "required": [ + "method" + ] + }, + "RequestNoParam2": { + "type": "object", + "properties": { + "method": { + "$ref": "#/definitions/ListRootsRequestMethod" + } + }, + "required": [ + "method" + ] + }, + "ResourceContents": { + "anyOf": [ + { + "type": "object", + "properties": { + "_meta": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "mimeType": { + "type": [ + "string", + "null" + ] + }, + "text": { + "type": "string" + }, + "uri": { + "type": "string" + } + }, + "required": [ + "uri", + "text" + ] + }, + { + "type": "object", + "properties": { + "_meta": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "blob": { + "type": "string" + }, + "mimeType": { + "type": [ + "string", + "null" + ] + }, + "uri": { + "type": "string" + } + }, + "required": [ + "uri", + "blob" + ] + } + ] + }, + "ResourceListChangedNotificationMethod": { + "type": "string", + "format": "const", + "const": "notifications/resources/list_changed" + }, + "ResourceUpdatedNotificationMethod": { + "type": "string", + "format": "const", + "const": "notifications/resources/updated" + }, + "ResourceUpdatedNotificationParam": { + "description": "Parameters for a resource update notification", + "type": "object", + "properties": { + "uri": { + "description": "The URI of the resource that was updated", + "type": "string" + } + }, + "required": [ + "uri" + ] + }, + "ResourcesCapability": { + "type": "object", + "properties": { + "listChanged": { + "type": [ + "boolean", + "null" + ] + }, + "subscribe": { + "type": [ + "boolean", + "null" + ] + } + } + }, + "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\ntypes of message senders in the conversation flow.", + "oneOf": [ + { + "description": "A human user or client making a request", + "type": "string", + "const": "user" + }, + { + "description": "An AI assistant or server providing a response", + "type": "string", + "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\nin LLM sampling requests where the conversation history is important\nfor generating appropriate responses.", + "type": "object", + "properties": { + "content": { + "description": "The actual content of the message (text, image, etc.)", + "allOf": [ + { + "$ref": "#/definitions/Annotated" + } + ] + }, + "role": { + "description": "The role of the message sender (User or Assistant)", + "allOf": [ + { + "$ref": "#/definitions/Role" + } + ] + } + }, + "required": [ + "role", + "content" + ] + }, + "ServerCapabilities": { + "title": "Builder", + "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": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "experimental": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "object", + "additionalProperties": true + } + }, + "logging": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "prompts": { + "anyOf": [ + { + "$ref": "#/definitions/PromptsCapability" + }, + { + "type": "null" + } + ] + }, + "resources": { + "anyOf": [ + { + "$ref": "#/definitions/ResourcesCapability" + }, + { + "type": "null" + } + ] + }, + "tools": { + "anyOf": [ + { + "$ref": "#/definitions/ToolsCapability" + }, + { + "type": "null" + } + ] + } + } + }, + "ServerResult": { + "anyOf": [ + { + "$ref": "#/definitions/InitializeResult" + }, + { + "$ref": "#/definitions/CompleteResult" + }, + { + "$ref": "#/definitions/GetPromptResult" + }, + { + "$ref": "#/definitions/ListPromptsResult" + }, + { + "$ref": "#/definitions/ListResourcesResult" + }, + { + "$ref": "#/definitions/ListResourceTemplatesResult" + }, + { + "$ref": "#/definitions/ReadResourceResult" + }, + { + "$ref": "#/definitions/CallToolResult" + }, + { + "$ref": "#/definitions/ListToolsResult" + }, + { + "$ref": "#/definitions/CreateElicitationResult" + }, + { + "$ref": "#/definitions/EmptyObject" + } + ] + }, + "Tool": { + "description": "A tool that can be used by a model.", + "type": "object", + "properties": { + "annotations": { + "description": "Optional additional tool information.", + "anyOf": [ + { + "$ref": "#/definitions/ToolAnnotations" + }, + { + "type": "null" + } + ] + }, + "description": { + "description": "A description of what the tool does", + "type": [ + "string", + "null" + ] + }, + "inputSchema": { + "description": "A JSON Schema object defining the expected parameters for the tool", + "type": "object", + "additionalProperties": true + }, + "name": { + "description": "The name of the tool", + "type": "string" + }, + "outputSchema": { + "description": "An optional JSON Schema object defining the structure of the tool's output", + "type": [ + "object", + "null" + ], + "additionalProperties": true + } + }, + "required": [ + "name", + "inputSchema" + ] + }, + "ToolAnnotations": { + "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\nA human-readable description of the tool's purpose.", + "type": [ + "boolean", + "null" + ] + }, + "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", + "null" + ] + }, + "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", + "null" + ] + }, + "readOnlyHint": { + "description": "If true, the tool does not modify its environment.\n\nDefault: false", + "type": [ + "boolean", + "null" + ] + }, + "title": { + "description": "A human-readable title for the tool.", + "type": [ + "string", + "null" + ] + } + } + }, + "ToolListChangedNotificationMethod": { + "type": "string", + "format": "const", + "const": "notifications/tools/list_changed" + }, + "ToolsCapability": { + "type": "object", + "properties": { + "listChanged": { + "type": [ + "boolean", + "null" + ] + } + } + } + } +} \ No newline at end of file