/// Copyright (c) 2025 Ali Hashemi (rust-mcp-stack)
/// Licensed under the MIT License. See LICENSE in the project root.
/// ----------------------------------------------------------------------------
/// This file is auto-generated by mcp-schema-gen v0.5.2.
/// WARNING:
/// It is not recommended to modify this file directly. You are free to
/// modify or extend the implementations as needed, but please do so at your own risk.
///
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
/// Hash : 9e7768c802b606e2d3dc4ebdaeaf07c40f943054
/// Generated at : 2026-03-12 21:06:20
/// ----------------------------------------------------------------------------
///
use super::validators as validate;
/// MCP Protocol Version
pub const LATEST_PROTOCOL_VERSION: &str = "2025-11-25";
/// JSON-RPC Version
pub const JSONRPC_VERSION: &str = "2.0";
/// Parse error. Invalid JSON was received. An error occurred while parsing the JSON text.
pub const PARSE_ERROR: i64 = -32700i64;
/// Invalid Request. The JSON sent is not a valid Request object.
pub const INVALID_REQUEST: i64 = -32600i64;
/// Method not found. The method does not exist / is not available.
pub const METHOD_NOT_FOUND: i64 = -32601i64;
/// Invalid param. Invalid method parameter(s).
pub const INVALID_PARAMS: i64 = -32602i64;
/// Internal error. Internal JSON-RPC error.
pub const INTERNAL_ERROR: i64 = -32603i64;
/// The server cannot proceed without additional client input.
pub const URL_ELICITATION_REQUIRED: i64 = -32042i64;
///Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Optional annotations for the client. The client can use annotations to inform how objects are used or displayed",
/// "type": "object",
/// "properties": {
/// "audience": {
/// "description": "Describes who the intended audience of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., [\"user\", \"assistant\"]).",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Role"
/// }
/// },
/// "lastModified": {
/// "description": "The moment the resource was last modified, as an ISO 8601 formatted string.\n\nShould be an ISO 8601 formatted string (e.g., \"2025-01-12T15:00:58Z\").\n\nExamples: last activity timestamp in an open file, timestamp when the resource\nwas attached, etc.",
/// "type": "string"
/// },
/// "priority": {
/// "description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.",
/// "type": "number",
/// "maximum": 1.0,
/// "minimum": 0.0
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct Annotations {
/**Describes who the intended audience of this object or data is.
It can include multiple entries to indicate content useful for multiple audiences (e.g., ["user", "assistant"]).*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub audience: ::std::vec::Vec<Role>,
/**The moment the resource was last modified, as an ISO 8601 formatted string.
Should be an ISO 8601 formatted string (e.g., "2025-01-12T15:00:58Z").
Examples: last activity timestamp in an open file, timestamp when the resource
was attached, etc.*/
#[serde(rename = "lastModified", default, skip_serializing_if = "::std::option::Option::is_none")]
pub last_modified: ::std::option::Option<::std::string::String>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub priority: ::std::option::Option<f64>,
}
///Audio provided to or from an LLM.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Audio provided to or from an LLM.",
/// "type": "object",
/// "required": [
/// "data",
/// "mimeType",
/// "type"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "annotations": {
/// "description": "Optional annotations for the client.",
/// "$ref": "#/$defs/Annotations"
/// },
/// "data": {
/// "description": "The base64-encoded audio data.",
/// "type": "string",
/// "format": "byte"
/// },
/// "mimeType": {
/// "description": "The MIME type of the audio. Different providers may support different audio types.",
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "audio"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct AudioContent {
///Optional annotations for the client.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub annotations: ::std::option::Option<Annotations>,
///The base64-encoded audio data.
pub data: ::std::string::String,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The MIME type of the audio. Different providers may support different audio types.
#[serde(rename = "mimeType")]
pub mime_type: ::std::string::String,
#[serde(rename = "type", deserialize_with = "validate::audio_content_type_")]
type_: ::std::string::String,
}
impl AudioContent {
pub fn new(
data: ::std::string::String,
mime_type: ::std::string::String,
annotations: ::std::option::Option<Annotations>,
meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
) -> Self {
Self {
annotations,
data,
meta,
mime_type,
type_: "audio".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "audio"
pub fn type_value() -> &'static str {
"audio"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"audio"
}
}
///Base interface for metadata with name (identifier) and title (display name) properties.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Base interface for metadata with name (identifier) and title (display name) properties.",
/// "type": "object",
/// "required": [
/// "name"
/// ],
/// "properties": {
/// "name": {
/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
/// "type": "string"
/// },
/// "title": {
/// "description": "Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\neven by those unfamiliar with domain-specific terminology.\n\nIf not provided, the name should be used for display (except for Tool,\nwhere annotations.title should be given precedence over using name,\nif present).",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct BaseMetadata {
///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
pub name: ::std::string::String,
/**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
even by those unfamiliar with domain-specific terminology.
If not provided, the name should be used for display (except for Tool,
where annotations.title should be given precedence over using name,
if present).*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
}
///BlobResourceContents
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "blob",
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "blob": {
/// "description": "A base64-encoded string representing the binary data of the item.",
/// "type": "string",
/// "format": "byte"
/// },
/// "mimeType": {
/// "description": "The MIME type of this resource, if known.",
/// "type": "string"
/// },
/// "uri": {
/// "description": "The URI of this resource.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct BlobResourceContents {
///A base64-encoded string representing the binary data of the item.
pub blob: ::std::string::String,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The MIME type of this resource, if known.
#[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
pub mime_type: ::std::option::Option<::std::string::String>,
///The URI of this resource.
pub uri: ::std::string::String,
}
///BooleanSchema
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "default": {
/// "type": "boolean"
/// },
/// "description": {
/// "type": "string"
/// },
/// "title": {
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "boolean"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct BooleanSchema {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub default: ::std::option::Option<bool>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
#[serde(rename = "type", deserialize_with = "validate::boolean_schema_type_")]
type_: ::std::string::String,
}
impl BooleanSchema {
pub fn new(
default: ::std::option::Option<bool>,
description: ::std::option::Option<::std::string::String>,
title: ::std::option::Option<::std::string::String>,
) -> Self {
Self {
default,
description,
title,
type_: "boolean".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "boolean"
pub fn type_value() -> &'static str {
"boolean"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"boolean"
}
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct CallToolMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///Used by the client to invoke a tool provided by the server.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Used by the client to invoke a tool provided by the server.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "tools/call"
/// },
/// "params": {
/// "$ref": "#/$defs/CallToolRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CallToolRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::call_tool_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::call_tool_request_method")]
method: ::std::string::String,
pub params: CallToolRequestParams,
}
impl CallToolRequest {
pub fn new(id: RequestId, params: CallToolRequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "tools/call".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "tools/call"
pub fn method_value() -> &'static str {
"tools/call"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"tools/call"
}
}
///Parameters for a tools/call request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a tools/call request.",
/// "type": "object",
/// "required": [
/// "name"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "arguments": {
/// "description": "Arguments to use for the tool call.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "name": {
/// "description": "The name of the tool.",
/// "type": "string"
/// },
/// "task": {
/// "description": "If specified, the caller is requesting task-augmented execution for this request.\nThe request will return a CreateTaskResult immediately, and the actual result can be\nretrieved later via tasks/result.\n\nTask augmentation is subject to capability negotiation - receivers MUST declare support\nfor task augmentation of specific request types in their capabilities.",
/// "$ref": "#/$defs/TaskMetadata"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CallToolRequestParams {
///Arguments to use for the tool call.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub arguments: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<CallToolMeta>,
///The name of the tool.
pub name: ::std::string::String,
/**If specified, the caller is requesting task-augmented execution for this request.
The request will return a CreateTaskResult immediately, and the actual result can be
retrieved later via tasks/result.
Task augmentation is subject to capability negotiation - receivers MUST declare support
for task augmentation of specific request types in their capabilities.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub task: ::std::option::Option<TaskMetadata>,
}
///The server's response to a tool call.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The server's response to a tool call.",
/// "type": "object",
/// "required": [
/// "content"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "content": {
/// "description": "A list of content objects that represent the unstructured result of the tool call.",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/ContentBlock"
/// }
/// },
/// "isError": {
/// "description": "Whether the tool call ended in an error.\n\nIf not set, this is assumed to be false (the call was successful).\n\nAny errors that originate from the tool SHOULD be reported inside the result\nobject, with isError set to true, _not_ as an MCP protocol-level error\nresponse. Otherwise, the LLM would not be able to see that an error occurred\nand self-correct.\n\nHowever, any errors in _finding_ the tool, an error indicating that the\nserver does not support tool calls, or any other exceptional conditions,\nshould be reported as an MCP error response.",
/// "type": "boolean"
/// },
/// "structuredContent": {
/// "description": "An optional JSON object that represents the structured result of the tool call.",
/// "type": "object",
/// "additionalProperties": {}
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CallToolResult {
///A list of content objects that represent the unstructured result of the tool call.
pub content: ::std::vec::Vec<ContentBlock>,
/**Whether the tool call ended in an error.
If not set, this is assumed to be false (the call was successful).
Any errors that originate from the tool SHOULD be reported inside the result
object, with isError set to true, _not_ as an MCP protocol-level error
response. Otherwise, the LLM would not be able to see that an error occurred
and self-correct.
However, any errors in _finding_ the tool, an error indicating that the
server does not support tool calls, or any other exceptional conditions,
should be reported as an MCP error response.*/
#[serde(rename = "isError", default, skip_serializing_if = "::std::option::Option::is_none")]
pub is_error: ::std::option::Option<bool>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///An optional JSON object that represents the structured result of the tool call.
#[serde(
rename = "structuredContent",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub structured_content: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///CancelTaskParams
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "taskId"
/// ],
/// "properties": {
/// "taskId": {
/// "description": "The task identifier to cancel.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CancelTaskParams {
///The task identifier to cancel.
#[serde(rename = "taskId")]
pub task_id: ::std::string::String,
}
///A request to cancel a task.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request to cancel a task.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "tasks/cancel"
/// },
/// "params": {
/// "type": "object",
/// "required": [
/// "taskId"
/// ],
/// "properties": {
/// "taskId": {
/// "description": "The task identifier to cancel.",
/// "type": "string"
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CancelTaskRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::cancel_task_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::cancel_task_request_method")]
method: ::std::string::String,
pub params: CancelTaskParams,
}
impl CancelTaskRequest {
pub fn new(id: RequestId, params: CancelTaskParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "tasks/cancel".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "tasks/cancel"
pub fn method_value() -> &'static str {
"tasks/cancel"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"tasks/cancel"
}
}
///The response to a tasks/cancel request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The response to a tasks/cancel request.",
/// "allOf": [
/// {
/// "$ref": "#/$defs/Result"
/// },
/// {
/// "$ref": "#/$defs/Task"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CancelTaskResult {
#[serde(rename = "createdAt")]
pub created_at: ::std::string::String,
#[serde(rename = "lastUpdatedAt")]
pub last_updated_at: ::std::string::String,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
#[serde(rename = "pollInterval", default, skip_serializing_if = "::std::option::Option::is_none")]
pub poll_interval: ::std::option::Option<i64>,
pub status: TaskStatus,
#[serde(rename = "statusMessage", default, skip_serializing_if = "::std::option::Option::is_none")]
pub status_message: ::std::option::Option<::std::string::String>,
#[serde(rename = "taskId")]
pub task_id: ::std::string::String,
pub ttl: i64,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
/**This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.
This notification indicates that the result will be unused, so any associated processing SHOULD cease.
A client MUST NOT attempt to cancel its initialize request.
For task cancellation, use the tasks/cancel request instead of this notification.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "This notification can be sent by either side to indicate that it is cancelling a previously-issued request.\n\nThe request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.\n\nThis notification indicates that the result will be unused, so any associated processing SHOULD cease.\n\nA client MUST NOT attempt to cancel its initialize request.\n\nFor task cancellation, use the tasks/cancel request instead of this notification.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "notifications/cancelled"
/// },
/// "params": {
/// "$ref": "#/$defs/CancelledNotificationParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CancelledNotification {
#[serde(deserialize_with = "validate::cancelled_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::cancelled_notification_method")]
method: ::std::string::String,
pub params: CancelledNotificationParams,
}
impl CancelledNotification {
pub fn new(params: CancelledNotificationParams) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method: "notifications/cancelled".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/cancelled"
pub fn method_value() -> &'static str {
"notifications/cancelled"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/cancelled"
}
}
///Parameters for a notifications/cancelled notification.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a notifications/cancelled notification.",
/// "type": "object",
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "reason": {
/// "description": "An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.",
/// "type": "string"
/// },
/// "requestId": {
/// "description": "The ID of the request to cancel.\n\nThis MUST correspond to the ID of a request previously issued in the same direction.\nThis MUST be provided for cancelling non-task requests.\nThis MUST NOT be used for cancelling tasks (use the tasks/cancel request instead).",
/// "$ref": "#/$defs/RequestId"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct CancelledNotificationParams {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub reason: ::std::option::Option<::std::string::String>,
/**The ID of the request to cancel.
This MUST correspond to the ID of a request previously issued in the same direction.
This MUST be provided for cancelling non-task requests.
This MUST NOT be used for cancelling tasks (use the tasks/cancel request instead).*/
#[serde(rename = "requestId", default, skip_serializing_if = "::std::option::Option::is_none")]
pub request_id: ::std::option::Option<RequestId>,
}
///Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.",
/// "type": "object",
/// "properties": {
/// "elicitation": {
/// "description": "Present if the client supports elicitation from the server.",
/// "type": "object",
/// "properties": {
/// "form": {
/// "type": "object",
/// "additionalProperties": true
/// },
/// "url": {
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
/// },
/// "experimental": {
/// "description": "Experimental, non-standard capabilities that the client supports.",
/// "type": "object",
/// "additionalProperties": {
/// "type": "object",
/// "additionalProperties": true
/// }
/// },
/// "roots": {
/// "description": "Present if the client supports listing roots.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether the client supports notifications for changes to the roots list.",
/// "type": "boolean"
/// }
/// }
/// },
/// "sampling": {
/// "description": "Present if the client supports sampling from an LLM.",
/// "type": "object",
/// "properties": {
/// "context": {
/// "description": "Whether the client supports context inclusion via includeContext parameter.\nIf not declared, servers SHOULD only use includeContext: \"none\" (or omit it).",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "tools": {
/// "description": "Whether the client supports tool use via tools and toolChoice parameters.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
/// },
/// "tasks": {
/// "description": "Present if the client supports task-augmented requests.",
/// "type": "object",
/// "properties": {
/// "cancel": {
/// "description": "Whether this client supports tasks/cancel.",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "list": {
/// "description": "Whether this client supports tasks/list.",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "requests": {
/// "description": "Specifies which request types can be augmented with tasks.",
/// "type": "object",
/// "properties": {
/// "elicitation": {
/// "description": "Task support for elicitation-related requests.",
/// "type": "object",
/// "properties": {
/// "create": {
/// "description": "Whether the client supports task-augmented elicitation/create requests.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
/// },
/// "sampling": {
/// "description": "Task support for sampling-related requests.",
/// "type": "object",
/// "properties": {
/// "createMessage": {
/// "description": "Whether the client supports task-augmented sampling/createMessage requests.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
/// }
/// }
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ClientCapabilities {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub elicitation: ::std::option::Option<ClientElicitation>,
///Experimental, non-standard capabilities that the client supports.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub experimental: ::std::option::Option<
std::collections::BTreeMap<::std::string::String, ::serde_json::Map<::std::string::String, ::serde_json::Value>>,
>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub roots: ::std::option::Option<ClientRoots>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub sampling: ::std::option::Option<ClientSampling>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub tasks: ::std::option::Option<ClientTasks>,
}
///Present if the client supports elicitation from the server.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present if the client supports elicitation from the server.",
/// "type": "object",
/// "properties": {
/// "form": {
/// "type": "object",
/// "additionalProperties": true
/// },
/// "url": {
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ClientElicitation {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub form: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub url: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///ClientNotification
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/CancelledNotification"
/// },
/// {
/// "$ref": "#/$defs/InitializedNotification"
/// },
/// {
/// "$ref": "#/$defs/ProgressNotification"
/// },
/// {
/// "$ref": "#/$defs/TaskStatusNotification"
/// },
/// {
/// "$ref": "#/$defs/RootsListChangedNotification"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ClientNotification {
CancelledNotification(CancelledNotification),
InitializedNotification(InitializedNotification),
ProgressNotification(ProgressNotification),
TaskStatusNotification(TaskStatusNotification),
RootsListChangedNotification(RootsListChangedNotification),
}
impl ::std::convert::From<CancelledNotification> for ClientNotification {
fn from(value: CancelledNotification) -> Self {
Self::CancelledNotification(value)
}
}
impl ::std::convert::From<InitializedNotification> for ClientNotification {
fn from(value: InitializedNotification) -> Self {
Self::InitializedNotification(value)
}
}
impl ::std::convert::From<ProgressNotification> for ClientNotification {
fn from(value: ProgressNotification) -> Self {
Self::ProgressNotification(value)
}
}
impl ::std::convert::From<TaskStatusNotification> for ClientNotification {
fn from(value: TaskStatusNotification) -> Self {
Self::TaskStatusNotification(value)
}
}
impl ::std::convert::From<RootsListChangedNotification> for ClientNotification {
fn from(value: RootsListChangedNotification) -> Self {
Self::RootsListChangedNotification(value)
}
}
///ClientRequest
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/InitializeRequest"
/// },
/// {
/// "$ref": "#/$defs/PingRequest"
/// },
/// {
/// "$ref": "#/$defs/ListResourcesRequest"
/// },
/// {
/// "$ref": "#/$defs/ListResourceTemplatesRequest"
/// },
/// {
/// "$ref": "#/$defs/ReadResourceRequest"
/// },
/// {
/// "$ref": "#/$defs/SubscribeRequest"
/// },
/// {
/// "$ref": "#/$defs/UnsubscribeRequest"
/// },
/// {
/// "$ref": "#/$defs/ListPromptsRequest"
/// },
/// {
/// "$ref": "#/$defs/GetPromptRequest"
/// },
/// {
/// "$ref": "#/$defs/ListToolsRequest"
/// },
/// {
/// "$ref": "#/$defs/CallToolRequest"
/// },
/// {
/// "$ref": "#/$defs/GetTaskRequest"
/// },
/// {
/// "$ref": "#/$defs/GetTaskPayloadRequest"
/// },
/// {
/// "$ref": "#/$defs/CancelTaskRequest"
/// },
/// {
/// "$ref": "#/$defs/ListTasksRequest"
/// },
/// {
/// "$ref": "#/$defs/SetLevelRequest"
/// },
/// {
/// "$ref": "#/$defs/CompleteRequest"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ClientRequest {
InitializeRequest(InitializeRequest),
PingRequest(PingRequest),
ListResourcesRequest(ListResourcesRequest),
ListResourceTemplatesRequest(ListResourceTemplatesRequest),
ReadResourceRequest(ReadResourceRequest),
SubscribeRequest(SubscribeRequest),
UnsubscribeRequest(UnsubscribeRequest),
ListPromptsRequest(ListPromptsRequest),
GetPromptRequest(GetPromptRequest),
ListToolsRequest(ListToolsRequest),
CallToolRequest(CallToolRequest),
GetTaskRequest(GetTaskRequest),
GetTaskPayloadRequest(GetTaskPayloadRequest),
CancelTaskRequest(CancelTaskRequest),
ListTasksRequest(ListTasksRequest),
SetLevelRequest(SetLevelRequest),
CompleteRequest(CompleteRequest),
}
impl ::std::convert::From<InitializeRequest> for ClientRequest {
fn from(value: InitializeRequest) -> Self {
Self::InitializeRequest(value)
}
}
impl ::std::convert::From<PingRequest> for ClientRequest {
fn from(value: PingRequest) -> Self {
Self::PingRequest(value)
}
}
impl ::std::convert::From<ListResourcesRequest> for ClientRequest {
fn from(value: ListResourcesRequest) -> Self {
Self::ListResourcesRequest(value)
}
}
impl ::std::convert::From<ListResourceTemplatesRequest> for ClientRequest {
fn from(value: ListResourceTemplatesRequest) -> Self {
Self::ListResourceTemplatesRequest(value)
}
}
impl ::std::convert::From<ReadResourceRequest> for ClientRequest {
fn from(value: ReadResourceRequest) -> Self {
Self::ReadResourceRequest(value)
}
}
impl ::std::convert::From<SubscribeRequest> for ClientRequest {
fn from(value: SubscribeRequest) -> Self {
Self::SubscribeRequest(value)
}
}
impl ::std::convert::From<UnsubscribeRequest> for ClientRequest {
fn from(value: UnsubscribeRequest) -> Self {
Self::UnsubscribeRequest(value)
}
}
impl ::std::convert::From<ListPromptsRequest> for ClientRequest {
fn from(value: ListPromptsRequest) -> Self {
Self::ListPromptsRequest(value)
}
}
impl ::std::convert::From<GetPromptRequest> for ClientRequest {
fn from(value: GetPromptRequest) -> Self {
Self::GetPromptRequest(value)
}
}
impl ::std::convert::From<ListToolsRequest> for ClientRequest {
fn from(value: ListToolsRequest) -> Self {
Self::ListToolsRequest(value)
}
}
impl ::std::convert::From<CallToolRequest> for ClientRequest {
fn from(value: CallToolRequest) -> Self {
Self::CallToolRequest(value)
}
}
impl ::std::convert::From<GetTaskRequest> for ClientRequest {
fn from(value: GetTaskRequest) -> Self {
Self::GetTaskRequest(value)
}
}
impl ::std::convert::From<GetTaskPayloadRequest> for ClientRequest {
fn from(value: GetTaskPayloadRequest) -> Self {
Self::GetTaskPayloadRequest(value)
}
}
impl ::std::convert::From<CancelTaskRequest> for ClientRequest {
fn from(value: CancelTaskRequest) -> Self {
Self::CancelTaskRequest(value)
}
}
impl ::std::convert::From<ListTasksRequest> for ClientRequest {
fn from(value: ListTasksRequest) -> Self {
Self::ListTasksRequest(value)
}
}
impl ::std::convert::From<SetLevelRequest> for ClientRequest {
fn from(value: SetLevelRequest) -> Self {
Self::SetLevelRequest(value)
}
}
impl ::std::convert::From<CompleteRequest> for ClientRequest {
fn from(value: CompleteRequest) -> Self {
Self::CompleteRequest(value)
}
}
///ClientResult
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/Result"
/// },
/// {
/// "description": "The response to a tasks/get request.",
/// "$ref": "#/$defs/GetTaskResult"
/// },
/// {
/// "$ref": "#/$defs/GetTaskPayloadResult"
/// },
/// {
/// "description": "The response to a tasks/cancel request.",
/// "$ref": "#/$defs/CancelTaskResult"
/// },
/// {
/// "$ref": "#/$defs/ListTasksResult"
/// },
/// {
/// "$ref": "#/$defs/CreateMessageResult"
/// },
/// {
/// "$ref": "#/$defs/ListRootsResult"
/// },
/// {
/// "$ref": "#/$defs/ElicitResult"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ClientResult {
GetTaskResult(GetTaskResult),
CancelTaskResult(CancelTaskResult),
ListTasksResult(ListTasksResult),
CreateMessageResult(CreateMessageResult),
ListRootsResult(ListRootsResult),
ElicitResult(ElicitResult),
Result(Result),
GetTaskPayloadResult(GetTaskPayloadResult),
}
impl ::std::convert::From<GetTaskResult> for ClientResult {
fn from(value: GetTaskResult) -> Self {
Self::GetTaskResult(value)
}
}
impl ::std::convert::From<CancelTaskResult> for ClientResult {
fn from(value: CancelTaskResult) -> Self {
Self::CancelTaskResult(value)
}
}
impl ::std::convert::From<ListTasksResult> for ClientResult {
fn from(value: ListTasksResult) -> Self {
Self::ListTasksResult(value)
}
}
impl ::std::convert::From<CreateMessageResult> for ClientResult {
fn from(value: CreateMessageResult) -> Self {
Self::CreateMessageResult(value)
}
}
impl ::std::convert::From<ListRootsResult> for ClientResult {
fn from(value: ListRootsResult) -> Self {
Self::ListRootsResult(value)
}
}
impl ::std::convert::From<ElicitResult> for ClientResult {
fn from(value: ElicitResult) -> Self {
Self::ElicitResult(value)
}
}
impl ::std::convert::From<Result> for ClientResult {
fn from(value: Result) -> Self {
Self::Result(value)
}
}
impl ::std::convert::From<GetTaskPayloadResult> for ClientResult {
fn from(value: GetTaskPayloadResult) -> Self {
Self::GetTaskPayloadResult(value)
}
}
///Present if the client supports listing roots.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present if the client supports listing roots.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether the client supports notifications for changes to the roots list.",
/// "type": "boolean"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ClientRoots {
///Whether the client supports notifications for changes to the roots list.
#[serde(rename = "listChanged", default, skip_serializing_if = "::std::option::Option::is_none")]
pub list_changed: ::std::option::Option<bool>,
}
///Present if the client supports sampling from an LLM.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present if the client supports sampling from an LLM.",
/// "type": "object",
/// "properties": {
/// "context": {
/// "description": "Whether the client supports context inclusion via includeContext parameter.\nIf not declared, servers SHOULD only use includeContext: \"none\" (or omit it).",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "tools": {
/// "description": "Whether the client supports tool use via tools and toolChoice parameters.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ClientSampling {
/**Whether the client supports context inclusion via includeContext parameter.
If not declared, servers SHOULD only use includeContext: "none" (or omit it).*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub context: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///Whether the client supports tool use via tools and toolChoice parameters.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub tools: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///Task support for elicitation-related requests.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Task support for elicitation-related requests.",
/// "type": "object",
/// "properties": {
/// "create": {
/// "description": "Whether the client supports task-augmented elicitation/create requests.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ClientTaskElicitation {
///Whether the client supports task-augmented elicitation/create requests.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub create: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///Specifies which request types can be augmented with tasks.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Specifies which request types can be augmented with tasks.",
/// "type": "object",
/// "properties": {
/// "elicitation": {
/// "description": "Task support for elicitation-related requests.",
/// "type": "object",
/// "properties": {
/// "create": {
/// "description": "Whether the client supports task-augmented elicitation/create requests.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
/// },
/// "sampling": {
/// "description": "Task support for sampling-related requests.",
/// "type": "object",
/// "properties": {
/// "createMessage": {
/// "description": "Whether the client supports task-augmented sampling/createMessage requests.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ClientTaskRequest {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub elicitation: ::std::option::Option<ClientTaskElicitation>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub sampling: ::std::option::Option<ClientTaskSampling>,
}
///Task support for sampling-related requests.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Task support for sampling-related requests.",
/// "type": "object",
/// "properties": {
/// "createMessage": {
/// "description": "Whether the client supports task-augmented sampling/createMessage requests.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ClientTaskSampling {
///Whether the client supports task-augmented sampling/createMessage requests.
#[serde(rename = "createMessage", default, skip_serializing_if = "::std::option::Option::is_none")]
pub create_message: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///Present if the client supports task-augmented requests.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present if the client supports task-augmented requests.",
/// "type": "object",
/// "properties": {
/// "cancel": {
/// "description": "Whether this client supports tasks/cancel.",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "list": {
/// "description": "Whether this client supports tasks/list.",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "requests": {
/// "description": "Specifies which request types can be augmented with tasks.",
/// "type": "object",
/// "properties": {
/// "elicitation": {
/// "description": "Task support for elicitation-related requests.",
/// "type": "object",
/// "properties": {
/// "create": {
/// "description": "Whether the client supports task-augmented elicitation/create requests.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
/// },
/// "sampling": {
/// "description": "Task support for sampling-related requests.",
/// "type": "object",
/// "properties": {
/// "createMessage": {
/// "description": "Whether the client supports task-augmented sampling/createMessage requests.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ClientTasks {
///Whether this client supports tasks/cancel.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub cancel: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///Whether this client supports tasks/list.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub list: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub requests: ::std::option::Option<ClientTaskRequest>,
}
///A request from the client to the server, to ask for completion options.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request from the client to the server, to ask for completion options.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "completion/complete"
/// },
/// "params": {
/// "$ref": "#/$defs/CompleteRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CompleteRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::complete_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::complete_request_method")]
method: ::std::string::String,
pub params: CompleteRequestParams,
}
impl CompleteRequest {
pub fn new(id: RequestId, params: CompleteRequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "completion/complete".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "completion/complete"
pub fn method_value() -> &'static str {
"completion/complete"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"completion/complete"
}
}
///The argument's information
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The argument's information",
/// "type": "object",
/// "required": [
/// "name",
/// "value"
/// ],
/// "properties": {
/// "name": {
/// "description": "The name of the argument",
/// "type": "string"
/// },
/// "value": {
/// "description": "The value of the argument to use for completion matching.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CompleteRequestArgument {
///The name of the argument
pub name: ::std::string::String,
///The value of the argument to use for completion matching.
pub value: ::std::string::String,
}
///Additional, optional context for completions
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Additional, optional context for completions",
/// "type": "object",
/// "properties": {
/// "arguments": {
/// "description": "Previously-resolved variables in a URI template or prompt.",
/// "type": "object",
/// "additionalProperties": {
/// "type": "string"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct CompleteRequestContext {
///Previously-resolved variables in a URI template or prompt.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub arguments: ::std::option::Option<std::collections::BTreeMap<::std::string::String, ::std::string::String>>,
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct CompleteRequestMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///Parameters for a completion/complete request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a completion/complete request.",
/// "type": "object",
/// "required": [
/// "argument",
/// "ref"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "argument": {
/// "description": "The argument's information",
/// "type": "object",
/// "required": [
/// "name",
/// "value"
/// ],
/// "properties": {
/// "name": {
/// "description": "The name of the argument",
/// "type": "string"
/// },
/// "value": {
/// "description": "The value of the argument to use for completion matching.",
/// "type": "string"
/// }
/// }
/// },
/// "context": {
/// "description": "Additional, optional context for completions",
/// "type": "object",
/// "properties": {
/// "arguments": {
/// "description": "Previously-resolved variables in a URI template or prompt.",
/// "type": "object",
/// "additionalProperties": {
/// "type": "string"
/// }
/// }
/// }
/// },
/// "ref": {
/// "anyOf": [
/// {
/// "$ref": "#/$defs/PromptReference"
/// },
/// {
/// "$ref": "#/$defs/ResourceTemplateReference"
/// }
/// ]
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CompleteRequestParams {
pub argument: CompleteRequestArgument,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub context: ::std::option::Option<CompleteRequestContext>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<CompleteRequestMeta>,
#[serde(rename = "ref")]
pub ref_: CompleteRequestRef,
}
///CompleteRequestRef
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/PromptReference"
/// },
/// {
/// "$ref": "#/$defs/ResourceTemplateReference"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum CompleteRequestRef {
PromptReference(PromptReference),
ResourceTemplateReference(ResourceTemplateReference),
}
impl ::std::convert::From<PromptReference> for CompleteRequestRef {
fn from(value: PromptReference) -> Self {
Self::PromptReference(value)
}
}
impl ::std::convert::From<ResourceTemplateReference> for CompleteRequestRef {
fn from(value: ResourceTemplateReference) -> Self {
Self::ResourceTemplateReference(value)
}
}
///The server's response to a completion/complete request
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The server's response to a completion/complete request",
/// "type": "object",
/// "required": [
/// "completion"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "completion": {
/// "type": "object",
/// "required": [
/// "values"
/// ],
/// "properties": {
/// "hasMore": {
/// "description": "Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.",
/// "type": "boolean"
/// },
/// "total": {
/// "description": "The total number of completion options available. This can exceed the number of values actually sent in the response.",
/// "type": "integer"
/// },
/// "values": {
/// "description": "An array of completion values. Must not exceed 100 items.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CompleteResult {
pub completion: CompleteResultCompletion,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///CompleteResultCompletion
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "values"
/// ],
/// "properties": {
/// "hasMore": {
/// "description": "Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.",
/// "type": "boolean"
/// },
/// "total": {
/// "description": "The total number of completion options available. This can exceed the number of values actually sent in the response.",
/// "type": "integer"
/// },
/// "values": {
/// "description": "An array of completion values. Must not exceed 100 items.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CompleteResultCompletion {
///Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
#[serde(rename = "hasMore", default, skip_serializing_if = "::std::option::Option::is_none")]
pub has_more: ::std::option::Option<bool>,
///The total number of completion options available. This can exceed the number of values actually sent in the response.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub total: ::std::option::Option<i64>,
///An array of completion values. Must not exceed 100 items.
pub values: ::std::vec::Vec<::std::string::String>,
}
///ContentBlock
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/TextContent"
/// },
/// {
/// "$ref": "#/$defs/ImageContent"
/// },
/// {
/// "$ref": "#/$defs/AudioContent"
/// },
/// {
/// "$ref": "#/$defs/ResourceLink"
/// },
/// {
/// "$ref": "#/$defs/EmbeddedResource"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ContentBlock {
TextContent(TextContent),
ImageContent(ImageContent),
AudioContent(AudioContent),
ResourceLink(ResourceLink),
EmbeddedResource(EmbeddedResource),
}
impl ::std::convert::From<TextContent> for ContentBlock {
fn from(value: TextContent) -> Self {
Self::TextContent(value)
}
}
impl ::std::convert::From<ImageContent> for ContentBlock {
fn from(value: ImageContent) -> Self {
Self::ImageContent(value)
}
}
impl ::std::convert::From<AudioContent> for ContentBlock {
fn from(value: AudioContent) -> Self {
Self::AudioContent(value)
}
}
impl ::std::convert::From<ResourceLink> for ContentBlock {
fn from(value: ResourceLink) -> Self {
Self::ResourceLink(value)
}
}
impl ::std::convert::From<EmbeddedResource> for ContentBlock {
fn from(value: EmbeddedResource) -> Self {
Self::EmbeddedResource(value)
}
}
///CreateMessageContent
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/TextContent"
/// },
/// {
/// "$ref": "#/$defs/ImageContent"
/// },
/// {
/// "$ref": "#/$defs/AudioContent"
/// },
/// {
/// "$ref": "#/$defs/ToolUseContent"
/// },
/// {
/// "$ref": "#/$defs/ToolResultContent"
/// },
/// {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/SamplingMessageContentBlock"
/// }
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum CreateMessageContent {
TextContent(TextContent),
ImageContent(ImageContent),
AudioContent(AudioContent),
ToolUseContent(ToolUseContent),
ToolResultContent(ToolResultContent),
SamplingMessageContentBlock(::std::vec::Vec<SamplingMessageContentBlock>),
}
impl ::std::convert::From<TextContent> for CreateMessageContent {
fn from(value: TextContent) -> Self {
Self::TextContent(value)
}
}
impl ::std::convert::From<ImageContent> for CreateMessageContent {
fn from(value: ImageContent) -> Self {
Self::ImageContent(value)
}
}
impl ::std::convert::From<AudioContent> for CreateMessageContent {
fn from(value: AudioContent) -> Self {
Self::AudioContent(value)
}
}
impl ::std::convert::From<ToolUseContent> for CreateMessageContent {
fn from(value: ToolUseContent) -> Self {
Self::ToolUseContent(value)
}
}
impl ::std::convert::From<ToolResultContent> for CreateMessageContent {
fn from(value: ToolResultContent) -> Self {
Self::ToolResultContent(value)
}
}
impl ::std::convert::From<::std::vec::Vec<SamplingMessageContentBlock>> for CreateMessageContent {
fn from(value: ::std::vec::Vec<SamplingMessageContentBlock>) -> Self {
Self::SamplingMessageContentBlock(value)
}
}
///A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "sampling/createMessage"
/// },
/// "params": {
/// "$ref": "#/$defs/CreateMessageRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CreateMessageRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::create_message_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::create_message_request_method")]
method: ::std::string::String,
pub params: CreateMessageRequestParams,
}
impl CreateMessageRequest {
pub fn new(id: RequestId, params: CreateMessageRequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "sampling/createMessage".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "sampling/createMessage"
pub fn method_value() -> &'static str {
"sampling/createMessage"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"sampling/createMessage"
}
}
///Parameters for a sampling/createMessage request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a sampling/createMessage request.",
/// "type": "object",
/// "required": [
/// "maxTokens",
/// "messages"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "includeContext": {
/// "description": "A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.\nThe client MAY ignore this request.\n\nDefault is \"none\". Values \"thisServer\" and \"allServers\" are soft-deprecated. Servers SHOULD only use these values if the client\ndeclares ClientCapabilities.sampling.context. These values may be removed in future spec releases.",
/// "type": "string",
/// "enum": [
/// "allServers",
/// "none",
/// "thisServer"
/// ]
/// },
/// "maxTokens": {
/// "description": "The requested maximum number of tokens to sample (to prevent runaway completions).\n\nThe client MAY choose to sample fewer tokens than the requested maximum.",
/// "type": "integer"
/// },
/// "messages": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/SamplingMessage"
/// }
/// },
/// "metadata": {
/// "description": "Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "modelPreferences": {
/// "description": "The server's preferences for which model to select. The client MAY ignore these preferences.",
/// "$ref": "#/$defs/ModelPreferences"
/// },
/// "stopSequences": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "systemPrompt": {
/// "description": "An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.",
/// "type": "string"
/// },
/// "task": {
/// "description": "If specified, the caller is requesting task-augmented execution for this request.\nThe request will return a CreateTaskResult immediately, and the actual result can be\nretrieved later via tasks/result.\n\nTask augmentation is subject to capability negotiation - receivers MUST declare support\nfor task augmentation of specific request types in their capabilities.",
/// "$ref": "#/$defs/TaskMetadata"
/// },
/// "temperature": {
/// "type": "number"
/// },
/// "toolChoice": {
/// "description": "Controls how the model uses tools.\nThe client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.\nDefault is { mode: \"auto\" }.",
/// "$ref": "#/$defs/ToolChoice"
/// },
/// "tools": {
/// "description": "Tools that the model may use during generation.\nThe client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Tool"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CreateMessageRequestParams {
/**A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.
The client MAY ignore this request.
Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client
declares ClientCapabilities.sampling.context. These values may be removed in future spec releases.*/
#[serde(rename = "includeContext", default, skip_serializing_if = "::std::option::Option::is_none")]
pub include_context: ::std::option::Option<IncludeContext>,
/**The requested maximum number of tokens to sample (to prevent runaway completions).
The client MAY choose to sample fewer tokens than the requested maximum.*/
#[serde(rename = "maxTokens")]
pub max_tokens: i64,
pub messages: ::std::vec::Vec<SamplingMessage>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MessageMeta>,
///Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub metadata: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The server's preferences for which model to select. The client MAY ignore these preferences.
#[serde(
rename = "modelPreferences",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub model_preferences: ::std::option::Option<ModelPreferences>,
#[serde(rename = "stopSequences", default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub stop_sequences: ::std::vec::Vec<::std::string::String>,
///An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
#[serde(rename = "systemPrompt", default, skip_serializing_if = "::std::option::Option::is_none")]
pub system_prompt: ::std::option::Option<::std::string::String>,
/**If specified, the caller is requesting task-augmented execution for this request.
The request will return a CreateTaskResult immediately, and the actual result can be
retrieved later via tasks/result.
Task augmentation is subject to capability negotiation - receivers MUST declare support
for task augmentation of specific request types in their capabilities.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub task: ::std::option::Option<TaskMetadata>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub temperature: ::std::option::Option<f64>,
/**Controls how the model uses tools.
The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
Default is { mode: "auto" }.*/
#[serde(rename = "toolChoice", default, skip_serializing_if = "::std::option::Option::is_none")]
pub tool_choice: ::std::option::Option<ToolChoice>,
/**Tools that the model may use during generation.
The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub tools: ::std::vec::Vec<Tool>,
}
/**The client's response to a sampling/createMessage request from the server.
The client should inform the user before returning the sampled message, to allow them
to inspect the response (human in the loop) and decide whether to allow the server to see it.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The client's response to a sampling/createMessage request from the server.\nThe client should inform the user before returning the sampled message, to allow them\nto inspect the response (human in the loop) and decide whether to allow the server to see it.",
/// "type": "object",
/// "required": [
/// "content",
/// "model",
/// "role"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "content": {
/// "anyOf": [
/// {
/// "$ref": "#/$defs/TextContent"
/// },
/// {
/// "$ref": "#/$defs/ImageContent"
/// },
/// {
/// "$ref": "#/$defs/AudioContent"
/// },
/// {
/// "$ref": "#/$defs/ToolUseContent"
/// },
/// {
/// "$ref": "#/$defs/ToolResultContent"
/// },
/// {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/SamplingMessageContentBlock"
/// }
/// }
/// ]
/// },
/// "model": {
/// "description": "The name of the model that generated the message.",
/// "type": "string"
/// },
/// "role": {
/// "$ref": "#/$defs/Role"
/// },
/// "stopReason": {
/// "description": "The reason why sampling stopped, if known.\n\nStandard values:\n- \"endTurn\": Natural end of the assistant's turn\n- \"stopSequence\": A stop sequence was encountered\n- \"maxTokens\": Maximum token limit was reached\n- \"toolUse\": The model wants to use one or more tools\n\nThis field is an open string to allow for provider-specific stop reasons.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CreateMessageResult {
pub content: CreateMessageContent,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The name of the model that generated the message.
pub model: ::std::string::String,
pub role: Role,
/**The reason why sampling stopped, if known.
Standard values:
- "endTurn": Natural end of the assistant's turn
- "stopSequence": A stop sequence was encountered
- "maxTokens": Maximum token limit was reached
- "toolUse": The model wants to use one or more tools
This field is an open string to allow for provider-specific stop reasons.*/
#[serde(rename = "stopReason", default, skip_serializing_if = "::std::option::Option::is_none")]
pub stop_reason: ::std::option::Option<::std::string::String>,
}
///A response to a task-augmented request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A response to a task-augmented request.",
/// "type": "object",
/// "required": [
/// "task"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "task": {
/// "$ref": "#/$defs/Task"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CreateTaskResult {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
pub task: Task,
}
///An opaque token used to represent a cursor for pagination.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "An opaque token used to represent a cursor for pagination.",
/// "type": "string"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct Cursor(pub ::std::string::String);
///ElicitCompleteParams
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "elicitationId"
/// ],
/// "properties": {
/// "elicitationId": {
/// "description": "The ID of the elicitation that completed.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ElicitCompleteParams {
///The ID of the elicitation that completed.
#[serde(rename = "elicitationId")]
pub elicitation_id: ::std::string::String,
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ElicitFormMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
/**A restricted subset of JSON Schema.
Only top-level properties are allowed, without nesting.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A restricted subset of JSON Schema.\nOnly top-level properties are allowed, without nesting.",
/// "type": "object",
/// "required": [
/// "properties",
/// "type"
/// ],
/// "properties": {
/// "$schema": {
/// "type": "string"
/// },
/// "properties": {
/// "type": "object",
/// "additionalProperties": {
/// "$ref": "#/$defs/PrimitiveSchemaDefinition"
/// }
/// },
/// "required": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "type": {
/// "type": "string",
/// "const": "object"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ElicitFormSchema {
pub properties: std::collections::BTreeMap<::std::string::String, PrimitiveSchemaDefinition>,
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub required: ::std::vec::Vec<::std::string::String>,
#[serde(rename = "$schema", default, skip_serializing_if = "::std::option::Option::is_none")]
pub schema: ::std::option::Option<::std::string::String>,
#[serde(rename = "type", deserialize_with = "validate::elicit_form_schema_type_")]
type_: ::std::string::String,
}
impl ElicitFormSchema {
pub fn new(
properties: std::collections::BTreeMap<::std::string::String, PrimitiveSchemaDefinition>,
required: ::std::vec::Vec<::std::string::String>,
schema: ::std::option::Option<::std::string::String>,
) -> Self {
Self {
properties,
required,
schema,
type_: "object".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "object"
pub fn type_value() -> &'static str {
"object"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"object"
}
}
///A request from the server to elicit additional information from the user via the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request from the server to elicit additional information from the user via the client.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "elicitation/create"
/// },
/// "params": {
/// "$ref": "#/$defs/ElicitRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ElicitRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::elicit_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::elicit_request_method")]
method: ::std::string::String,
pub params: ElicitRequestParams,
}
impl ElicitRequest {
pub fn new(id: RequestId, params: ElicitRequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "elicitation/create".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "elicitation/create"
pub fn method_value() -> &'static str {
"elicitation/create"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"elicitation/create"
}
}
///The parameters for a request to elicit non-sensitive information from the user via a form in the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The parameters for a request to elicit non-sensitive information from the user via a form in the client.",
/// "type": "object",
/// "required": [
/// "message",
/// "requestedSchema"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "message": {
/// "description": "The message to present to the user describing what information is being requested.",
/// "type": "string"
/// },
/// "mode": {
/// "description": "The elicitation mode.",
/// "type": "string",
/// "const": "form"
/// },
/// "requestedSchema": {
/// "description": "A restricted subset of JSON Schema.\nOnly top-level properties are allowed, without nesting.",
/// "type": "object",
/// "required": [
/// "properties",
/// "type"
/// ],
/// "properties": {
/// "$schema": {
/// "type": "string"
/// },
/// "properties": {
/// "type": "object",
/// "additionalProperties": {
/// "$ref": "#/$defs/PrimitiveSchemaDefinition"
/// }
/// },
/// "required": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "type": {
/// "type": "string",
/// "const": "object"
/// }
/// }
/// },
/// "task": {
/// "description": "If specified, the caller is requesting task-augmented execution for this request.\nThe request will return a CreateTaskResult immediately, and the actual result can be\nretrieved later via tasks/result.\n\nTask augmentation is subject to capability negotiation - receivers MUST declare support\nfor task augmentation of specific request types in their capabilities.",
/// "$ref": "#/$defs/TaskMetadata"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ElicitRequestFormParams {
///The message to present to the user describing what information is being requested.
pub message: ::std::string::String,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ElicitFormMeta>,
///The elicitation mode.
#[serde(
default,
skip_serializing_if = "::std::option::Option::is_none",
deserialize_with = "validate::elicit_request_form_params_mode"
)]
mode: ::std::option::Option<::std::string::String>,
#[serde(rename = "requestedSchema")]
pub requested_schema: ElicitFormSchema,
/**If specified, the caller is requesting task-augmented execution for this request.
The request will return a CreateTaskResult immediately, and the actual result can be
retrieved later via tasks/result.
Task augmentation is subject to capability negotiation - receivers MUST declare support
for task augmentation of specific request types in their capabilities.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub task: ::std::option::Option<TaskMetadata>,
}
impl ElicitRequestFormParams {
pub fn new(
message: ::std::string::String,
requested_schema: ElicitFormSchema,
meta: ::std::option::Option<ElicitFormMeta>,
task: ::std::option::Option<TaskMetadata>,
) -> Self {
Self {
message,
meta,
mode: Some("form".to_string()),
requested_schema,
task,
}
}
pub fn mode(&self) -> &::std::option::Option<::std::string::String> {
&self.mode
}
/// returns "form"
pub fn mode_value() -> &'static str {
"form"
}
#[deprecated(since = "0.8.0", note = "Use `mode_value()` instead.")]
pub fn mode_name() -> &'static str {
"form"
}
}
///The parameters for a request to elicit additional information from the user via the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The parameters for a request to elicit additional information from the user via the client.",
/// "anyOf": [
/// {
/// "$ref": "#/$defs/ElicitRequestURLParams"
/// },
/// {
/// "$ref": "#/$defs/ElicitRequestFormParams"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ElicitRequestParams {
UrlParams(ElicitRequestUrlParams),
FormParams(ElicitRequestFormParams),
}
impl ::std::convert::From<ElicitRequestUrlParams> for ElicitRequestParams {
fn from(value: ElicitRequestUrlParams) -> Self {
Self::UrlParams(value)
}
}
impl ::std::convert::From<ElicitRequestFormParams> for ElicitRequestParams {
fn from(value: ElicitRequestFormParams) -> Self {
Self::FormParams(value)
}
}
///The parameters for a request to elicit information from the user via a URL in the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The parameters for a request to elicit information from the user via a URL in the client.",
/// "type": "object",
/// "required": [
/// "elicitationId",
/// "message",
/// "mode",
/// "url"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "elicitationId": {
/// "description": "The ID of the elicitation, which must be unique within the context of the server.\nThe client MUST treat this ID as an opaque value.",
/// "type": "string"
/// },
/// "message": {
/// "description": "The message to present to the user explaining why the interaction is needed.",
/// "type": "string"
/// },
/// "mode": {
/// "description": "The elicitation mode.",
/// "type": "string",
/// "const": "url"
/// },
/// "task": {
/// "description": "If specified, the caller is requesting task-augmented execution for this request.\nThe request will return a CreateTaskResult immediately, and the actual result can be\nretrieved later via tasks/result.\n\nTask augmentation is subject to capability negotiation - receivers MUST declare support\nfor task augmentation of specific request types in their capabilities.",
/// "$ref": "#/$defs/TaskMetadata"
/// },
/// "url": {
/// "description": "The URL that the user should navigate to.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ElicitRequestUrlParams {
/**The ID of the elicitation, which must be unique within the context of the server.
The client MUST treat this ID as an opaque value.*/
#[serde(rename = "elicitationId")]
pub elicitation_id: ::std::string::String,
///The message to present to the user explaining why the interaction is needed.
pub message: ::std::string::String,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ElicitUrlMeta>,
///The elicitation mode.
#[serde(deserialize_with = "validate::elicit_request_url_params_mode")]
mode: ::std::string::String,
/**If specified, the caller is requesting task-augmented execution for this request.
The request will return a CreateTaskResult immediately, and the actual result can be
retrieved later via tasks/result.
Task augmentation is subject to capability negotiation - receivers MUST declare support
for task augmentation of specific request types in their capabilities.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub task: ::std::option::Option<TaskMetadata>,
///The URL that the user should navigate to.
pub url: ::std::string::String,
}
impl ElicitRequestUrlParams {
pub fn new(
elicitation_id: ::std::string::String,
message: ::std::string::String,
url: ::std::string::String,
meta: ::std::option::Option<ElicitUrlMeta>,
task: ::std::option::Option<TaskMetadata>,
) -> Self {
Self {
elicitation_id,
message,
meta,
mode: "url".to_string(),
task,
url,
}
}
pub fn mode(&self) -> &::std::string::String {
&self.mode
}
/// returns "url"
pub fn mode_value() -> &'static str {
"url"
}
#[deprecated(since = "0.8.0", note = "Use `mode_value()` instead.")]
pub fn mode_name() -> &'static str {
"url"
}
}
///The client's response to an elicitation request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The client's response to an elicitation request.",
/// "type": "object",
/// "required": [
/// "action"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "action": {
/// "description": "The user action in response to the elicitation.\n- \"accept\": User submitted the form/confirmed the action\n- \"decline\": User explicitly decline the action\n- \"cancel\": User dismissed without making an explicit choice",
/// "type": "string",
/// "enum": [
/// "accept",
/// "cancel",
/// "decline"
/// ]
/// },
/// "content": {
/// "description": "The submitted form data, only present when action is \"accept\" and mode was \"form\".\nContains values matching the requested schema.\nOmitted for out-of-band mode responses.",
/// "type": "object",
/// "additionalProperties": {
/// "anyOf": [
/// {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// {
/// "type": [
/// "string",
/// "integer",
/// "boolean"
/// ]
/// }
/// ]
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ElicitResult {
/**The user action in response to the elicitation.
- "accept": User submitted the form/confirmed the action
- "decline": User explicitly decline the action
- "cancel": User dismissed without making an explicit choice*/
pub action: ElicitResultAction,
/**The submitted form data, only present when action is "accept" and mode was "form".
Contains values matching the requested schema.
Omitted for out-of-band mode responses.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub content: ::std::option::Option<std::collections::BTreeMap<::std::string::String, ElicitResultContent>>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
/**The user action in response to the elicitation.
- "accept": User submitted the form/confirmed the action
- "decline": User explicitly decline the action
- "cancel": User dismissed without making an explicit choice*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The user action in response to the elicitation.\n- \"accept\": User submitted the form/confirmed the action\n- \"decline\": User explicitly decline the action\n- \"cancel\": User dismissed without making an explicit choice",
/// "type": "string",
/// "enum": [
/// "accept",
/// "cancel",
/// "decline"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ElicitResultAction {
#[serde(rename = "accept")]
Accept,
#[serde(rename = "cancel")]
Cancel,
#[serde(rename = "decline")]
Decline,
}
impl ::std::fmt::Display for ElicitResultAction {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Accept => write!(f, "accept"),
Self::Cancel => write!(f, "cancel"),
Self::Decline => write!(f, "decline"),
}
}
}
///ElicitResultContent
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// {
/// "type": [
/// "string",
/// "integer",
/// "boolean"
/// ]
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ElicitResultContent {
StringArray(::std::vec::Vec<::std::string::String>),
Primitive(ElicitResultContentPrimitive),
}
impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for ElicitResultContent {
fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
Self::StringArray(value)
}
}
impl ::std::convert::From<ElicitResultContentPrimitive> for ElicitResultContent {
fn from(value: ElicitResultContentPrimitive) -> Self {
Self::Primitive(value)
}
}
///ElicitResultContentPrimitive
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": [
/// "string",
/// "integer",
/// "boolean"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ElicitResultContentPrimitive {
Boolean(bool),
String(::std::string::String),
Integer(i64),
}
impl ::std::convert::From<bool> for ElicitResultContentPrimitive {
fn from(value: bool) -> Self {
Self::Boolean(value)
}
}
impl ::std::convert::From<i64> for ElicitResultContentPrimitive {
fn from(value: i64) -> Self {
Self::Integer(value)
}
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ElicitUrlMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///An optional notification from the server to the client, informing it of a completion of a out-of-band elicitation request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "An optional notification from the server to the client, informing it of a completion of a out-of-band elicitation request.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "notifications/elicitation/complete"
/// },
/// "params": {
/// "type": "object",
/// "required": [
/// "elicitationId"
/// ],
/// "properties": {
/// "elicitationId": {
/// "description": "The ID of the elicitation that completed.",
/// "type": "string"
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ElicitationCompleteNotification {
#[serde(deserialize_with = "validate::elicitation_complete_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::elicitation_complete_notification_method")]
method: ::std::string::String,
pub params: ElicitCompleteParams,
}
impl ElicitationCompleteNotification {
pub fn new(params: ElicitCompleteParams) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method: "notifications/elicitation/complete".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/elicitation/complete"
pub fn method_value() -> &'static str {
"notifications/elicitation/complete"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/elicitation/complete"
}
}
/**The contents of a resource, embedded into a prompt or tool call result.
It is up to the client how best to render embedded resources for the benefit
of the LLM and/or the user.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The contents of a resource, embedded into a prompt or tool call result.\n\nIt is up to the client how best to render embedded resources for the benefit\nof the LLM and/or the user.",
/// "type": "object",
/// "required": [
/// "resource",
/// "type"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "annotations": {
/// "description": "Optional annotations for the client.",
/// "$ref": "#/$defs/Annotations"
/// },
/// "resource": {
/// "anyOf": [
/// {
/// "$ref": "#/$defs/TextResourceContents"
/// },
/// {
/// "$ref": "#/$defs/BlobResourceContents"
/// }
/// ]
/// },
/// "type": {
/// "type": "string",
/// "const": "resource"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct EmbeddedResource {
///Optional annotations for the client.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub annotations: ::std::option::Option<Annotations>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
pub resource: EmbeddedResourceResource,
#[serde(rename = "type", deserialize_with = "validate::embedded_resource_type_")]
type_: ::std::string::String,
}
impl EmbeddedResource {
pub fn new(
resource: EmbeddedResourceResource,
annotations: ::std::option::Option<Annotations>,
meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
) -> Self {
Self {
annotations,
meta,
resource,
type_: "resource".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "resource"
pub fn type_value() -> &'static str {
"resource"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"resource"
}
}
///EmbeddedResourceResource
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/TextResourceContents"
/// },
/// {
/// "$ref": "#/$defs/BlobResourceContents"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum EmbeddedResourceResource {
TextResourceContents(TextResourceContents),
BlobResourceContents(BlobResourceContents),
}
impl ::std::convert::From<TextResourceContents> for EmbeddedResourceResource {
fn from(value: TextResourceContents) -> Self {
Self::TextResourceContents(value)
}
}
impl ::std::convert::From<BlobResourceContents> for EmbeddedResourceResource {
fn from(value: BlobResourceContents) -> Self {
Self::BlobResourceContents(value)
}
}
///EmptyResult
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$ref": "#/$defs/Result"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct EmptyResult(pub Result);
///EnumSchema
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/UntitledSingleSelectEnumSchema"
/// },
/// {
/// "$ref": "#/$defs/TitledSingleSelectEnumSchema"
/// },
/// {
/// "$ref": "#/$defs/UntitledMultiSelectEnumSchema"
/// },
/// {
/// "$ref": "#/$defs/TitledMultiSelectEnumSchema"
/// },
/// {
/// "$ref": "#/$defs/LegacyTitledEnumSchema"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum EnumSchema {
UntitledSingleSelectEnumSchema(UntitledSingleSelectEnumSchema),
TitledSingleSelectEnumSchema(TitledSingleSelectEnumSchema),
UntitledMultiSelectEnumSchema(UntitledMultiSelectEnumSchema),
TitledMultiSelectEnumSchema(TitledMultiSelectEnumSchema),
LegacyTitledEnumSchema(LegacyTitledEnumSchema),
}
impl ::std::convert::From<UntitledSingleSelectEnumSchema> for EnumSchema {
fn from(value: UntitledSingleSelectEnumSchema) -> Self {
Self::UntitledSingleSelectEnumSchema(value)
}
}
impl ::std::convert::From<TitledSingleSelectEnumSchema> for EnumSchema {
fn from(value: TitledSingleSelectEnumSchema) -> Self {
Self::TitledSingleSelectEnumSchema(value)
}
}
impl ::std::convert::From<UntitledMultiSelectEnumSchema> for EnumSchema {
fn from(value: UntitledMultiSelectEnumSchema) -> Self {
Self::UntitledMultiSelectEnumSchema(value)
}
}
impl ::std::convert::From<TitledMultiSelectEnumSchema> for EnumSchema {
fn from(value: TitledMultiSelectEnumSchema) -> Self {
Self::TitledMultiSelectEnumSchema(value)
}
}
impl ::std::convert::From<LegacyTitledEnumSchema> for EnumSchema {
fn from(value: LegacyTitledEnumSchema) -> Self {
Self::LegacyTitledEnumSchema(value)
}
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct GetPromptMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///Used by the client to get a prompt provided by the server.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Used by the client to get a prompt provided by the server.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "prompts/get"
/// },
/// "params": {
/// "$ref": "#/$defs/GetPromptRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct GetPromptRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::get_prompt_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::get_prompt_request_method")]
method: ::std::string::String,
pub params: GetPromptRequestParams,
}
impl GetPromptRequest {
pub fn new(id: RequestId, params: GetPromptRequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "prompts/get".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "prompts/get"
pub fn method_value() -> &'static str {
"prompts/get"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"prompts/get"
}
}
///Parameters for a prompts/get request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a prompts/get request.",
/// "type": "object",
/// "required": [
/// "name"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "arguments": {
/// "description": "Arguments to use for templating the prompt.",
/// "type": "object",
/// "additionalProperties": {
/// "type": "string"
/// }
/// },
/// "name": {
/// "description": "The name of the prompt or prompt template.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct GetPromptRequestParams {
///Arguments to use for templating the prompt.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub arguments: ::std::option::Option<std::collections::BTreeMap<::std::string::String, ::std::string::String>>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<GetPromptMeta>,
///The name of the prompt or prompt template.
pub name: ::std::string::String,
}
///The server's response to a prompts/get request from the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The server's response to a prompts/get request from the client.",
/// "type": "object",
/// "required": [
/// "messages"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "description": {
/// "description": "An optional description for the prompt.",
/// "type": "string"
/// },
/// "messages": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/PromptMessage"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct GetPromptResult {
///An optional description for the prompt.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
pub messages: ::std::vec::Vec<PromptMessage>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///GetTaskParams
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "taskId"
/// ],
/// "properties": {
/// "taskId": {
/// "description": "The task identifier to query.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct GetTaskParams {
///The task identifier to query.
#[serde(rename = "taskId")]
pub task_id: ::std::string::String,
}
///GetTaskPayloadParams
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "taskId"
/// ],
/// "properties": {
/// "taskId": {
/// "description": "The task identifier to retrieve results for.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct GetTaskPayloadParams {
///The task identifier to retrieve results for.
#[serde(rename = "taskId")]
pub task_id: ::std::string::String,
}
///A request to retrieve the result of a completed task.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request to retrieve the result of a completed task.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "tasks/result"
/// },
/// "params": {
/// "type": "object",
/// "required": [
/// "taskId"
/// ],
/// "properties": {
/// "taskId": {
/// "description": "The task identifier to retrieve results for.",
/// "type": "string"
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct GetTaskPayloadRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::get_task_payload_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::get_task_payload_request_method")]
method: ::std::string::String,
pub params: GetTaskPayloadParams,
}
impl GetTaskPayloadRequest {
pub fn new(id: RequestId, params: GetTaskPayloadParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "tasks/result".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "tasks/result"
pub fn method_value() -> &'static str {
"tasks/result"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"tasks/result"
}
}
/**The response to a tasks/result request.
The structure matches the result type of the original request.
For example, a tools/call task would return the CallToolResult structure.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The response to a tasks/result request.\nThe structure matches the result type of the original request.\nFor example, a tools/call task would return the CallToolResult structure.",
/// "type": "object",
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct GetTaskPayloadResult {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///A request to retrieve the state of a task.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request to retrieve the state of a task.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "tasks/get"
/// },
/// "params": {
/// "type": "object",
/// "required": [
/// "taskId"
/// ],
/// "properties": {
/// "taskId": {
/// "description": "The task identifier to query.",
/// "type": "string"
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct GetTaskRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::get_task_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::get_task_request_method")]
method: ::std::string::String,
pub params: GetTaskParams,
}
impl GetTaskRequest {
pub fn new(id: RequestId, params: GetTaskParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "tasks/get".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "tasks/get"
pub fn method_value() -> &'static str {
"tasks/get"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"tasks/get"
}
}
///The response to a tasks/get request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The response to a tasks/get request.",
/// "allOf": [
/// {
/// "$ref": "#/$defs/Result"
/// },
/// {
/// "$ref": "#/$defs/Task"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct GetTaskResult {
#[serde(rename = "createdAt")]
pub created_at: ::std::string::String,
#[serde(rename = "lastUpdatedAt")]
pub last_updated_at: ::std::string::String,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
#[serde(rename = "pollInterval", default, skip_serializing_if = "::std::option::Option::is_none")]
pub poll_interval: ::std::option::Option<i64>,
pub status: TaskStatus,
#[serde(rename = "statusMessage", default, skip_serializing_if = "::std::option::Option::is_none")]
pub status_message: ::std::option::Option<::std::string::String>,
#[serde(rename = "taskId")]
pub task_id: ::std::string::String,
pub ttl: i64,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///An optionally-sized icon that can be displayed in a user interface.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "An optionally-sized icon that can be displayed in a user interface.",
/// "type": "object",
/// "required": [
/// "src"
/// ],
/// "properties": {
/// "mimeType": {
/// "description": "Optional MIME type override if the source MIME type is missing or generic.\nFor example: \"image/png\", \"image/jpeg\", or \"image/svg+xml\".",
/// "type": "string"
/// },
/// "sizes": {
/// "description": "Optional array of strings that specify sizes at which the icon can be used.\nEach string should be in WxH format (e.g., \"48x48\", \"96x96\") or \"any\" for scalable formats like SVG.\n\nIf not provided, the client should assume that the icon can be used at any size.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "src": {
/// "description": "A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a\ndata: URI with Base64-encoded image data.\n\nConsumers SHOULD takes steps to ensure URLs serving icons are from the\nsame domain as the client/server or a trusted domain.\n\nConsumers SHOULD take appropriate precautions when consuming SVGs as they can contain\nexecutable JavaScript.",
/// "type": "string",
/// "format": "uri"
/// },
/// "theme": {
/// "description": "Optional specifier for the theme this icon is designed for. light indicates\nthe icon is designed to be used with a light background, and dark indicates\nthe icon is designed to be used with a dark background.\n\nIf not provided, the client should assume the icon can be used with any theme.",
/// "type": "string",
/// "enum": [
/// "dark",
/// "light"
/// ]
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct Icon {
/**Optional MIME type override if the source MIME type is missing or generic.
For example: "image/png", "image/jpeg", or "image/svg+xml".*/
#[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
pub mime_type: ::std::option::Option<::std::string::String>,
/**Optional array of strings that specify sizes at which the icon can be used.
Each string should be in WxH format (e.g., "48x48", "96x96") or "any" for scalable formats like SVG.
If not provided, the client should assume that the icon can be used at any size.*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub sizes: ::std::vec::Vec<::std::string::String>,
/**A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a
data: URI with Base64-encoded image data.
Consumers SHOULD takes steps to ensure URLs serving icons are from the
same domain as the client/server or a trusted domain.
Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain
executable JavaScript.*/
pub src: ::std::string::String,
/**Optional specifier for the theme this icon is designed for. light indicates
the icon is designed to be used with a light background, and dark indicates
the icon is designed to be used with a dark background.
If not provided, the client should assume the icon can be used with any theme.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub theme: ::std::option::Option<IconTheme>,
}
/**Optional specifier for the theme this icon is designed for. light indicates
the icon is designed to be used with a light background, and dark indicates
the icon is designed to be used with a dark background.
If not provided, the client should assume the icon can be used with any theme.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Optional specifier for the theme this icon is designed for. light indicates\nthe icon is designed to be used with a light background, and dark indicates\nthe icon is designed to be used with a dark background.\n\nIf not provided, the client should assume the icon can be used with any theme.",
/// "type": "string",
/// "enum": [
/// "dark",
/// "light"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum IconTheme {
#[serde(rename = "dark")]
Dark,
#[serde(rename = "light")]
Light,
}
impl ::std::fmt::Display for IconTheme {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Dark => write!(f, "dark"),
Self::Light => write!(f, "light"),
}
}
}
///Base interface to add icons property.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Base interface to add icons property.",
/// "type": "object",
/// "properties": {
/// "icons": {
/// "description": "Optional set of sized icons that the client can display in a user interface.\n\nClients that support rendering icons MUST support at least the following MIME types:\n- image/png - PNG images (safe, universal compatibility)\n- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)\n\nClients that support rendering icons SHOULD also support:\n- image/svg+xml - SVG images (scalable but requires security precautions)\n- image/webp - WebP images (modern, efficient format)",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Icon"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct Icons {
/**Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
- image/png - PNG images (safe, universal compatibility)
- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
- image/svg+xml - SVG images (scalable but requires security precautions)
- image/webp - WebP images (modern, efficient format)*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub icons: ::std::vec::Vec<Icon>,
}
///An image provided to or from an LLM.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "An image provided to or from an LLM.",
/// "type": "object",
/// "required": [
/// "data",
/// "mimeType",
/// "type"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "annotations": {
/// "description": "Optional annotations for the client.",
/// "$ref": "#/$defs/Annotations"
/// },
/// "data": {
/// "description": "The base64-encoded image data.",
/// "type": "string",
/// "format": "byte"
/// },
/// "mimeType": {
/// "description": "The MIME type of the image. Different providers may support different image types.",
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "image"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ImageContent {
///Optional annotations for the client.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub annotations: ::std::option::Option<Annotations>,
///The base64-encoded image data.
pub data: ::std::string::String,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The MIME type of the image. Different providers may support different image types.
#[serde(rename = "mimeType")]
pub mime_type: ::std::string::String,
#[serde(rename = "type", deserialize_with = "validate::image_content_type_")]
type_: ::std::string::String,
}
impl ImageContent {
pub fn new(
data: ::std::string::String,
mime_type: ::std::string::String,
annotations: ::std::option::Option<Annotations>,
meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
) -> Self {
Self {
annotations,
data,
meta,
mime_type,
type_: "image".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "image"
pub fn type_value() -> &'static str {
"image"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"image"
}
}
///Describes the MCP implementation.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Describes the MCP implementation.",
/// "type": "object",
/// "required": [
/// "name",
/// "version"
/// ],
/// "properties": {
/// "description": {
/// "description": "An optional human-readable description of what this implementation does.\n\nThis can be used by clients or servers to provide context about their purpose\nand capabilities. For example, a server might describe the types of resources\nor tools it provides, while a client might describe its intended use case.",
/// "type": "string"
/// },
/// "icons": {
/// "description": "Optional set of sized icons that the client can display in a user interface.\n\nClients that support rendering icons MUST support at least the following MIME types:\n- image/png - PNG images (safe, universal compatibility)\n- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)\n\nClients that support rendering icons SHOULD also support:\n- image/svg+xml - SVG images (scalable but requires security precautions)\n- image/webp - WebP images (modern, efficient format)",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Icon"
/// }
/// },
/// "name": {
/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
/// "type": "string"
/// },
/// "title": {
/// "description": "Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\neven by those unfamiliar with domain-specific terminology.\n\nIf not provided, the name should be used for display (except for Tool,\nwhere annotations.title should be given precedence over using name,\nif present).",
/// "type": "string"
/// },
/// "version": {
/// "type": "string"
/// },
/// "websiteUrl": {
/// "description": "An optional URL of the website for this implementation.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct Implementation {
/**An optional human-readable description of what this implementation does.
This can be used by clients or servers to provide context about their purpose
and capabilities. For example, a server might describe the types of resources
or tools it provides, while a client might describe its intended use case.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
/**Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
- image/png - PNG images (safe, universal compatibility)
- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
- image/svg+xml - SVG images (scalable but requires security precautions)
- image/webp - WebP images (modern, efficient format)*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub icons: ::std::vec::Vec<Icon>,
///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
pub name: ::std::string::String,
/**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
even by those unfamiliar with domain-specific terminology.
If not provided, the name should be used for display (except for Tool,
where annotations.title should be given precedence over using name,
if present).*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
pub version: ::std::string::String,
///An optional URL of the website for this implementation.
#[serde(rename = "websiteUrl", default, skip_serializing_if = "::std::option::Option::is_none")]
pub website_url: ::std::option::Option<::std::string::String>,
}
/**A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.
The client MAY ignore this request.
Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client
declares ClientCapabilities.sampling.context. These values may be removed in future spec releases.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.\nThe client MAY ignore this request.\n\nDefault is \"none\". Values \"thisServer\" and \"allServers\" are soft-deprecated. Servers SHOULD only use these values if the client\ndeclares ClientCapabilities.sampling.context. These values may be removed in future spec releases.",
/// "type": "string",
/// "enum": [
/// "allServers",
/// "none",
/// "thisServer"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum IncludeContext {
#[serde(rename = "allServers")]
AllServers,
#[serde(rename = "none")]
None,
#[serde(rename = "thisServer")]
ThisServer,
}
impl ::std::fmt::Display for IncludeContext {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::AllServers => write!(f, "allServers"),
Self::None => write!(f, "none"),
Self::ThisServer => write!(f, "thisServer"),
}
}
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct InitializeMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///This request is sent from the client to the server when it first connects, asking it to begin initialization.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "This request is sent from the client to the server when it first connects, asking it to begin initialization.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "initialize"
/// },
/// "params": {
/// "$ref": "#/$defs/InitializeRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct InitializeRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::initialize_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::initialize_request_method")]
method: ::std::string::String,
pub params: InitializeRequestParams,
}
impl InitializeRequest {
pub fn new(id: RequestId, params: InitializeRequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "initialize".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "initialize"
pub fn method_value() -> &'static str {
"initialize"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"initialize"
}
}
///Parameters for an initialize request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for an initialize request.",
/// "type": "object",
/// "required": [
/// "capabilities",
/// "clientInfo",
/// "protocolVersion"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "capabilities": {
/// "$ref": "#/$defs/ClientCapabilities"
/// },
/// "clientInfo": {
/// "$ref": "#/$defs/Implementation"
/// },
/// "protocolVersion": {
/// "description": "The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct InitializeRequestParams {
pub capabilities: ClientCapabilities,
#[serde(rename = "clientInfo")]
pub client_info: Implementation,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<InitializeMeta>,
///The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
#[serde(rename = "protocolVersion")]
pub protocol_version: ::std::string::String,
}
///After receiving an initialize request from the client, the server sends this response.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "After receiving an initialize request from the client, the server sends this response.",
/// "type": "object",
/// "required": [
/// "capabilities",
/// "protocolVersion",
/// "serverInfo"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "capabilities": {
/// "$ref": "#/$defs/ServerCapabilities"
/// },
/// "instructions": {
/// "description": "Instructions describing how to use the server and its features.\n\nThis can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a \"hint\" to the model. For example, this information MAY be added to the system prompt.",
/// "type": "string"
/// },
/// "protocolVersion": {
/// "description": "The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.",
/// "type": "string"
/// },
/// "serverInfo": {
/// "$ref": "#/$defs/Implementation"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct InitializeResult {
pub capabilities: ServerCapabilities,
/**Instructions describing how to use the server and its features.
This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub instructions: ::std::option::Option<::std::string::String>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.
#[serde(rename = "protocolVersion")]
pub protocol_version: ::std::string::String,
#[serde(rename = "serverInfo")]
pub server_info: Implementation,
}
///This notification is sent from the client to the server after initialization has finished.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "This notification is sent from the client to the server after initialization has finished.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "notifications/initialized"
/// },
/// "params": {
/// "$ref": "#/$defs/NotificationParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct InitializedNotification {
#[serde(deserialize_with = "validate::initialized_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::initialized_notification_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<NotificationParams>,
}
impl InitializedNotification {
pub fn new(params: ::std::option::Option<NotificationParams>) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method: "notifications/initialized".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/initialized"
pub fn method_value() -> &'static str {
"notifications/initialized"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/initialized"
}
}
///A response to a request that indicates an error occurred.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A response to a request that indicates an error occurred.",
/// "type": "object",
/// "required": [
/// "error",
/// "jsonrpc"
/// ],
/// "properties": {
/// "error": {
/// "$ref": "#/$defs/Error"
/// },
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct JsonrpcErrorResponse {
pub error: RpcError,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub id: ::std::option::Option<RequestId>,
#[serde(deserialize_with = "validate::jsonrpc_error_response_jsonrpc")]
jsonrpc: ::std::string::String,
}
impl JsonrpcErrorResponse {
pub fn new(error: RpcError, id: ::std::option::Option<RequestId>) -> Self {
Self {
error,
id,
jsonrpc: JSONRPC_VERSION.to_string(),
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.",
/// "anyOf": [
/// {
/// "$ref": "#/$defs/JSONRPCRequest"
/// },
/// {
/// "$ref": "#/$defs/JSONRPCNotification"
/// },
/// {
/// "$ref": "#/$defs/JSONRPCResultResponse"
/// },
/// {
/// "$ref": "#/$defs/JSONRPCErrorResponse"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum JsonrpcMessage {
Request(JsonrpcRequest),
Notification(JsonrpcNotification),
ResultResponse(JsonrpcResultResponse),
ErrorResponse(JsonrpcErrorResponse),
}
impl ::std::convert::From<JsonrpcRequest> for JsonrpcMessage {
fn from(value: JsonrpcRequest) -> Self {
Self::Request(value)
}
}
impl ::std::convert::From<JsonrpcNotification> for JsonrpcMessage {
fn from(value: JsonrpcNotification) -> Self {
Self::Notification(value)
}
}
impl ::std::convert::From<JsonrpcResultResponse> for JsonrpcMessage {
fn from(value: JsonrpcResultResponse) -> Self {
Self::ResultResponse(value)
}
}
impl ::std::convert::From<JsonrpcErrorResponse> for JsonrpcMessage {
fn from(value: JsonrpcErrorResponse) -> Self {
Self::ErrorResponse(value)
}
}
///A notification which does not expect a response.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A notification which does not expect a response.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string"
/// },
/// "params": {
/// "type": "object",
/// "additionalProperties": {}
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct JsonrpcNotification {
#[serde(deserialize_with = "validate::jsonrpc_notification_jsonrpc")]
jsonrpc: ::std::string::String,
pub method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
impl JsonrpcNotification {
pub fn new(
method: ::std::string::String,
params: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method,
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///A request that expects a response.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request that expects a response.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string"
/// },
/// "params": {
/// "type": "object",
/// "additionalProperties": {}
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct JsonrpcRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::jsonrpc_request_jsonrpc")]
jsonrpc: ::std::string::String,
pub method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
impl JsonrpcRequest {
pub fn new(
id: RequestId,
method: ::std::string::String,
params: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method,
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///A response to a request, containing either the result or error.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A response to a request, containing either the result or error.",
/// "anyOf": [
/// {
/// "$ref": "#/$defs/JSONRPCResultResponse"
/// },
/// {
/// "$ref": "#/$defs/JSONRPCErrorResponse"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum JsonrpcResponse {
ResultResponse(JsonrpcResultResponse),
ErrorResponse(JsonrpcErrorResponse),
}
impl ::std::convert::From<JsonrpcResultResponse> for JsonrpcResponse {
fn from(value: JsonrpcResultResponse) -> Self {
Self::ResultResponse(value)
}
}
impl ::std::convert::From<JsonrpcErrorResponse> for JsonrpcResponse {
fn from(value: JsonrpcErrorResponse) -> Self {
Self::ErrorResponse(value)
}
}
///A successful (non-error) response to a request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A successful (non-error) response to a request.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "result"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "result": {
/// "$ref": "#/$defs/Result"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct JsonrpcResultResponse {
pub id: RequestId,
#[serde(deserialize_with = "validate::jsonrpc_result_response_jsonrpc")]
jsonrpc: ::std::string::String,
pub result: Result,
}
impl JsonrpcResultResponse {
pub fn new(id: RequestId, result: Result) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
result,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
/**Use TitledSingleSelectEnumSchema instead.
This interface will be removed in a future version.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Use TitledSingleSelectEnumSchema instead.\nThis interface will be removed in a future version.",
/// "type": "object",
/// "required": [
/// "enum",
/// "type"
/// ],
/// "properties": {
/// "default": {
/// "type": "string"
/// },
/// "description": {
/// "type": "string"
/// },
/// "enum": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "enumNames": {
/// "description": "(Legacy) Display names for enum values.\nNon-standard according to JSON schema 2020-12.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "title": {
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct LegacyTitledEnumSchema {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub default: ::std::option::Option<::std::string::String>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
#[serde(rename = "enum")]
pub enum_: ::std::vec::Vec<::std::string::String>,
/**(Legacy) Display names for enum values.
Non-standard according to JSON schema 2020-12.*/
#[serde(rename = "enumNames", default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub enum_names: ::std::vec::Vec<::std::string::String>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
#[serde(rename = "type", deserialize_with = "validate::legacy_titled_enum_schema_type_")]
type_: ::std::string::String,
}
impl LegacyTitledEnumSchema {
pub fn new(
enum_: ::std::vec::Vec<::std::string::String>,
enum_names: ::std::vec::Vec<::std::string::String>,
default: ::std::option::Option<::std::string::String>,
description: ::std::option::Option<::std::string::String>,
title: ::std::option::Option<::std::string::String>,
) -> Self {
Self {
default,
description,
enum_,
enum_names,
title,
type_: "string".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "string"
pub fn type_value() -> &'static str {
"string"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"string"
}
}
///Sent from the client to request a list of prompts and prompt templates the server has.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Sent from the client to request a list of prompts and prompt templates the server has.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "prompts/list"
/// },
/// "params": {
/// "$ref": "#/$defs/PaginatedRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListPromptsRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::list_prompts_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::list_prompts_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<PaginatedRequestParams>,
}
impl ListPromptsRequest {
pub fn new(id: RequestId, params: ::std::option::Option<PaginatedRequestParams>) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "prompts/list".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "prompts/list"
pub fn method_value() -> &'static str {
"prompts/list"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"prompts/list"
}
}
///The server's response to a prompts/list request from the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The server's response to a prompts/list request from the client.",
/// "type": "object",
/// "required": [
/// "prompts"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "nextCursor": {
/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
/// "type": "string"
/// },
/// "prompts": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Prompt"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListPromptsResult {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
/**An opaque token representing the pagination position after the last returned result.
If present, there may be more results available.*/
#[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
pub next_cursor: ::std::option::Option<::std::string::String>,
pub prompts: ::std::vec::Vec<Prompt>,
}
///Sent from the client to request a list of resource templates the server has.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Sent from the client to request a list of resource templates the server has.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "resources/templates/list"
/// },
/// "params": {
/// "$ref": "#/$defs/PaginatedRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListResourceTemplatesRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::list_resource_templates_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::list_resource_templates_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<PaginatedRequestParams>,
}
impl ListResourceTemplatesRequest {
pub fn new(id: RequestId, params: ::std::option::Option<PaginatedRequestParams>) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "resources/templates/list".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "resources/templates/list"
pub fn method_value() -> &'static str {
"resources/templates/list"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"resources/templates/list"
}
}
///The server's response to a resources/templates/list request from the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The server's response to a resources/templates/list request from the client.",
/// "type": "object",
/// "required": [
/// "resourceTemplates"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "nextCursor": {
/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
/// "type": "string"
/// },
/// "resourceTemplates": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/ResourceTemplate"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListResourceTemplatesResult {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
/**An opaque token representing the pagination position after the last returned result.
If present, there may be more results available.*/
#[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
pub next_cursor: ::std::option::Option<::std::string::String>,
#[serde(rename = "resourceTemplates")]
pub resource_templates: ::std::vec::Vec<ResourceTemplate>,
}
///Sent from the client to request a list of resources the server has.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Sent from the client to request a list of resources the server has.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "resources/list"
/// },
/// "params": {
/// "$ref": "#/$defs/PaginatedRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListResourcesRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::list_resources_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::list_resources_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<PaginatedRequestParams>,
}
impl ListResourcesRequest {
pub fn new(id: RequestId, params: ::std::option::Option<PaginatedRequestParams>) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "resources/list".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "resources/list"
pub fn method_value() -> &'static str {
"resources/list"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"resources/list"
}
}
///The server's response to a resources/list request from the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The server's response to a resources/list request from the client.",
/// "type": "object",
/// "required": [
/// "resources"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "nextCursor": {
/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
/// "type": "string"
/// },
/// "resources": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Resource"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListResourcesResult {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
/**An opaque token representing the pagination position after the last returned result.
If present, there may be more results available.*/
#[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
pub next_cursor: ::std::option::Option<::std::string::String>,
pub resources: ::std::vec::Vec<Resource>,
}
/**Sent from the server to request a list of root URIs from the client. Roots allow
servers to ask for specific directories or files to operate on. A common example
for roots is providing a set of repositories or directories a server should operate
on.
This request is typically used when the server needs to understand the file system
structure or access specific locations that the client has permission to read from.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Sent from the server to request a list of root URIs from the client. Roots allow\nservers to ask for specific directories or files to operate on. A common example\nfor roots is providing a set of repositories or directories a server should operate\non.\n\nThis request is typically used when the server needs to understand the file system\nstructure or access specific locations that the client has permission to read from.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "roots/list"
/// },
/// "params": {
/// "$ref": "#/$defs/RequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListRootsRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::list_roots_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::list_roots_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<RequestParams>,
}
impl ListRootsRequest {
pub fn new(id: RequestId, params: ::std::option::Option<RequestParams>) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "roots/list".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "roots/list"
pub fn method_value() -> &'static str {
"roots/list"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"roots/list"
}
}
/**The client's response to a roots/list request from the server.
This result contains an array of Root objects, each representing a root directory
or file that the server can operate on.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The client's response to a roots/list request from the server.\nThis result contains an array of Root objects, each representing a root directory\nor file that the server can operate on.",
/// "type": "object",
/// "required": [
/// "roots"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "roots": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Root"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListRootsResult {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
pub roots: ::std::vec::Vec<Root>,
}
///A request to retrieve a list of tasks.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request to retrieve a list of tasks.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "tasks/list"
/// },
/// "params": {
/// "$ref": "#/$defs/PaginatedRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListTasksRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::list_tasks_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::list_tasks_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<PaginatedRequestParams>,
}
impl ListTasksRequest {
pub fn new(id: RequestId, params: ::std::option::Option<PaginatedRequestParams>) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "tasks/list".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "tasks/list"
pub fn method_value() -> &'static str {
"tasks/list"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"tasks/list"
}
}
///The response to a tasks/list request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The response to a tasks/list request.",
/// "type": "object",
/// "required": [
/// "tasks"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "nextCursor": {
/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
/// "type": "string"
/// },
/// "tasks": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Task"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListTasksResult {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
/**An opaque token representing the pagination position after the last returned result.
If present, there may be more results available.*/
#[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
pub next_cursor: ::std::option::Option<::std::string::String>,
pub tasks: ::std::vec::Vec<Task>,
}
///Sent from the client to request a list of tools the server has.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Sent from the client to request a list of tools the server has.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "tools/list"
/// },
/// "params": {
/// "$ref": "#/$defs/PaginatedRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListToolsRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::list_tools_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::list_tools_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<PaginatedRequestParams>,
}
impl ListToolsRequest {
pub fn new(id: RequestId, params: ::std::option::Option<PaginatedRequestParams>) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "tools/list".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "tools/list"
pub fn method_value() -> &'static str {
"tools/list"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"tools/list"
}
}
///The server's response to a tools/list request from the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The server's response to a tools/list request from the client.",
/// "type": "object",
/// "required": [
/// "tools"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "nextCursor": {
/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
/// "type": "string"
/// },
/// "tools": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Tool"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListToolsResult {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
/**An opaque token representing the pagination position after the last returned result.
If present, there may be more results available.*/
#[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
pub next_cursor: ::std::option::Option<::std::string::String>,
pub tools: ::std::vec::Vec<Tool>,
}
/**The severity of a log message.
These map to syslog message severities, as specified in RFC-5424:
<https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1>*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The severity of a log message.\n\nThese map to syslog message severities, as specified in RFC-5424:\n<https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1>",
/// "type": "string",
/// "enum": [
/// "alert",
/// "critical",
/// "debug",
/// "emergency",
/// "error",
/// "info",
/// "notice",
/// "warning"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum LoggingLevel {
#[serde(rename = "alert")]
Alert,
#[serde(rename = "critical")]
Critical,
#[serde(rename = "debug")]
Debug,
#[serde(rename = "emergency")]
Emergency,
#[serde(rename = "error")]
Error,
#[serde(rename = "info")]
Info,
#[serde(rename = "notice")]
Notice,
#[serde(rename = "warning")]
Warning,
}
impl ::std::fmt::Display for LoggingLevel {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Alert => write!(f, "alert"),
Self::Critical => write!(f, "critical"),
Self::Debug => write!(f, "debug"),
Self::Emergency => write!(f, "emergency"),
Self::Error => write!(f, "error"),
Self::Info => write!(f, "info"),
Self::Notice => write!(f, "notice"),
Self::Warning => write!(f, "warning"),
}
}
}
///JSONRPCNotification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "JSONRPCNotification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "notifications/message"
/// },
/// "params": {
/// "$ref": "#/$defs/LoggingMessageNotificationParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct LoggingMessageNotification {
#[serde(deserialize_with = "validate::logging_message_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::logging_message_notification_method")]
method: ::std::string::String,
pub params: LoggingMessageNotificationParams,
}
impl LoggingMessageNotification {
pub fn new(params: LoggingMessageNotificationParams) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method: "notifications/message".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/message"
pub fn method_value() -> &'static str {
"notifications/message"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/message"
}
}
///Parameters for a notifications/message notification.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a notifications/message notification.",
/// "type": "object",
/// "required": [
/// "data",
/// "level"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "data": {
/// "description": "The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here."
/// },
/// "level": {
/// "description": "The severity of this log message.",
/// "$ref": "#/$defs/LoggingLevel"
/// },
/// "logger": {
/// "description": "An optional name of the logger issuing this message.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct LoggingMessageNotificationParams {
///The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
pub data: ::serde_json::Value,
///The severity of this log message.
pub level: LoggingLevel,
///An optional name of the logger issuing this message.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub logger: ::std::option::Option<::std::string::String>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct MessageMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
/**Hints to use for model selection.
Keys not declared here are currently left unspecified by the spec and are up
to the client to interpret.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Hints to use for model selection.\n\nKeys not declared here are currently left unspecified by the spec and are up\nto the client to interpret.",
/// "type": "object",
/// "properties": {
/// "name": {
/// "description": "A hint for a model name.\n\nThe client SHOULD treat this as a substring of a model name; for example:\n - claude-3-5-sonnet should match claude-3-5-sonnet-20241022\n - sonnet should match claude-3-5-sonnet-20241022, claude-3-sonnet-20240229, etc.\n - claude should match any Claude model\n\nThe client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:\n - gemini-1.5-flash could match claude-3-haiku-20240307",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ModelHint {
/**A hint for a model name.
The client SHOULD treat this as a substring of a model name; for example:
- claude-3-5-sonnet should match claude-3-5-sonnet-20241022
- sonnet should match claude-3-5-sonnet-20241022, claude-3-sonnet-20240229, etc.
- claude should match any Claude model
The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:
- gemini-1.5-flash could match claude-3-haiku-20240307*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub name: ::std::option::Option<::std::string::String>,
}
/**The server's preferences for model selection, requested of the client during sampling.
Because LLMs can vary along multiple dimensions, choosing the "best" model is
rarely straightforward. Different models excel in different areas—some are
faster but less capable, others are more capable but more expensive, and so
on. This interface allows servers to express their priorities across multiple
dimensions to help clients make an appropriate selection for their use case.
These preferences are always advisory. The client MAY ignore them. It is also
up to the client to decide how to interpret these preferences and how to
balance them against other considerations.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The server's preferences for model selection, requested of the client during sampling.\n\nBecause LLMs can vary along multiple dimensions, choosing the \"best\" model is\nrarely straightforward. Different models excel in different areas—some are\nfaster but less capable, others are more capable but more expensive, and so\non. This interface allows servers to express their priorities across multiple\ndimensions to help clients make an appropriate selection for their use case.\n\nThese preferences are always advisory. The client MAY ignore them. It is also\nup to the client to decide how to interpret these preferences and how to\nbalance them against other considerations.",
/// "type": "object",
/// "properties": {
/// "costPriority": {
/// "description": "How much to prioritize cost when selecting a model. A value of 0 means cost\nis not important, while a value of 1 means cost is the most important\nfactor.",
/// "type": "number",
/// "maximum": 1.0,
/// "minimum": 0.0
/// },
/// "hints": {
/// "description": "Optional hints to use for model selection.\n\nIf multiple hints are specified, the client MUST evaluate them in order\n(such that the first match is taken).\n\nThe client SHOULD prioritize these hints over the numeric priorities, but\nMAY still use the priorities to select from ambiguous matches.",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/ModelHint"
/// }
/// },
/// "intelligencePriority": {
/// "description": "How much to prioritize intelligence and capabilities when selecting a\nmodel. A value of 0 means intelligence is not important, while a value of 1\nmeans intelligence is the most important factor.",
/// "type": "number",
/// "maximum": 1.0,
/// "minimum": 0.0
/// },
/// "speedPriority": {
/// "description": "How much to prioritize sampling speed (latency) when selecting a model. A\nvalue of 0 means speed is not important, while a value of 1 means speed is\nthe most important factor.",
/// "type": "number",
/// "maximum": 1.0,
/// "minimum": 0.0
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ModelPreferences {
#[serde(rename = "costPriority", default, skip_serializing_if = "::std::option::Option::is_none")]
pub cost_priority: ::std::option::Option<f64>,
/**Optional hints to use for model selection.
If multiple hints are specified, the client MUST evaluate them in order
(such that the first match is taken).
The client SHOULD prioritize these hints over the numeric priorities, but
MAY still use the priorities to select from ambiguous matches.*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub hints: ::std::vec::Vec<ModelHint>,
#[serde(
rename = "intelligencePriority",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub intelligence_priority: ::std::option::Option<f64>,
#[serde(rename = "speedPriority", default, skip_serializing_if = "::std::option::Option::is_none")]
pub speed_priority: ::std::option::Option<f64>,
}
///MultiSelectEnumSchema
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/UntitledMultiSelectEnumSchema"
/// },
/// {
/// "$ref": "#/$defs/TitledMultiSelectEnumSchema"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum MultiSelectEnumSchema {
UntitledMultiSelectEnumSchema(UntitledMultiSelectEnumSchema),
TitledMultiSelectEnumSchema(TitledMultiSelectEnumSchema),
}
impl ::std::convert::From<UntitledMultiSelectEnumSchema> for MultiSelectEnumSchema {
fn from(value: UntitledMultiSelectEnumSchema) -> Self {
Self::UntitledMultiSelectEnumSchema(value)
}
}
impl ::std::convert::From<TitledMultiSelectEnumSchema> for MultiSelectEnumSchema {
fn from(value: TitledMultiSelectEnumSchema) -> Self {
Self::TitledMultiSelectEnumSchema(value)
}
}
///Notification
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "method"
/// ],
/// "properties": {
/// "method": {
/// "type": "string"
/// },
/// "params": {
/// "type": "object",
/// "additionalProperties": {}
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct Notification {
pub method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///NotificationParams
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct NotificationParams {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///NumberSchema
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "default": {
/// "type": "integer"
/// },
/// "description": {
/// "type": "string"
/// },
/// "maximum": {
/// "type": "integer"
/// },
/// "minimum": {
/// "type": "integer"
/// },
/// "title": {
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "enum": [
/// "integer",
/// "number"
/// ]
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct NumberSchema {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub default: ::std::option::Option<i64>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub maximum: ::std::option::Option<i64>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub minimum: ::std::option::Option<i64>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
#[serde(rename = "type")]
pub type_: NumberSchemaType,
}
///NumberSchemaType
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "enum": [
/// "integer",
/// "number"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum NumberSchemaType {
#[serde(rename = "integer")]
Integer,
#[serde(rename = "number")]
Number,
}
impl ::std::fmt::Display for NumberSchemaType {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Integer => write!(f, "integer"),
Self::Number => write!(f, "number"),
}
}
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct PaginatedMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///PaginatedRequest
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string"
/// },
/// "params": {
/// "$ref": "#/$defs/PaginatedRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct PaginatedRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::paginated_request_jsonrpc")]
jsonrpc: ::std::string::String,
pub method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<PaginatedRequestParams>,
}
impl PaginatedRequest {
pub fn new(id: RequestId, method: ::std::string::String, params: ::std::option::Option<PaginatedRequestParams>) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method,
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///Common parameters for paginated requests.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Common parameters for paginated requests.",
/// "type": "object",
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "cursor": {
/// "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct PaginatedRequestParams {
/**An opaque token representing the current pagination position.
If provided, the server should return results starting after this cursor.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub cursor: ::std::option::Option<::std::string::String>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<PaginatedMeta>,
}
///PaginatedResult
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "nextCursor": {
/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct PaginatedResult {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
/**An opaque token representing the pagination position after the last returned result.
If present, there may be more results available.*/
#[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
pub next_cursor: ::std::option::Option<::std::string::String>,
}
///A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "ping"
/// },
/// "params": {
/// "$ref": "#/$defs/RequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct PingRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::ping_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::ping_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<RequestParams>,
}
impl PingRequest {
pub fn new(id: RequestId, params: ::std::option::Option<RequestParams>) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "ping".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "ping"
pub fn method_value() -> &'static str {
"ping"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"ping"
}
}
/**Restricted schema definitions that only allow primitive types
without nested objects or arrays.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Restricted schema definitions that only allow primitive types\nwithout nested objects or arrays.",
/// "anyOf": [
/// {
/// "$ref": "#/$defs/StringSchema"
/// },
/// {
/// "$ref": "#/$defs/NumberSchema"
/// },
/// {
/// "$ref": "#/$defs/BooleanSchema"
/// },
/// {
/// "$ref": "#/$defs/UntitledSingleSelectEnumSchema"
/// },
/// {
/// "$ref": "#/$defs/TitledSingleSelectEnumSchema"
/// },
/// {
/// "$ref": "#/$defs/UntitledMultiSelectEnumSchema"
/// },
/// {
/// "$ref": "#/$defs/TitledMultiSelectEnumSchema"
/// },
/// {
/// "$ref": "#/$defs/LegacyTitledEnumSchema"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum PrimitiveSchemaDefinition {
StringSchema(StringSchema),
NumberSchema(NumberSchema),
BooleanSchema(BooleanSchema),
UntitledSingleSelectEnumSchema(UntitledSingleSelectEnumSchema),
TitledSingleSelectEnumSchema(TitledSingleSelectEnumSchema),
UntitledMultiSelectEnumSchema(UntitledMultiSelectEnumSchema),
TitledMultiSelectEnumSchema(TitledMultiSelectEnumSchema),
LegacyTitledEnumSchema(LegacyTitledEnumSchema),
}
impl ::std::convert::From<StringSchema> for PrimitiveSchemaDefinition {
fn from(value: StringSchema) -> Self {
Self::StringSchema(value)
}
}
impl ::std::convert::From<NumberSchema> for PrimitiveSchemaDefinition {
fn from(value: NumberSchema) -> Self {
Self::NumberSchema(value)
}
}
impl ::std::convert::From<BooleanSchema> for PrimitiveSchemaDefinition {
fn from(value: BooleanSchema) -> Self {
Self::BooleanSchema(value)
}
}
impl ::std::convert::From<UntitledSingleSelectEnumSchema> for PrimitiveSchemaDefinition {
fn from(value: UntitledSingleSelectEnumSchema) -> Self {
Self::UntitledSingleSelectEnumSchema(value)
}
}
impl ::std::convert::From<TitledSingleSelectEnumSchema> for PrimitiveSchemaDefinition {
fn from(value: TitledSingleSelectEnumSchema) -> Self {
Self::TitledSingleSelectEnumSchema(value)
}
}
impl ::std::convert::From<UntitledMultiSelectEnumSchema> for PrimitiveSchemaDefinition {
fn from(value: UntitledMultiSelectEnumSchema) -> Self {
Self::UntitledMultiSelectEnumSchema(value)
}
}
impl ::std::convert::From<TitledMultiSelectEnumSchema> for PrimitiveSchemaDefinition {
fn from(value: TitledMultiSelectEnumSchema) -> Self {
Self::TitledMultiSelectEnumSchema(value)
}
}
impl ::std::convert::From<LegacyTitledEnumSchema> for PrimitiveSchemaDefinition {
fn from(value: LegacyTitledEnumSchema) -> Self {
Self::LegacyTitledEnumSchema(value)
}
}
///An out-of-band notification used to inform the receiver of a progress update for a long-running request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "An out-of-band notification used to inform the receiver of a progress update for a long-running request.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "notifications/progress"
/// },
/// "params": {
/// "$ref": "#/$defs/ProgressNotificationParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ProgressNotification {
#[serde(deserialize_with = "validate::progress_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::progress_notification_method")]
method: ::std::string::String,
pub params: ProgressNotificationParams,
}
impl ProgressNotification {
pub fn new(params: ProgressNotificationParams) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method: "notifications/progress".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/progress"
pub fn method_value() -> &'static str {
"notifications/progress"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/progress"
}
}
///Parameters for a notifications/progress notification.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a notifications/progress notification.",
/// "type": "object",
/// "required": [
/// "progress",
/// "progressToken"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "message": {
/// "description": "An optional message describing the current progress.",
/// "type": "string"
/// },
/// "progress": {
/// "description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
/// "type": "number"
/// },
/// "progressToken": {
/// "description": "The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.",
/// "$ref": "#/$defs/ProgressToken"
/// },
/// "total": {
/// "description": "Total number of items to process (or total progress required), if known.",
/// "type": "number"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ProgressNotificationParams {
///An optional message describing the current progress.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub message: ::std::option::Option<::std::string::String>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
pub progress: f64,
///The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
#[serde(rename = "progressToken")]
pub progress_token: ProgressToken,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub total: ::std::option::Option<f64>,
}
///A progress token, used to associate progress notifications with the original request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A progress token, used to associate progress notifications with the original request.",
/// "type": [
/// "string",
/// "integer"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ProgressToken {
String(::std::string::String),
Integer(i64),
}
impl ::std::convert::From<i64> for ProgressToken {
fn from(value: i64) -> Self {
Self::Integer(value)
}
}
///A prompt or prompt template that the server offers.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A prompt or prompt template that the server offers.",
/// "type": "object",
/// "required": [
/// "name"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "arguments": {
/// "description": "A list of arguments to use for templating the prompt.",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/PromptArgument"
/// }
/// },
/// "description": {
/// "description": "An optional description of what this prompt provides",
/// "type": "string"
/// },
/// "icons": {
/// "description": "Optional set of sized icons that the client can display in a user interface.\n\nClients that support rendering icons MUST support at least the following MIME types:\n- image/png - PNG images (safe, universal compatibility)\n- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)\n\nClients that support rendering icons SHOULD also support:\n- image/svg+xml - SVG images (scalable but requires security precautions)\n- image/webp - WebP images (modern, efficient format)",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Icon"
/// }
/// },
/// "name": {
/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
/// "type": "string"
/// },
/// "title": {
/// "description": "Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\neven by those unfamiliar with domain-specific terminology.\n\nIf not provided, the name should be used for display (except for Tool,\nwhere annotations.title should be given precedence over using name,\nif present).",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct Prompt {
///A list of arguments to use for templating the prompt.
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub arguments: ::std::vec::Vec<PromptArgument>,
///An optional description of what this prompt provides
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
/**Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
- image/png - PNG images (safe, universal compatibility)
- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
- image/svg+xml - SVG images (scalable but requires security precautions)
- image/webp - WebP images (modern, efficient format)*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub icons: ::std::vec::Vec<Icon>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
pub name: ::std::string::String,
/**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
even by those unfamiliar with domain-specific terminology.
If not provided, the name should be used for display (except for Tool,
where annotations.title should be given precedence over using name,
if present).*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
}
///Describes an argument that a prompt can accept.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Describes an argument that a prompt can accept.",
/// "type": "object",
/// "required": [
/// "name"
/// ],
/// "properties": {
/// "description": {
/// "description": "A human-readable description of the argument.",
/// "type": "string"
/// },
/// "name": {
/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
/// "type": "string"
/// },
/// "required": {
/// "description": "Whether this argument must be provided.",
/// "type": "boolean"
/// },
/// "title": {
/// "description": "Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\neven by those unfamiliar with domain-specific terminology.\n\nIf not provided, the name should be used for display (except for Tool,\nwhere annotations.title should be given precedence over using name,\nif present).",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct PromptArgument {
///A human-readable description of the argument.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
pub name: ::std::string::String,
///Whether this argument must be provided.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub required: ::std::option::Option<bool>,
/**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
even by those unfamiliar with domain-specific terminology.
If not provided, the name should be used for display (except for Tool,
where annotations.title should be given precedence over using name,
if present).*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
}
///An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "notifications/prompts/list_changed"
/// },
/// "params": {
/// "$ref": "#/$defs/NotificationParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct PromptListChangedNotification {
#[serde(deserialize_with = "validate::prompt_list_changed_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::prompt_list_changed_notification_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<NotificationParams>,
}
impl PromptListChangedNotification {
pub fn new(params: ::std::option::Option<NotificationParams>) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method: "notifications/prompts/list_changed".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/prompts/list_changed"
pub fn method_value() -> &'static str {
"notifications/prompts/list_changed"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/prompts/list_changed"
}
}
/**Describes a message returned as part of a prompt.
This is similar to SamplingMessage, but also supports the embedding of
resources from the MCP server.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Describes a message returned as part of a prompt.\n\nThis is similar to SamplingMessage, but also supports the embedding of\nresources from the MCP server.",
/// "type": "object",
/// "required": [
/// "content",
/// "role"
/// ],
/// "properties": {
/// "content": {
/// "$ref": "#/$defs/ContentBlock"
/// },
/// "role": {
/// "$ref": "#/$defs/Role"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct PromptMessage {
pub content: ContentBlock,
pub role: Role,
}
///Identifies a prompt.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Identifies a prompt.",
/// "type": "object",
/// "required": [
/// "name",
/// "type"
/// ],
/// "properties": {
/// "name": {
/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
/// "type": "string"
/// },
/// "title": {
/// "description": "Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\neven by those unfamiliar with domain-specific terminology.\n\nIf not provided, the name should be used for display (except for Tool,\nwhere annotations.title should be given precedence over using name,\nif present).",
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "ref/prompt"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct PromptReference {
///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
pub name: ::std::string::String,
/**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
even by those unfamiliar with domain-specific terminology.
If not provided, the name should be used for display (except for Tool,
where annotations.title should be given precedence over using name,
if present).*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
#[serde(rename = "type", deserialize_with = "validate::prompt_reference_type_")]
type_: ::std::string::String,
}
impl PromptReference {
pub fn new(name: ::std::string::String, title: ::std::option::Option<::std::string::String>) -> Self {
Self {
name,
title,
type_: "ref/prompt".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "ref/prompt"
pub fn type_value() -> &'static str {
"ref/prompt"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"ref/prompt"
}
}
///ReadResourceContent
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/TextResourceContents"
/// },
/// {
/// "$ref": "#/$defs/BlobResourceContents"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ReadResourceContent {
TextResourceContents(TextResourceContents),
BlobResourceContents(BlobResourceContents),
}
impl ::std::convert::From<TextResourceContents> for ReadResourceContent {
fn from(value: TextResourceContents) -> Self {
Self::TextResourceContents(value)
}
}
impl ::std::convert::From<BlobResourceContents> for ReadResourceContent {
fn from(value: BlobResourceContents) -> Self {
Self::BlobResourceContents(value)
}
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ReadResourceMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///Sent from the client to the server, to read a specific resource URI.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Sent from the client to the server, to read a specific resource URI.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "resources/read"
/// },
/// "params": {
/// "$ref": "#/$defs/ReadResourceRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ReadResourceRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::read_resource_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::read_resource_request_method")]
method: ::std::string::String,
pub params: ReadResourceRequestParams,
}
impl ReadResourceRequest {
pub fn new(id: RequestId, params: ReadResourceRequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "resources/read".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "resources/read"
pub fn method_value() -> &'static str {
"resources/read"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"resources/read"
}
}
///Parameters for a resources/read request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a resources/read request.",
/// "type": "object",
/// "required": [
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "uri": {
/// "description": "The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ReadResourceRequestParams {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ReadResourceMeta>,
///The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.
pub uri: ::std::string::String,
}
///The server's response to a resources/read request from the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The server's response to a resources/read request from the client.",
/// "type": "object",
/// "required": [
/// "contents"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "contents": {
/// "type": "array",
/// "items": {
/// "anyOf": [
/// {
/// "$ref": "#/$defs/TextResourceContents"
/// },
/// {
/// "$ref": "#/$defs/BlobResourceContents"
/// }
/// ]
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ReadResourceResult {
pub contents: ::std::vec::Vec<ReadResourceContent>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
/**Metadata for associating messages with a task.
Include this in the _meta field under the key io.modelcontextprotocol/related-task.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Metadata for associating messages with a task.\nInclude this in the _meta field under the key io.modelcontextprotocol/related-task.",
/// "type": "object",
/// "required": [
/// "taskId"
/// ],
/// "properties": {
/// "taskId": {
/// "description": "The task identifier this message is associated with.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct RelatedTaskMetadata {
///The task identifier this message is associated with.
#[serde(rename = "taskId")]
pub task_id: ::std::string::String,
}
///Request
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "method"
/// ],
/// "properties": {
/// "method": {
/// "type": "string"
/// },
/// "params": {
/// "type": "object",
/// "additionalProperties": {}
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct Request {
pub method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///A uniquely identifying ID for a request in JSON-RPC.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A uniquely identifying ID for a request in JSON-RPC.",
/// "type": [
/// "string",
/// "integer"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum RequestId {
String(::std::string::String),
Integer(i64),
}
impl ::std::convert::From<i64> for RequestId {
fn from(value: i64) -> Self {
Self::Integer(value)
}
}
///Common params for any request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Common params for any request.",
/// "type": "object",
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct RequestParams {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<RequestParamsMeta>,
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct RequestParamsMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///A known resource that the server is capable of reading.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A known resource that the server is capable of reading.",
/// "type": "object",
/// "required": [
/// "name",
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "annotations": {
/// "description": "Optional annotations for the client.",
/// "$ref": "#/$defs/Annotations"
/// },
/// "description": {
/// "description": "A description of what this resource represents.\n\nThis can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.",
/// "type": "string"
/// },
/// "icons": {
/// "description": "Optional set of sized icons that the client can display in a user interface.\n\nClients that support rendering icons MUST support at least the following MIME types:\n- image/png - PNG images (safe, universal compatibility)\n- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)\n\nClients that support rendering icons SHOULD also support:\n- image/svg+xml - SVG images (scalable but requires security precautions)\n- image/webp - WebP images (modern, efficient format)",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Icon"
/// }
/// },
/// "mimeType": {
/// "description": "The MIME type of this resource, if known.",
/// "type": "string"
/// },
/// "name": {
/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
/// "type": "string"
/// },
/// "size": {
/// "description": "The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.\n\nThis can be used by Hosts to display file sizes and estimate context window usage.",
/// "type": "integer"
/// },
/// "title": {
/// "description": "Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\neven by those unfamiliar with domain-specific terminology.\n\nIf not provided, the name should be used for display (except for Tool,\nwhere annotations.title should be given precedence over using name,\nif present).",
/// "type": "string"
/// },
/// "uri": {
/// "description": "The URI of this resource.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct Resource {
///Optional annotations for the client.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub annotations: ::std::option::Option<Annotations>,
/**A description of what this resource represents.
This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
/**Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
- image/png - PNG images (safe, universal compatibility)
- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
- image/svg+xml - SVG images (scalable but requires security precautions)
- image/webp - WebP images (modern, efficient format)*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub icons: ::std::vec::Vec<Icon>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The MIME type of this resource, if known.
#[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
pub mime_type: ::std::option::Option<::std::string::String>,
///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
pub name: ::std::string::String,
/**The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
This can be used by Hosts to display file sizes and estimate context window usage.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub size: ::std::option::Option<i64>,
/**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
even by those unfamiliar with domain-specific terminology.
If not provided, the name should be used for display (except for Tool,
where annotations.title should be given precedence over using name,
if present).*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
///The URI of this resource.
pub uri: ::std::string::String,
}
///The contents of a specific resource or sub-resource.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The contents of a specific resource or sub-resource.",
/// "type": "object",
/// "required": [
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "mimeType": {
/// "description": "The MIME type of this resource, if known.",
/// "type": "string"
/// },
/// "uri": {
/// "description": "The URI of this resource.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ResourceContents {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The MIME type of this resource, if known.
#[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
pub mime_type: ::std::option::Option<::std::string::String>,
///The URI of this resource.
pub uri: ::std::string::String,
}
/**A resource that the server is capable of reading, included in a prompt or tool call result.
Note: resource links returned by tools are not guaranteed to appear in the results of resources/list requests.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A resource that the server is capable of reading, included in a prompt or tool call result.\n\nNote: resource links returned by tools are not guaranteed to appear in the results of resources/list requests.",
/// "type": "object",
/// "required": [
/// "name",
/// "type",
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "annotations": {
/// "description": "Optional annotations for the client.",
/// "$ref": "#/$defs/Annotations"
/// },
/// "description": {
/// "description": "A description of what this resource represents.\n\nThis can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.",
/// "type": "string"
/// },
/// "icons": {
/// "description": "Optional set of sized icons that the client can display in a user interface.\n\nClients that support rendering icons MUST support at least the following MIME types:\n- image/png - PNG images (safe, universal compatibility)\n- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)\n\nClients that support rendering icons SHOULD also support:\n- image/svg+xml - SVG images (scalable but requires security precautions)\n- image/webp - WebP images (modern, efficient format)",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Icon"
/// }
/// },
/// "mimeType": {
/// "description": "The MIME type of this resource, if known.",
/// "type": "string"
/// },
/// "name": {
/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
/// "type": "string"
/// },
/// "size": {
/// "description": "The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.\n\nThis can be used by Hosts to display file sizes and estimate context window usage.",
/// "type": "integer"
/// },
/// "title": {
/// "description": "Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\neven by those unfamiliar with domain-specific terminology.\n\nIf not provided, the name should be used for display (except for Tool,\nwhere annotations.title should be given precedence over using name,\nif present).",
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "resource_link"
/// },
/// "uri": {
/// "description": "The URI of this resource.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ResourceLink {
///Optional annotations for the client.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub annotations: ::std::option::Option<Annotations>,
/**A description of what this resource represents.
This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
/**Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
- image/png - PNG images (safe, universal compatibility)
- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
- image/svg+xml - SVG images (scalable but requires security precautions)
- image/webp - WebP images (modern, efficient format)*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub icons: ::std::vec::Vec<Icon>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The MIME type of this resource, if known.
#[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
pub mime_type: ::std::option::Option<::std::string::String>,
///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
pub name: ::std::string::String,
/**The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
This can be used by Hosts to display file sizes and estimate context window usage.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub size: ::std::option::Option<i64>,
/**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
even by those unfamiliar with domain-specific terminology.
If not provided, the name should be used for display (except for Tool,
where annotations.title should be given precedence over using name,
if present).*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
#[serde(rename = "type", deserialize_with = "validate::resource_link_type_")]
type_: ::std::string::String,
///The URI of this resource.
pub uri: ::std::string::String,
}
impl ResourceLink {
#[allow(clippy::too_many_arguments)]
pub fn new(
icons: ::std::vec::Vec<Icon>,
name: ::std::string::String,
uri: ::std::string::String,
annotations: ::std::option::Option<Annotations>,
description: ::std::option::Option<::std::string::String>,
meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
mime_type: ::std::option::Option<::std::string::String>,
size: ::std::option::Option<i64>,
title: ::std::option::Option<::std::string::String>,
) -> Self {
Self {
annotations,
description,
icons,
meta,
mime_type,
name,
size,
title,
type_: "resource_link".to_string(),
uri,
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "resource_link"
pub fn type_value() -> &'static str {
"resource_link"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"resource_link"
}
}
///An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "notifications/resources/list_changed"
/// },
/// "params": {
/// "$ref": "#/$defs/NotificationParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ResourceListChangedNotification {
#[serde(deserialize_with = "validate::resource_list_changed_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::resource_list_changed_notification_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<NotificationParams>,
}
impl ResourceListChangedNotification {
pub fn new(params: ::std::option::Option<NotificationParams>) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method: "notifications/resources/list_changed".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/resources/list_changed"
pub fn method_value() -> &'static str {
"notifications/resources/list_changed"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/resources/list_changed"
}
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ResourceMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///Common parameters when working with resources.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Common parameters when working with resources.",
/// "type": "object",
/// "required": [
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "uri": {
/// "description": "The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ResourceRequestParams {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResourceMeta>,
///The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.
pub uri: ::std::string::String,
}
///A template description for resources available on the server.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A template description for resources available on the server.",
/// "type": "object",
/// "required": [
/// "name",
/// "uriTemplate"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "annotations": {
/// "description": "Optional annotations for the client.",
/// "$ref": "#/$defs/Annotations"
/// },
/// "description": {
/// "description": "A description of what this template is for.\n\nThis can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.",
/// "type": "string"
/// },
/// "icons": {
/// "description": "Optional set of sized icons that the client can display in a user interface.\n\nClients that support rendering icons MUST support at least the following MIME types:\n- image/png - PNG images (safe, universal compatibility)\n- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)\n\nClients that support rendering icons SHOULD also support:\n- image/svg+xml - SVG images (scalable but requires security precautions)\n- image/webp - WebP images (modern, efficient format)",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Icon"
/// }
/// },
/// "mimeType": {
/// "description": "The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.",
/// "type": "string"
/// },
/// "name": {
/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
/// "type": "string"
/// },
/// "title": {
/// "description": "Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\neven by those unfamiliar with domain-specific terminology.\n\nIf not provided, the name should be used for display (except for Tool,\nwhere annotations.title should be given precedence over using name,\nif present).",
/// "type": "string"
/// },
/// "uriTemplate": {
/// "description": "A URI template (according to RFC 6570) that can be used to construct resource URIs.",
/// "type": "string",
/// "format": "uri-template"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ResourceTemplate {
///Optional annotations for the client.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub annotations: ::std::option::Option<Annotations>,
/**A description of what this template is for.
This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
/**Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
- image/png - PNG images (safe, universal compatibility)
- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
- image/svg+xml - SVG images (scalable but requires security precautions)
- image/webp - WebP images (modern, efficient format)*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub icons: ::std::vec::Vec<Icon>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.
#[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
pub mime_type: ::std::option::Option<::std::string::String>,
///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
pub name: ::std::string::String,
/**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
even by those unfamiliar with domain-specific terminology.
If not provided, the name should be used for display (except for Tool,
where annotations.title should be given precedence over using name,
if present).*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
///A URI template (according to RFC 6570) that can be used to construct resource URIs.
#[serde(rename = "uriTemplate")]
pub uri_template: ::std::string::String,
}
///A reference to a resource or resource template definition.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A reference to a resource or resource template definition.",
/// "type": "object",
/// "required": [
/// "type",
/// "uri"
/// ],
/// "properties": {
/// "type": {
/// "type": "string",
/// "const": "ref/resource"
/// },
/// "uri": {
/// "description": "The URI or URI template of the resource.",
/// "type": "string",
/// "format": "uri-template"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ResourceTemplateReference {
#[serde(rename = "type", deserialize_with = "validate::resource_template_reference_type_")]
type_: ::std::string::String,
///The URI or URI template of the resource.
pub uri: ::std::string::String,
}
impl ResourceTemplateReference {
pub fn new(uri: ::std::string::String) -> Self {
Self {
type_: "ref/resource".to_string(),
uri,
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "ref/resource"
pub fn type_value() -> &'static str {
"ref/resource"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"ref/resource"
}
}
///A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "notifications/resources/updated"
/// },
/// "params": {
/// "$ref": "#/$defs/ResourceUpdatedNotificationParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ResourceUpdatedNotification {
#[serde(deserialize_with = "validate::resource_updated_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::resource_updated_notification_method")]
method: ::std::string::String,
pub params: ResourceUpdatedNotificationParams,
}
impl ResourceUpdatedNotification {
pub fn new(params: ResourceUpdatedNotificationParams) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method: "notifications/resources/updated".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/resources/updated"
pub fn method_value() -> &'static str {
"notifications/resources/updated"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/resources/updated"
}
}
///Parameters for a notifications/resources/updated notification.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a notifications/resources/updated notification.",
/// "type": "object",
/// "required": [
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "uri": {
/// "description": "The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ResourceUpdatedNotificationParams {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
pub uri: ::std::string::String,
}
///Result
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct Result {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///The sender or recipient of messages and data in a conversation.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The sender or recipient of messages and data in a conversation.",
/// "type": "string",
/// "enum": [
/// "assistant",
/// "user"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum Role {
#[serde(rename = "assistant")]
Assistant,
#[serde(rename = "user")]
User,
}
impl ::std::fmt::Display for Role {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Assistant => write!(f, "assistant"),
Self::User => write!(f, "user"),
}
}
}
///Represents a root directory or file that the server can operate on.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Represents a root directory or file that the server can operate on.",
/// "type": "object",
/// "required": [
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "name": {
/// "description": "An optional name for the root. This can be used to provide a human-readable\nidentifier for the root, which may be useful for display purposes or for\nreferencing the root in other parts of the application.",
/// "type": "string"
/// },
/// "uri": {
/// "description": "The URI identifying the root. This *must* start with file:// for now.\nThis restriction may be relaxed in future versions of the protocol to allow\nother URI schemes.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct Root {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
/**An optional name for the root. This can be used to provide a human-readable
identifier for the root, which may be useful for display purposes or for
referencing the root in other parts of the application.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub name: ::std::option::Option<::std::string::String>,
/**The URI identifying the root. This *must* start with file:// for now.
This restriction may be relaxed in future versions of the protocol to allow
other URI schemes.*/
pub uri: ::std::string::String,
}
/**A notification from the client to the server, informing it that the list of roots has changed.
This notification should be sent whenever the client adds, removes, or modifies any root.
The server should then request an updated list of roots using the ListRootsRequest.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A notification from the client to the server, informing it that the list of roots has changed.\nThis notification should be sent whenever the client adds, removes, or modifies any root.\nThe server should then request an updated list of roots using the ListRootsRequest.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "notifications/roots/list_changed"
/// },
/// "params": {
/// "$ref": "#/$defs/NotificationParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct RootsListChangedNotification {
#[serde(deserialize_with = "validate::roots_list_changed_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::roots_list_changed_notification_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<NotificationParams>,
}
impl RootsListChangedNotification {
pub fn new(params: ::std::option::Option<NotificationParams>) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method: "notifications/roots/list_changed".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/roots/list_changed"
pub fn method_value() -> &'static str {
"notifications/roots/list_changed"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/roots/list_changed"
}
}
///RpcError
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "code",
/// "message"
/// ],
/// "properties": {
/// "code": {
/// "description": "The error type that occurred.",
/// "type": "integer"
/// },
/// "data": {
/// "description": "Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.)."
/// },
/// "message": {
/// "description": "A short description of the error. The message SHOULD be limited to a concise single sentence.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct RpcError {
///The error type that occurred.
pub code: i64,
///Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub data: ::std::option::Option<::serde_json::Value>,
///A short description of the error. The message SHOULD be limited to a concise single sentence.
pub message: ::std::string::String,
}
///Describes a message issued to or received from an LLM API.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Describes a message issued to or received from an LLM API.",
/// "type": "object",
/// "required": [
/// "content",
/// "role"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "content": {
/// "anyOf": [
/// {
/// "$ref": "#/$defs/TextContent"
/// },
/// {
/// "$ref": "#/$defs/ImageContent"
/// },
/// {
/// "$ref": "#/$defs/AudioContent"
/// },
/// {
/// "$ref": "#/$defs/ToolUseContent"
/// },
/// {
/// "$ref": "#/$defs/ToolResultContent"
/// },
/// {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/SamplingMessageContentBlock"
/// }
/// }
/// ]
/// },
/// "role": {
/// "$ref": "#/$defs/Role"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SamplingMessage {
pub content: SamplingMessageContent,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
pub role: Role,
}
///SamplingMessageContent
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/TextContent"
/// },
/// {
/// "$ref": "#/$defs/ImageContent"
/// },
/// {
/// "$ref": "#/$defs/AudioContent"
/// },
/// {
/// "$ref": "#/$defs/ToolUseContent"
/// },
/// {
/// "$ref": "#/$defs/ToolResultContent"
/// },
/// {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/SamplingMessageContentBlock"
/// }
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum SamplingMessageContent {
TextContent(TextContent),
ImageContent(ImageContent),
AudioContent(AudioContent),
ToolUseContent(ToolUseContent),
ToolResultContent(ToolResultContent),
SamplingMessageContentBlock(::std::vec::Vec<SamplingMessageContentBlock>),
}
impl ::std::convert::From<TextContent> for SamplingMessageContent {
fn from(value: TextContent) -> Self {
Self::TextContent(value)
}
}
impl ::std::convert::From<ImageContent> for SamplingMessageContent {
fn from(value: ImageContent) -> Self {
Self::ImageContent(value)
}
}
impl ::std::convert::From<AudioContent> for SamplingMessageContent {
fn from(value: AudioContent) -> Self {
Self::AudioContent(value)
}
}
impl ::std::convert::From<ToolUseContent> for SamplingMessageContent {
fn from(value: ToolUseContent) -> Self {
Self::ToolUseContent(value)
}
}
impl ::std::convert::From<ToolResultContent> for SamplingMessageContent {
fn from(value: ToolResultContent) -> Self {
Self::ToolResultContent(value)
}
}
impl ::std::convert::From<::std::vec::Vec<SamplingMessageContentBlock>> for SamplingMessageContent {
fn from(value: ::std::vec::Vec<SamplingMessageContentBlock>) -> Self {
Self::SamplingMessageContentBlock(value)
}
}
///SamplingMessageContentBlock
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/TextContent"
/// },
/// {
/// "$ref": "#/$defs/ImageContent"
/// },
/// {
/// "$ref": "#/$defs/AudioContent"
/// },
/// {
/// "$ref": "#/$defs/ToolUseContent"
/// },
/// {
/// "$ref": "#/$defs/ToolResultContent"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum SamplingMessageContentBlock {
TextContent(TextContent),
ImageContent(ImageContent),
AudioContent(AudioContent),
ToolUseContent(ToolUseContent),
ToolResultContent(ToolResultContent),
}
impl ::std::convert::From<TextContent> for SamplingMessageContentBlock {
fn from(value: TextContent) -> Self {
Self::TextContent(value)
}
}
impl ::std::convert::From<ImageContent> for SamplingMessageContentBlock {
fn from(value: ImageContent) -> Self {
Self::ImageContent(value)
}
}
impl ::std::convert::From<AudioContent> for SamplingMessageContentBlock {
fn from(value: AudioContent) -> Self {
Self::AudioContent(value)
}
}
impl ::std::convert::From<ToolUseContent> for SamplingMessageContentBlock {
fn from(value: ToolUseContent) -> Self {
Self::ToolUseContent(value)
}
}
impl ::std::convert::From<ToolResultContent> for SamplingMessageContentBlock {
fn from(value: ToolResultContent) -> Self {
Self::ToolResultContent(value)
}
}
///Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.",
/// "type": "object",
/// "properties": {
/// "completions": {
/// "description": "Present if the server supports argument autocompletion suggestions.",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "experimental": {
/// "description": "Experimental, non-standard capabilities that the server supports.",
/// "type": "object",
/// "additionalProperties": {
/// "type": "object",
/// "additionalProperties": true
/// }
/// },
/// "logging": {
/// "description": "Present if the server supports sending log messages to the client.",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "prompts": {
/// "description": "Present if the server offers any prompt templates.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether this server supports notifications for changes to the prompt list.",
/// "type": "boolean"
/// }
/// }
/// },
/// "resources": {
/// "description": "Present if the server offers any resources to read.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether this server supports notifications for changes to the resource list.",
/// "type": "boolean"
/// },
/// "subscribe": {
/// "description": "Whether this server supports subscribing to resource updates.",
/// "type": "boolean"
/// }
/// }
/// },
/// "tasks": {
/// "description": "Present if the server supports task-augmented requests.",
/// "type": "object",
/// "properties": {
/// "cancel": {
/// "description": "Whether this server supports tasks/cancel.",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "list": {
/// "description": "Whether this server supports tasks/list.",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "requests": {
/// "description": "Specifies which request types can be augmented with tasks.",
/// "type": "object",
/// "properties": {
/// "tools": {
/// "description": "Task support for tool-related requests.",
/// "type": "object",
/// "properties": {
/// "call": {
/// "description": "Whether the server supports task-augmented tools/call requests.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
/// }
/// }
/// }
/// }
/// },
/// "tools": {
/// "description": "Present if the server offers any tools to call.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether this server supports notifications for changes to the tool list.",
/// "type": "boolean"
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ServerCapabilities {
///Present if the server supports argument autocompletion suggestions.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub completions: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///Experimental, non-standard capabilities that the server supports.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub experimental: ::std::option::Option<
std::collections::BTreeMap<::std::string::String, ::serde_json::Map<::std::string::String, ::serde_json::Value>>,
>,
///Present if the server supports sending log messages to the client.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub logging: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub prompts: ::std::option::Option<ServerCapabilitiesPrompts>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub resources: ::std::option::Option<ServerCapabilitiesResources>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub tasks: ::std::option::Option<ServerTasks>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub tools: ::std::option::Option<ServerCapabilitiesTools>,
}
///Present if the server offers any prompt templates.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present if the server offers any prompt templates.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether this server supports notifications for changes to the prompt list.",
/// "type": "boolean"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ServerCapabilitiesPrompts {
///Whether this server supports notifications for changes to the prompt list.
#[serde(rename = "listChanged", default, skip_serializing_if = "::std::option::Option::is_none")]
pub list_changed: ::std::option::Option<bool>,
}
///Present if the server offers any resources to read.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present if the server offers any resources to read.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether this server supports notifications for changes to the resource list.",
/// "type": "boolean"
/// },
/// "subscribe": {
/// "description": "Whether this server supports subscribing to resource updates.",
/// "type": "boolean"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ServerCapabilitiesResources {
///Whether this server supports notifications for changes to the resource list.
#[serde(rename = "listChanged", default, skip_serializing_if = "::std::option::Option::is_none")]
pub list_changed: ::std::option::Option<bool>,
///Whether this server supports subscribing to resource updates.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub subscribe: ::std::option::Option<bool>,
}
///Present if the server offers any tools to call.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present if the server offers any tools to call.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether this server supports notifications for changes to the tool list.",
/// "type": "boolean"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ServerCapabilitiesTools {
///Whether this server supports notifications for changes to the tool list.
#[serde(rename = "listChanged", default, skip_serializing_if = "::std::option::Option::is_none")]
pub list_changed: ::std::option::Option<bool>,
}
///ServerNotification
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/CancelledNotification"
/// },
/// {
/// "$ref": "#/$defs/ProgressNotification"
/// },
/// {
/// "$ref": "#/$defs/ResourceListChangedNotification"
/// },
/// {
/// "$ref": "#/$defs/ResourceUpdatedNotification"
/// },
/// {
/// "$ref": "#/$defs/PromptListChangedNotification"
/// },
/// {
/// "$ref": "#/$defs/ToolListChangedNotification"
/// },
/// {
/// "$ref": "#/$defs/TaskStatusNotification"
/// },
/// {
/// "$ref": "#/$defs/LoggingMessageNotification"
/// },
/// {
/// "$ref": "#/$defs/ElicitationCompleteNotification"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ServerNotification {
CancelledNotification(CancelledNotification),
ProgressNotification(ProgressNotification),
ResourceListChangedNotification(ResourceListChangedNotification),
ResourceUpdatedNotification(ResourceUpdatedNotification),
PromptListChangedNotification(PromptListChangedNotification),
ToolListChangedNotification(ToolListChangedNotification),
TaskStatusNotification(TaskStatusNotification),
LoggingMessageNotification(LoggingMessageNotification),
ElicitationCompleteNotification(ElicitationCompleteNotification),
}
impl ::std::convert::From<CancelledNotification> for ServerNotification {
fn from(value: CancelledNotification) -> Self {
Self::CancelledNotification(value)
}
}
impl ::std::convert::From<ProgressNotification> for ServerNotification {
fn from(value: ProgressNotification) -> Self {
Self::ProgressNotification(value)
}
}
impl ::std::convert::From<ResourceListChangedNotification> for ServerNotification {
fn from(value: ResourceListChangedNotification) -> Self {
Self::ResourceListChangedNotification(value)
}
}
impl ::std::convert::From<ResourceUpdatedNotification> for ServerNotification {
fn from(value: ResourceUpdatedNotification) -> Self {
Self::ResourceUpdatedNotification(value)
}
}
impl ::std::convert::From<PromptListChangedNotification> for ServerNotification {
fn from(value: PromptListChangedNotification) -> Self {
Self::PromptListChangedNotification(value)
}
}
impl ::std::convert::From<ToolListChangedNotification> for ServerNotification {
fn from(value: ToolListChangedNotification) -> Self {
Self::ToolListChangedNotification(value)
}
}
impl ::std::convert::From<TaskStatusNotification> for ServerNotification {
fn from(value: TaskStatusNotification) -> Self {
Self::TaskStatusNotification(value)
}
}
impl ::std::convert::From<LoggingMessageNotification> for ServerNotification {
fn from(value: LoggingMessageNotification) -> Self {
Self::LoggingMessageNotification(value)
}
}
impl ::std::convert::From<ElicitationCompleteNotification> for ServerNotification {
fn from(value: ElicitationCompleteNotification) -> Self {
Self::ElicitationCompleteNotification(value)
}
}
///ServerRequest
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/PingRequest"
/// },
/// {
/// "$ref": "#/$defs/GetTaskRequest"
/// },
/// {
/// "$ref": "#/$defs/GetTaskPayloadRequest"
/// },
/// {
/// "$ref": "#/$defs/CancelTaskRequest"
/// },
/// {
/// "$ref": "#/$defs/ListTasksRequest"
/// },
/// {
/// "$ref": "#/$defs/CreateMessageRequest"
/// },
/// {
/// "$ref": "#/$defs/ListRootsRequest"
/// },
/// {
/// "$ref": "#/$defs/ElicitRequest"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
#[allow(clippy::large_enum_variant)]
pub enum ServerRequest {
PingRequest(PingRequest),
GetTaskRequest(GetTaskRequest),
GetTaskPayloadRequest(GetTaskPayloadRequest),
CancelTaskRequest(CancelTaskRequest),
ListTasksRequest(ListTasksRequest),
CreateMessageRequest(CreateMessageRequest),
ListRootsRequest(ListRootsRequest),
ElicitRequest(ElicitRequest),
}
impl ::std::convert::From<PingRequest> for ServerRequest {
fn from(value: PingRequest) -> Self {
Self::PingRequest(value)
}
}
impl ::std::convert::From<GetTaskRequest> for ServerRequest {
fn from(value: GetTaskRequest) -> Self {
Self::GetTaskRequest(value)
}
}
impl ::std::convert::From<GetTaskPayloadRequest> for ServerRequest {
fn from(value: GetTaskPayloadRequest) -> Self {
Self::GetTaskPayloadRequest(value)
}
}
impl ::std::convert::From<CancelTaskRequest> for ServerRequest {
fn from(value: CancelTaskRequest) -> Self {
Self::CancelTaskRequest(value)
}
}
impl ::std::convert::From<ListTasksRequest> for ServerRequest {
fn from(value: ListTasksRequest) -> Self {
Self::ListTasksRequest(value)
}
}
impl ::std::convert::From<CreateMessageRequest> for ServerRequest {
fn from(value: CreateMessageRequest) -> Self {
Self::CreateMessageRequest(value)
}
}
impl ::std::convert::From<ListRootsRequest> for ServerRequest {
fn from(value: ListRootsRequest) -> Self {
Self::ListRootsRequest(value)
}
}
impl ::std::convert::From<ElicitRequest> for ServerRequest {
fn from(value: ElicitRequest) -> Self {
Self::ElicitRequest(value)
}
}
///ServerResult
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/Result"
/// },
/// {
/// "$ref": "#/$defs/InitializeResult"
/// },
/// {
/// "$ref": "#/$defs/ListResourcesResult"
/// },
/// {
/// "$ref": "#/$defs/ListResourceTemplatesResult"
/// },
/// {
/// "$ref": "#/$defs/ReadResourceResult"
/// },
/// {
/// "$ref": "#/$defs/ListPromptsResult"
/// },
/// {
/// "$ref": "#/$defs/GetPromptResult"
/// },
/// {
/// "$ref": "#/$defs/ListToolsResult"
/// },
/// {
/// "$ref": "#/$defs/CallToolResult"
/// },
/// {
/// "description": "The response to a tasks/get request.",
/// "$ref": "#/$defs/GetTaskResult"
/// },
/// {
/// "$ref": "#/$defs/GetTaskPayloadResult"
/// },
/// {
/// "description": "The response to a tasks/cancel request.",
/// "$ref": "#/$defs/CancelTaskResult"
/// },
/// {
/// "$ref": "#/$defs/ListTasksResult"
/// },
/// {
/// "$ref": "#/$defs/CompleteResult"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
#[allow(clippy::large_enum_variant)]
pub enum ServerResult {
InitializeResult(InitializeResult),
ListResourcesResult(ListResourcesResult),
ListResourceTemplatesResult(ListResourceTemplatesResult),
ReadResourceResult(ReadResourceResult),
ListPromptsResult(ListPromptsResult),
GetPromptResult(GetPromptResult),
ListToolsResult(ListToolsResult),
CallToolResult(CallToolResult),
GetTaskResult(GetTaskResult),
CancelTaskResult(CancelTaskResult),
ListTasksResult(ListTasksResult),
CompleteResult(CompleteResult),
Result(Result),
GetTaskPayloadResult(GetTaskPayloadResult),
}
impl ::std::convert::From<InitializeResult> for ServerResult {
fn from(value: InitializeResult) -> Self {
Self::InitializeResult(value)
}
}
impl ::std::convert::From<ListResourcesResult> for ServerResult {
fn from(value: ListResourcesResult) -> Self {
Self::ListResourcesResult(value)
}
}
impl ::std::convert::From<ListResourceTemplatesResult> for ServerResult {
fn from(value: ListResourceTemplatesResult) -> Self {
Self::ListResourceTemplatesResult(value)
}
}
impl ::std::convert::From<ReadResourceResult> for ServerResult {
fn from(value: ReadResourceResult) -> Self {
Self::ReadResourceResult(value)
}
}
impl ::std::convert::From<ListPromptsResult> for ServerResult {
fn from(value: ListPromptsResult) -> Self {
Self::ListPromptsResult(value)
}
}
impl ::std::convert::From<GetPromptResult> for ServerResult {
fn from(value: GetPromptResult) -> Self {
Self::GetPromptResult(value)
}
}
impl ::std::convert::From<ListToolsResult> for ServerResult {
fn from(value: ListToolsResult) -> Self {
Self::ListToolsResult(value)
}
}
impl ::std::convert::From<CallToolResult> for ServerResult {
fn from(value: CallToolResult) -> Self {
Self::CallToolResult(value)
}
}
impl ::std::convert::From<GetTaskResult> for ServerResult {
fn from(value: GetTaskResult) -> Self {
Self::GetTaskResult(value)
}
}
impl ::std::convert::From<CancelTaskResult> for ServerResult {
fn from(value: CancelTaskResult) -> Self {
Self::CancelTaskResult(value)
}
}
impl ::std::convert::From<ListTasksResult> for ServerResult {
fn from(value: ListTasksResult) -> Self {
Self::ListTasksResult(value)
}
}
impl ::std::convert::From<CompleteResult> for ServerResult {
fn from(value: CompleteResult) -> Self {
Self::CompleteResult(value)
}
}
impl ::std::convert::From<Result> for ServerResult {
fn from(value: Result) -> Self {
Self::Result(value)
}
}
impl ::std::convert::From<GetTaskPayloadResult> for ServerResult {
fn from(value: GetTaskPayloadResult) -> Self {
Self::GetTaskPayloadResult(value)
}
}
///Specifies which request types can be augmented with tasks.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Specifies which request types can be augmented with tasks.",
/// "type": "object",
/// "properties": {
/// "tools": {
/// "description": "Task support for tool-related requests.",
/// "type": "object",
/// "properties": {
/// "call": {
/// "description": "Whether the server supports task-augmented tools/call requests.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ServerTaskRequest {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub tools: ::std::option::Option<ServerTaskTools>,
}
///Task support for tool-related requests.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Task support for tool-related requests.",
/// "type": "object",
/// "properties": {
/// "call": {
/// "description": "Whether the server supports task-augmented tools/call requests.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ServerTaskTools {
///Whether the server supports task-augmented tools/call requests.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub call: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///Present if the server supports task-augmented requests.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present if the server supports task-augmented requests.",
/// "type": "object",
/// "properties": {
/// "cancel": {
/// "description": "Whether this server supports tasks/cancel.",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "list": {
/// "description": "Whether this server supports tasks/list.",
/// "type": "object",
/// "additionalProperties": true
/// },
/// "requests": {
/// "description": "Specifies which request types can be augmented with tasks.",
/// "type": "object",
/// "properties": {
/// "tools": {
/// "description": "Task support for tool-related requests.",
/// "type": "object",
/// "properties": {
/// "call": {
/// "description": "Whether the server supports task-augmented tools/call requests.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ServerTasks {
///Whether this server supports tasks/cancel.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub cancel: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///Whether this server supports tasks/list.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub list: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub requests: ::std::option::Option<ServerTaskRequest>,
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct SetLevelMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///A request from the client to the server, to enable or adjust logging.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request from the client to the server, to enable or adjust logging.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "logging/setLevel"
/// },
/// "params": {
/// "$ref": "#/$defs/SetLevelRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SetLevelRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::set_level_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::set_level_request_method")]
method: ::std::string::String,
pub params: SetLevelRequestParams,
}
impl SetLevelRequest {
pub fn new(id: RequestId, params: SetLevelRequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "logging/setLevel".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "logging/setLevel"
pub fn method_value() -> &'static str {
"logging/setLevel"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"logging/setLevel"
}
}
///Parameters for a logging/setLevel request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a logging/setLevel request.",
/// "type": "object",
/// "required": [
/// "level"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "level": {
/// "description": "The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.",
/// "$ref": "#/$defs/LoggingLevel"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SetLevelRequestParams {
///The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.
pub level: LoggingLevel,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<SetLevelMeta>,
}
///SingleSelectEnumSchema
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/UntitledSingleSelectEnumSchema"
/// },
/// {
/// "$ref": "#/$defs/TitledSingleSelectEnumSchema"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum SingleSelectEnumSchema {
UntitledSingleSelectEnumSchema(UntitledSingleSelectEnumSchema),
TitledSingleSelectEnumSchema(TitledSingleSelectEnumSchema),
}
impl ::std::convert::From<UntitledSingleSelectEnumSchema> for SingleSelectEnumSchema {
fn from(value: UntitledSingleSelectEnumSchema) -> Self {
Self::UntitledSingleSelectEnumSchema(value)
}
}
impl ::std::convert::From<TitledSingleSelectEnumSchema> for SingleSelectEnumSchema {
fn from(value: TitledSingleSelectEnumSchema) -> Self {
Self::TitledSingleSelectEnumSchema(value)
}
}
///StringSchema
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "default": {
/// "type": "string"
/// },
/// "description": {
/// "type": "string"
/// },
/// "format": {
/// "type": "string",
/// "enum": [
/// "date",
/// "date-time",
/// "email",
/// "uri"
/// ]
/// },
/// "maxLength": {
/// "type": "integer"
/// },
/// "minLength": {
/// "type": "integer"
/// },
/// "title": {
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct StringSchema {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub default: ::std::option::Option<::std::string::String>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub format: ::std::option::Option<StringSchemaFormat>,
#[serde(rename = "maxLength", default, skip_serializing_if = "::std::option::Option::is_none")]
pub max_length: ::std::option::Option<i64>,
#[serde(rename = "minLength", default, skip_serializing_if = "::std::option::Option::is_none")]
pub min_length: ::std::option::Option<i64>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
#[serde(rename = "type", deserialize_with = "validate::string_schema_type_")]
type_: ::std::string::String,
}
impl StringSchema {
pub fn new(
default: ::std::option::Option<::std::string::String>,
description: ::std::option::Option<::std::string::String>,
format: ::std::option::Option<StringSchemaFormat>,
max_length: ::std::option::Option<i64>,
min_length: ::std::option::Option<i64>,
title: ::std::option::Option<::std::string::String>,
) -> Self {
Self {
default,
description,
format,
max_length,
min_length,
title,
type_: "string".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "string"
pub fn type_value() -> &'static str {
"string"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"string"
}
}
///StringSchemaFormat
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "enum": [
/// "date",
/// "date-time",
/// "email",
/// "uri"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum StringSchemaFormat {
#[serde(rename = "date")]
Date,
#[serde(rename = "date-time")]
DateTime,
#[serde(rename = "email")]
Email,
#[serde(rename = "uri")]
Uri,
}
impl ::std::fmt::Display for StringSchemaFormat {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Date => write!(f, "date"),
Self::DateTime => write!(f, "date-time"),
Self::Email => write!(f, "email"),
Self::Uri => write!(f, "uri"),
}
}
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct SubscribeMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "resources/subscribe"
/// },
/// "params": {
/// "$ref": "#/$defs/SubscribeRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SubscribeRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::subscribe_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::subscribe_request_method")]
method: ::std::string::String,
pub params: SubscribeRequestParams,
}
impl SubscribeRequest {
pub fn new(id: RequestId, params: SubscribeRequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "resources/subscribe".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "resources/subscribe"
pub fn method_value() -> &'static str {
"resources/subscribe"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"resources/subscribe"
}
}
///Parameters for a resources/subscribe request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a resources/subscribe request.",
/// "type": "object",
/// "required": [
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "uri": {
/// "description": "The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SubscribeRequestParams {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<SubscribeMeta>,
///The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.
pub uri: ::std::string::String,
}
///Data associated with a task.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Data associated with a task.",
/// "type": "object",
/// "required": [
/// "createdAt",
/// "lastUpdatedAt",
/// "status",
/// "taskId",
/// "ttl"
/// ],
/// "properties": {
/// "createdAt": {
/// "description": "ISO 8601 timestamp when the task was created.",
/// "type": "string"
/// },
/// "lastUpdatedAt": {
/// "description": "ISO 8601 timestamp when the task was last updated.",
/// "type": "string"
/// },
/// "pollInterval": {
/// "description": "Suggested polling interval in milliseconds.",
/// "type": "integer"
/// },
/// "status": {
/// "$ref": "#/$defs/TaskStatus"
/// },
/// "statusMessage": {
/// "description": "Optional human-readable message describing the current task state.\nThis can provide context for any status, including:\n- Reasons for \"cancelled\" status\n- Summaries for \"completed\" status\n- Diagnostic information for \"failed\" status (e.g., error details, what went wrong)",
/// "type": "string"
/// },
/// "taskId": {
/// "description": "The task identifier.",
/// "type": "string"
/// },
/// "ttl": {
/// "description": "Actual retention duration from creation in milliseconds, null for unlimited.",
/// "type": "integer"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct Task {
///ISO 8601 timestamp when the task was created.
#[serde(rename = "createdAt")]
pub created_at: ::std::string::String,
///ISO 8601 timestamp when the task was last updated.
#[serde(rename = "lastUpdatedAt")]
pub last_updated_at: ::std::string::String,
///Suggested polling interval in milliseconds.
#[serde(rename = "pollInterval", default, skip_serializing_if = "::std::option::Option::is_none")]
pub poll_interval: ::std::option::Option<i64>,
pub status: TaskStatus,
/**Optional human-readable message describing the current task state.
This can provide context for any status, including:
- Reasons for "cancelled" status
- Summaries for "completed" status
- Diagnostic information for "failed" status (e.g., error details, what went wrong)*/
#[serde(rename = "statusMessage", default, skip_serializing_if = "::std::option::Option::is_none")]
pub status_message: ::std::option::Option<::std::string::String>,
///The task identifier.
#[serde(rename = "taskId")]
pub task_id: ::std::string::String,
///Actual retention duration from creation in milliseconds, null for unlimited.
#[serde(default)]
pub ttl: ::std::option::Option<i64>,
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct TaskAugmentedMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///Common params for any task-augmented request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Common params for any task-augmented request.",
/// "type": "object",
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "task": {
/// "description": "If specified, the caller is requesting task-augmented execution for this request.\nThe request will return a CreateTaskResult immediately, and the actual result can be\nretrieved later via tasks/result.\n\nTask augmentation is subject to capability negotiation - receivers MUST declare support\nfor task augmentation of specific request types in their capabilities.",
/// "$ref": "#/$defs/TaskMetadata"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct TaskAugmentedRequestParams {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<TaskAugmentedMeta>,
/**If specified, the caller is requesting task-augmented execution for this request.
The request will return a CreateTaskResult immediately, and the actual result can be
retrieved later via tasks/result.
Task augmentation is subject to capability negotiation - receivers MUST declare support
for task augmentation of specific request types in their capabilities.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub task: ::std::option::Option<TaskMetadata>,
}
/**Metadata for augmenting a request with task execution.
Include this in the task field of the request parameters.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Metadata for augmenting a request with task execution.\nInclude this in the task field of the request parameters.",
/// "type": "object",
/// "properties": {
/// "ttl": {
/// "description": "Requested duration in milliseconds to retain task from creation.",
/// "type": "integer"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct TaskMetadata {
///Requested duration in milliseconds to retain task from creation.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ttl: ::std::option::Option<i64>,
}
///The status of a task.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The status of a task.",
/// "type": "string",
/// "enum": [
/// "cancelled",
/// "completed",
/// "failed",
/// "input_required",
/// "working"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum TaskStatus {
#[serde(rename = "cancelled")]
Cancelled,
#[serde(rename = "completed")]
Completed,
#[serde(rename = "failed")]
Failed,
#[serde(rename = "input_required")]
InputRequired,
#[serde(rename = "working")]
Working,
}
impl ::std::fmt::Display for TaskStatus {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Cancelled => write!(f, "cancelled"),
Self::Completed => write!(f, "completed"),
Self::Failed => write!(f, "failed"),
Self::InputRequired => write!(f, "input_required"),
Self::Working => write!(f, "working"),
}
}
}
///An optional notification from the receiver to the requestor, informing them that a task's status has changed. Receivers are not required to send these notifications.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "An optional notification from the receiver to the requestor, informing them that a task's status has changed. Receivers are not required to send these notifications.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "notifications/tasks/status"
/// },
/// "params": {
/// "$ref": "#/$defs/TaskStatusNotificationParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct TaskStatusNotification {
#[serde(deserialize_with = "validate::task_status_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::task_status_notification_method")]
method: ::std::string::String,
pub params: TaskStatusNotificationParams,
}
impl TaskStatusNotification {
pub fn new(params: TaskStatusNotificationParams) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method: "notifications/tasks/status".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/tasks/status"
pub fn method_value() -> &'static str {
"notifications/tasks/status"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/tasks/status"
}
}
///Parameters for a notifications/tasks/status notification.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a notifications/tasks/status notification.",
/// "allOf": [
/// {
/// "$ref": "#/$defs/NotificationParams"
/// },
/// {
/// "$ref": "#/$defs/Task"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct TaskStatusNotificationParams {
///ISO 8601 timestamp when the task was created.
#[serde(rename = "createdAt")]
pub created_at: ::std::string::String,
///ISO 8601 timestamp when the task was last updated.
#[serde(rename = "lastUpdatedAt")]
pub last_updated_at: ::std::string::String,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///Suggested polling interval in milliseconds.
#[serde(rename = "pollInterval", default, skip_serializing_if = "::std::option::Option::is_none")]
pub poll_interval: ::std::option::Option<i64>,
pub status: TaskStatus,
/**Optional human-readable message describing the current task state.
This can provide context for any status, including:
- Reasons for "cancelled" status
- Summaries for "completed" status
- Diagnostic information for "failed" status (e.g., error details, what went wrong)*/
#[serde(rename = "statusMessage", default, skip_serializing_if = "::std::option::Option::is_none")]
pub status_message: ::std::option::Option<::std::string::String>,
///The task identifier.
#[serde(rename = "taskId")]
pub task_id: ::std::string::String,
///Actual retention duration from creation in milliseconds, null for unlimited.
#[serde(default)]
pub ttl: ::std::option::Option<i64>,
}
///Text provided to or from an LLM.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Text provided to or from an LLM.",
/// "type": "object",
/// "required": [
/// "text",
/// "type"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "annotations": {
/// "description": "Optional annotations for the client.",
/// "$ref": "#/$defs/Annotations"
/// },
/// "text": {
/// "description": "The text content of the message.",
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "text"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct TextContent {
///Optional annotations for the client.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub annotations: ::std::option::Option<Annotations>,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The text content of the message.
pub text: ::std::string::String,
#[serde(rename = "type", deserialize_with = "validate::text_content_type_")]
type_: ::std::string::String,
}
impl TextContent {
pub fn new(
text: ::std::string::String,
annotations: ::std::option::Option<Annotations>,
meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
) -> Self {
Self {
annotations,
meta,
text,
type_: "text".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "text"
pub fn type_value() -> &'static str {
"text"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"text"
}
}
///TextResourceContents
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "text",
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "mimeType": {
/// "description": "The MIME type of this resource, if known.",
/// "type": "string"
/// },
/// "text": {
/// "description": "The text of the item. This must only be set if the item can actually be represented as text (not binary data).",
/// "type": "string"
/// },
/// "uri": {
/// "description": "The URI of this resource.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct TextResourceContents {
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The MIME type of this resource, if known.
#[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
pub mime_type: ::std::option::Option<::std::string::String>,
///The text of the item. This must only be set if the item can actually be represented as text (not binary data).
pub text: ::std::string::String,
///The URI of this resource.
pub uri: ::std::string::String,
}
///Schema for multiple-selection enumeration with display titles for each option.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Schema for multiple-selection enumeration with display titles for each option.",
/// "type": "object",
/// "required": [
/// "items",
/// "type"
/// ],
/// "properties": {
/// "default": {
/// "description": "Optional default value.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "description": {
/// "description": "Optional description for the enum field.",
/// "type": "string"
/// },
/// "items": {
/// "description": "Schema for array items with enum options and display labels.",
/// "type": "object",
/// "required": [
/// "anyOf"
/// ],
/// "properties": {
/// "anyOf": {
/// "description": "Array of enum options with values and display labels.",
/// "type": "array",
/// "items": {
/// "type": "object",
/// "required": [
/// "const",
/// "title"
/// ],
/// "properties": {
/// "const": {
/// "description": "The constant enum value.",
/// "type": "string"
/// },
/// "title": {
/// "description": "Display title for this option.",
/// "type": "string"
/// }
/// }
/// }
/// }
/// }
/// },
/// "maxItems": {
/// "description": "Maximum number of items to select.",
/// "type": "integer"
/// },
/// "minItems": {
/// "description": "Minimum number of items to select.",
/// "type": "integer"
/// },
/// "title": {
/// "description": "Optional title for the enum field.",
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "array"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct TitledMultiSelectEnumSchema {
///Optional default value.
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub default: ::std::vec::Vec<::std::string::String>,
///Optional description for the enum field.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
pub items: TitledMultiSelectEnumSchemaItems,
///Maximum number of items to select.
#[serde(rename = "maxItems", default, skip_serializing_if = "::std::option::Option::is_none")]
pub max_items: ::std::option::Option<i64>,
///Minimum number of items to select.
#[serde(rename = "minItems", default, skip_serializing_if = "::std::option::Option::is_none")]
pub min_items: ::std::option::Option<i64>,
///Optional title for the enum field.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
#[serde(rename = "type", deserialize_with = "validate::titled_multi_select_enum_schema_type_")]
type_: ::std::string::String,
}
impl TitledMultiSelectEnumSchema {
pub fn new(
default: ::std::vec::Vec<::std::string::String>,
items: TitledMultiSelectEnumSchemaItems,
description: ::std::option::Option<::std::string::String>,
max_items: ::std::option::Option<i64>,
min_items: ::std::option::Option<i64>,
title: ::std::option::Option<::std::string::String>,
) -> Self {
Self {
default,
description,
items,
max_items,
min_items,
title,
type_: "array".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "array"
pub fn type_value() -> &'static str {
"array"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"array"
}
}
///Schema for array items with enum options and display labels.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Schema for array items with enum options and display labels.",
/// "type": "object",
/// "required": [
/// "anyOf"
/// ],
/// "properties": {
/// "anyOf": {
/// "description": "Array of enum options with values and display labels.",
/// "type": "array",
/// "items": {
/// "type": "object",
/// "required": [
/// "const",
/// "title"
/// ],
/// "properties": {
/// "const": {
/// "description": "The constant enum value.",
/// "type": "string"
/// },
/// "title": {
/// "description": "Display title for this option.",
/// "type": "string"
/// }
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct TitledMultiSelectEnumSchemaItems {
///Array of enum options with values and display labels.
#[serde(rename = "anyOf")]
pub any_of: ::std::vec::Vec<TitledMultiSelectEnumSchemaItemsAnyOfItem>,
}
///TitledMultiSelectEnumSchemaItemsAnyOfItem
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "const",
/// "title"
/// ],
/// "properties": {
/// "const": {
/// "description": "The constant enum value.",
/// "type": "string"
/// },
/// "title": {
/// "description": "Display title for this option.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct TitledMultiSelectEnumSchemaItemsAnyOfItem {
///The constant enum value.
#[serde(rename = "const")]
pub const_: ::std::string::String,
///Display title for this option.
pub title: ::std::string::String,
}
///Schema for single-selection enumeration with display titles for each option.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Schema for single-selection enumeration with display titles for each option.",
/// "type": "object",
/// "required": [
/// "oneOf",
/// "type"
/// ],
/// "properties": {
/// "default": {
/// "description": "Optional default value.",
/// "type": "string"
/// },
/// "description": {
/// "description": "Optional description for the enum field.",
/// "type": "string"
/// },
/// "oneOf": {
/// "description": "Array of enum options with values and display labels.",
/// "type": "array",
/// "items": {
/// "type": "object",
/// "required": [
/// "const",
/// "title"
/// ],
/// "properties": {
/// "const": {
/// "description": "The enum value.",
/// "type": "string"
/// },
/// "title": {
/// "description": "Display label for this option.",
/// "type": "string"
/// }
/// }
/// }
/// },
/// "title": {
/// "description": "Optional title for the enum field.",
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct TitledSingleSelectEnumSchema {
///Optional default value.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub default: ::std::option::Option<::std::string::String>,
///Optional description for the enum field.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
///Array of enum options with values and display labels.
#[serde(rename = "oneOf")]
pub one_of: ::std::vec::Vec<TitledSingleSelectEnumSchemaOneOfItem>,
///Optional title for the enum field.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
#[serde(rename = "type", deserialize_with = "validate::titled_single_select_enum_schema_type_")]
type_: ::std::string::String,
}
impl TitledSingleSelectEnumSchema {
pub fn new(
one_of: ::std::vec::Vec<TitledSingleSelectEnumSchemaOneOfItem>,
default: ::std::option::Option<::std::string::String>,
description: ::std::option::Option<::std::string::String>,
title: ::std::option::Option<::std::string::String>,
) -> Self {
Self {
default,
description,
one_of,
title,
type_: "string".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "string"
pub fn type_value() -> &'static str {
"string"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"string"
}
}
///TitledSingleSelectEnumSchemaOneOfItem
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "const",
/// "title"
/// ],
/// "properties": {
/// "const": {
/// "description": "The enum value.",
/// "type": "string"
/// },
/// "title": {
/// "description": "Display label for this option.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct TitledSingleSelectEnumSchemaOneOfItem {
///The enum value.
#[serde(rename = "const")]
pub const_: ::std::string::String,
///Display label for this option.
pub title: ::std::string::String,
}
///Definition for a tool the client can call.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Definition for a tool the client can call.",
/// "type": "object",
/// "required": [
/// "inputSchema",
/// "name"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "annotations": {
/// "description": "Optional additional tool information.\n\nDisplay name precedence order is: title, annotations.title, then name.",
/// "$ref": "#/$defs/ToolAnnotations"
/// },
/// "description": {
/// "description": "A human-readable description of the tool.\n\nThis can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a \"hint\" to the model.",
/// "type": "string"
/// },
/// "execution": {
/// "description": "Execution-related properties for this tool.",
/// "$ref": "#/$defs/ToolExecution"
/// },
/// "icons": {
/// "description": "Optional set of sized icons that the client can display in a user interface.\n\nClients that support rendering icons MUST support at least the following MIME types:\n- image/png - PNG images (safe, universal compatibility)\n- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)\n\nClients that support rendering icons SHOULD also support:\n- image/svg+xml - SVG images (scalable but requires security precautions)\n- image/webp - WebP images (modern, efficient format)",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Icon"
/// }
/// },
/// "inputSchema": {
/// "description": "A JSON Schema object defining the expected parameters for the tool.",
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "$schema": {
/// "type": "string"
/// },
/// "properties": {
/// "type": "object",
/// "additionalProperties": {
/// "type": "object",
/// "additionalProperties": true
/// }
/// },
/// "required": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "type": {
/// "type": "string",
/// "const": "object"
/// }
/// }
/// },
/// "name": {
/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
/// "type": "string"
/// },
/// "outputSchema": {
/// "description": "An optional JSON Schema object defining the structure of the tool's output returned in\nthe structuredContent field of a CallToolResult.\n\nDefaults to JSON Schema 2020-12 when no explicit $schema is provided.\nCurrently restricted to type: \"object\" at the root level.",
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "$schema": {
/// "type": "string"
/// },
/// "properties": {
/// "type": "object",
/// "additionalProperties": {
/// "type": "object",
/// "additionalProperties": true
/// }
/// },
/// "required": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "type": {
/// "type": "string",
/// "const": "object"
/// }
/// }
/// },
/// "title": {
/// "description": "Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\neven by those unfamiliar with domain-specific terminology.\n\nIf not provided, the name should be used for display (except for Tool,\nwhere annotations.title should be given precedence over using name,\nif present).",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct Tool {
/**Optional additional tool information.
Display name precedence order is: title, annotations.title, then name.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub annotations: ::std::option::Option<ToolAnnotations>,
/**A human-readable description of the tool.
This can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a "hint" to the model.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
///Execution-related properties for this tool.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub execution: ::std::option::Option<ToolExecution>,
/**Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
- image/png - PNG images (safe, universal compatibility)
- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
- image/svg+xml - SVG images (scalable but requires security precautions)
- image/webp - WebP images (modern, efficient format)*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub icons: ::std::vec::Vec<Icon>,
#[serde(rename = "inputSchema")]
pub input_schema: ToolInputSchema,
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
pub name: ::std::string::String,
#[serde(rename = "outputSchema", default, skip_serializing_if = "::std::option::Option::is_none")]
pub output_schema: ::std::option::Option<ToolOutputSchema>,
/**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
even by those unfamiliar with domain-specific terminology.
If not provided, the name should be used for display (except for Tool,
where annotations.title should be given precedence over using name,
if present).*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
}
/**Additional properties describing a Tool to clients.
NOTE: all properties in ToolAnnotations are **hints**.
They are not guaranteed to provide a faithful description of
tool behavior (including descriptive properties like title).
Clients should never make tool use decisions based on ToolAnnotations
received from untrusted servers.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Additional properties describing a Tool to clients.\n\nNOTE: all properties in ToolAnnotations are **hints**.\nThey are not guaranteed to provide a faithful description of\ntool behavior (including descriptive properties like title).\n\nClients should never make tool use decisions based on ToolAnnotations\nreceived from untrusted servers.",
/// "type": "object",
/// "properties": {
/// "destructiveHint": {
/// "description": "If true, the tool may perform destructive updates to its environment.\nIf false, the tool performs only additive updates.\n\n(This property is meaningful only when readOnlyHint == false)\n\nDefault: true",
/// "type": "boolean"
/// },
/// "idempotentHint": {
/// "description": "If true, calling the tool repeatedly with the same arguments\nwill have no additional effect on its environment.\n\n(This property is meaningful only when readOnlyHint == false)\n\nDefault: false",
/// "type": "boolean"
/// },
/// "openWorldHint": {
/// "description": "If true, this tool may interact with an \"open world\" of external\nentities. If false, the tool's domain of interaction is closed.\nFor example, the world of a web search tool is open, whereas that\nof a memory tool is not.\n\nDefault: true",
/// "type": "boolean"
/// },
/// "readOnlyHint": {
/// "description": "If true, the tool does not modify its environment.\n\nDefault: false",
/// "type": "boolean"
/// },
/// "title": {
/// "description": "A human-readable title for the tool.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ToolAnnotations {
/**If true, the tool may perform destructive updates to its environment.
If false, the tool performs only additive updates.
(This property is meaningful only when readOnlyHint == false)
Default: true*/
#[serde(rename = "destructiveHint", default, skip_serializing_if = "::std::option::Option::is_none")]
pub destructive_hint: ::std::option::Option<bool>,
/**If true, calling the tool repeatedly with the same arguments
will have no additional effect on its environment.
(This property is meaningful only when readOnlyHint == false)
Default: false*/
#[serde(rename = "idempotentHint", default, skip_serializing_if = "::std::option::Option::is_none")]
pub idempotent_hint: ::std::option::Option<bool>,
/**If true, this tool may interact with an "open world" of external
entities. If false, the tool's domain of interaction is closed.
For example, the world of a web search tool is open, whereas that
of a memory tool is not.
Default: true*/
#[serde(rename = "openWorldHint", default, skip_serializing_if = "::std::option::Option::is_none")]
pub open_world_hint: ::std::option::Option<bool>,
/**If true, the tool does not modify its environment.
Default: false*/
#[serde(rename = "readOnlyHint", default, skip_serializing_if = "::std::option::Option::is_none")]
pub read_only_hint: ::std::option::Option<bool>,
///A human-readable title for the tool.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
}
///Controls tool selection behavior for sampling requests.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Controls tool selection behavior for sampling requests.",
/// "type": "object",
/// "properties": {
/// "mode": {
/// "description": "Controls the tool use ability of the model:\n- \"auto\": Model decides whether to use tools (default)\n- \"required\": Model MUST use at least one tool before completing\n- \"none\": Model MUST NOT use any tools",
/// "type": "string",
/// "enum": [
/// "auto",
/// "none",
/// "required"
/// ]
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ToolChoice {
/**Controls the tool use ability of the model:
- "auto": Model decides whether to use tools (default)
- "required": Model MUST use at least one tool before completing
- "none": Model MUST NOT use any tools*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub mode: ::std::option::Option<ToolChoiceMode>,
}
/**Controls the tool use ability of the model:
- "auto": Model decides whether to use tools (default)
- "required": Model MUST use at least one tool before completing
- "none": Model MUST NOT use any tools*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Controls the tool use ability of the model:\n- \"auto\": Model decides whether to use tools (default)\n- \"required\": Model MUST use at least one tool before completing\n- \"none\": Model MUST NOT use any tools",
/// "type": "string",
/// "enum": [
/// "auto",
/// "none",
/// "required"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ToolChoiceMode {
#[serde(rename = "auto")]
Auto,
#[serde(rename = "none")]
None,
#[serde(rename = "required")]
Required,
}
impl ::std::fmt::Display for ToolChoiceMode {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Auto => write!(f, "auto"),
Self::None => write!(f, "none"),
Self::Required => write!(f, "required"),
}
}
}
///Execution-related properties for a tool.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Execution-related properties for a tool.",
/// "type": "object",
/// "properties": {
/// "taskSupport": {
/// "description": "Indicates whether this tool supports task-augmented execution.\nThis allows clients to handle long-running operations through polling\nthe task system.\n\n- \"forbidden\": Tool does not support task-augmented execution (default when absent)\n- \"optional\": Tool may support task-augmented execution\n- \"required\": Tool requires task-augmented execution\n\nDefault: \"forbidden\"",
/// "type": "string",
/// "enum": [
/// "forbidden",
/// "optional",
/// "required"
/// ]
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ToolExecution {
/**Indicates whether this tool supports task-augmented execution.
This allows clients to handle long-running operations through polling
the task system.
- "forbidden": Tool does not support task-augmented execution (default when absent)
- "optional": Tool may support task-augmented execution
- "required": Tool requires task-augmented execution
"*/
#[serde(rename = "taskSupport", default, skip_serializing_if = "::std::option::Option::is_none")]
pub task_support: ::std::option::Option<ToolExecutionTaskSupport>,
}
/**Indicates whether this tool supports task-augmented execution.
This allows clients to handle long-running operations through polling
the task system.
- "forbidden": Tool does not support task-augmented execution (default when absent)
- "optional": Tool may support task-augmented execution
- "required": Tool requires task-augmented execution
"*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Indicates whether this tool supports task-augmented execution.\nThis allows clients to handle long-running operations through polling\nthe task system.\n\n- \"forbidden\": Tool does not support task-augmented execution (default when absent)\n- \"optional\": Tool may support task-augmented execution\n- \"required\": Tool requires task-augmented execution\n\nDefault: \"forbidden\"",
/// "type": "string",
/// "enum": [
/// "forbidden",
/// "optional",
/// "required"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ToolExecutionTaskSupport {
#[serde(rename = "forbidden")]
Forbidden,
#[serde(rename = "optional")]
Optional,
#[serde(rename = "required")]
Required,
}
impl ::std::fmt::Display for ToolExecutionTaskSupport {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Forbidden => write!(f, "forbidden"),
Self::Optional => write!(f, "optional"),
Self::Required => write!(f, "required"),
}
}
}
///A JSON Schema object defining the expected parameters for the tool.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A JSON Schema object defining the expected parameters for the tool.",
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "$schema": {
/// "type": "string"
/// },
/// "properties": {
/// "type": "object",
/// "additionalProperties": {
/// "type": "object",
/// "additionalProperties": true
/// }
/// },
/// "required": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "type": {
/// "type": "string",
/// "const": "object"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ToolInputSchema {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub properties: ::std::option::Option<
std::collections::BTreeMap<::std::string::String, ::serde_json::Map<::std::string::String, ::serde_json::Value>>,
>,
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub required: ::std::vec::Vec<::std::string::String>,
#[serde(rename = "$schema", default, skip_serializing_if = "::std::option::Option::is_none")]
pub schema: ::std::option::Option<::std::string::String>,
#[serde(rename = "type", deserialize_with = "validate::tool_input_schema_type_")]
type_: ::std::string::String,
}
impl ToolInputSchema {
pub fn new(
required: ::std::vec::Vec<::std::string::String>,
properties: ::std::option::Option<
std::collections::BTreeMap<::std::string::String, ::serde_json::Map<::std::string::String, ::serde_json::Value>>,
>,
schema: ::std::option::Option<::std::string::String>,
) -> Self {
Self {
properties,
required,
schema,
type_: "object".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "object"
pub fn type_value() -> &'static str {
"object"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"object"
}
}
///An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "notifications/tools/list_changed"
/// },
/// "params": {
/// "$ref": "#/$defs/NotificationParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ToolListChangedNotification {
#[serde(deserialize_with = "validate::tool_list_changed_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::tool_list_changed_notification_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<NotificationParams>,
}
impl ToolListChangedNotification {
pub fn new(params: ::std::option::Option<NotificationParams>) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method: "notifications/tools/list_changed".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/tools/list_changed"
pub fn method_value() -> &'static str {
"notifications/tools/list_changed"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/tools/list_changed"
}
}
/**An optional JSON Schema object defining the structure of the tool's output returned in
the structuredContent field of a CallToolResult.
Defaults to JSON Schema 2020-12 when no explicit $schema is provided.
Currently restricted to type: "object" at the root level.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "An optional JSON Schema object defining the structure of the tool's output returned in\nthe structuredContent field of a CallToolResult.\n\nDefaults to JSON Schema 2020-12 when no explicit $schema is provided.\nCurrently restricted to type: \"object\" at the root level.",
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "$schema": {
/// "type": "string"
/// },
/// "properties": {
/// "type": "object",
/// "additionalProperties": {
/// "type": "object",
/// "additionalProperties": true
/// }
/// },
/// "required": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "type": {
/// "type": "string",
/// "const": "object"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ToolOutputSchema {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub properties: ::std::option::Option<
std::collections::BTreeMap<::std::string::String, ::serde_json::Map<::std::string::String, ::serde_json::Value>>,
>,
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub required: ::std::vec::Vec<::std::string::String>,
#[serde(rename = "$schema", default, skip_serializing_if = "::std::option::Option::is_none")]
pub schema: ::std::option::Option<::std::string::String>,
#[serde(rename = "type", deserialize_with = "validate::tool_output_schema_type_")]
type_: ::std::string::String,
}
impl ToolOutputSchema {
pub fn new(
required: ::std::vec::Vec<::std::string::String>,
properties: ::std::option::Option<
std::collections::BTreeMap<::std::string::String, ::serde_json::Map<::std::string::String, ::serde_json::Value>>,
>,
schema: ::std::option::Option<::std::string::String>,
) -> Self {
Self {
properties,
required,
schema,
type_: "object".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "object"
pub fn type_value() -> &'static str {
"object"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"object"
}
}
///The result of a tool use, provided by the user back to the assistant.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The result of a tool use, provided by the user back to the assistant.",
/// "type": "object",
/// "required": [
/// "content",
/// "toolUseId",
/// "type"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "Optional metadata about the tool result. Clients SHOULD preserve this field when\nincluding tool results in subsequent sampling requests to enable caching optimizations.\n\nSee [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "content": {
/// "description": "The unstructured result content of the tool use.\n\nThis has the same format as CallToolResult.content and can include text, images,\naudio, resource links, and embedded resources.",
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/ContentBlock"
/// }
/// },
/// "isError": {
/// "description": "Whether the tool use resulted in an error.\n\nIf true, the content typically describes the error that occurred.\nDefault: false",
/// "type": "boolean"
/// },
/// "structuredContent": {
/// "description": "An optional structured result object.\n\nIf the tool defined an outputSchema, this SHOULD conform to that schema.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "toolUseId": {
/// "description": "The ID of the tool use this result corresponds to.\n\nThis MUST match the ID from a previous ToolUseContent.",
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "tool_result"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ToolResultContent {
/**The unstructured result content of the tool use.
This has the same format as CallToolResult.content and can include text, images,
audio, resource links, and embedded resources.*/
pub content: ::std::vec::Vec<ContentBlock>,
/**Whether the tool use resulted in an error.
If true, the content typically describes the error that occurred.
Default: false*/
#[serde(rename = "isError", default, skip_serializing_if = "::std::option::Option::is_none")]
pub is_error: ::std::option::Option<bool>,
/**Optional metadata about the tool result. Clients SHOULD preserve this field when
including tool results in subsequent sampling requests to enable caching optimizations.
See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.*/
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
/**An optional structured result object.
If the tool defined an outputSchema, this SHOULD conform to that schema.*/
#[serde(
rename = "structuredContent",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub structured_content: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
/**The ID of the tool use this result corresponds to.
This MUST match the ID from a previous ToolUseContent.*/
#[serde(rename = "toolUseId")]
pub tool_use_id: ::std::string::String,
#[serde(rename = "type", deserialize_with = "validate::tool_result_content_type_")]
type_: ::std::string::String,
}
impl ToolResultContent {
pub fn new(
content: ::std::vec::Vec<ContentBlock>,
tool_use_id: ::std::string::String,
is_error: ::std::option::Option<bool>,
meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
structured_content: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
) -> Self {
Self {
content,
is_error,
meta,
structured_content,
tool_use_id,
type_: "tool_result".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "tool_result"
pub fn type_value() -> &'static str {
"tool_result"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"tool_result"
}
}
///A request from the assistant to call a tool.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request from the assistant to call a tool.",
/// "type": "object",
/// "required": [
/// "id",
/// "input",
/// "name",
/// "type"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "Optional metadata about the tool use. Clients SHOULD preserve this field when\nincluding tool uses in subsequent sampling requests to enable caching optimizations.\n\nSee [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "id": {
/// "description": "A unique identifier for this tool use.\n\nThis ID is used to match tool results to their corresponding tool uses.",
/// "type": "string"
/// },
/// "input": {
/// "description": "The arguments to pass to the tool, conforming to the tool's input schema.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "name": {
/// "description": "The name of the tool to call.",
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "tool_use"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ToolUseContent {
/**A unique identifier for this tool use.
This ID is used to match tool results to their corresponding tool uses.*/
pub id: ::std::string::String,
///The arguments to pass to the tool, conforming to the tool's input schema.
pub input: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
/**Optional metadata about the tool use. Clients SHOULD preserve this field when
including tool uses in subsequent sampling requests to enable caching optimizations.
See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.*/
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
///The name of the tool to call.
pub name: ::std::string::String,
#[serde(rename = "type", deserialize_with = "validate::tool_use_content_type_")]
type_: ::std::string::String,
}
impl ToolUseContent {
pub fn new(
id: ::std::string::String,
input: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
name: ::std::string::String,
meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
) -> Self {
Self {
id,
input,
meta,
name,
type_: "tool_use".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "tool_use"
pub fn type_value() -> &'static str {
"tool_use"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"tool_use"
}
}
///See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct UnsubscribeMeta {
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
#[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
pub progress_token: ::std::option::Option<ProgressToken>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "resources/unsubscribe"
/// },
/// "params": {
/// "$ref": "#/$defs/UnsubscribeRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct UnsubscribeRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::unsubscribe_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::unsubscribe_request_method")]
method: ::std::string::String,
pub params: UnsubscribeRequestParams,
}
impl UnsubscribeRequest {
pub fn new(id: RequestId, params: UnsubscribeRequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "resources/unsubscribe".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "resources/unsubscribe"
pub fn method_value() -> &'static str {
"resources/unsubscribe"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"resources/unsubscribe"
}
}
///Parameters for a resources/unsubscribe request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a resources/unsubscribe request.",
/// "type": "object",
/// "required": [
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "See [General fields: _meta](https://modelcontextprotocol.io/specification/2025-11-25/basic/index#meta) for notes on _meta usage.",
/// "type": "object",
/// "properties": {
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.",
/// "$ref": "#/$defs/ProgressToken"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "uri": {
/// "description": "The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct UnsubscribeRequestParams {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<UnsubscribeMeta>,
///The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.
pub uri: ::std::string::String,
}
///Schema for multiple-selection enumeration without display titles for options.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Schema for multiple-selection enumeration without display titles for options.",
/// "type": "object",
/// "required": [
/// "items",
/// "type"
/// ],
/// "properties": {
/// "default": {
/// "description": "Optional default value.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "description": {
/// "description": "Optional description for the enum field.",
/// "type": "string"
/// },
/// "items": {
/// "description": "Schema for the array items.",
/// "type": "object",
/// "required": [
/// "enum",
/// "type"
/// ],
/// "properties": {
/// "enum": {
/// "description": "Array of enum values to choose from.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "type": {
/// "type": "string",
/// "const": "string"
/// }
/// }
/// },
/// "maxItems": {
/// "description": "Maximum number of items to select.",
/// "type": "integer"
/// },
/// "minItems": {
/// "description": "Minimum number of items to select.",
/// "type": "integer"
/// },
/// "title": {
/// "description": "Optional title for the enum field.",
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "array"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct UntitledMultiSelectEnumSchema {
///Optional default value.
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub default: ::std::vec::Vec<::std::string::String>,
///Optional description for the enum field.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
pub items: UntitledMultiSelectEnumSchemaItems,
///Maximum number of items to select.
#[serde(rename = "maxItems", default, skip_serializing_if = "::std::option::Option::is_none")]
pub max_items: ::std::option::Option<i64>,
///Minimum number of items to select.
#[serde(rename = "minItems", default, skip_serializing_if = "::std::option::Option::is_none")]
pub min_items: ::std::option::Option<i64>,
///Optional title for the enum field.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
#[serde(rename = "type", deserialize_with = "validate::untitled_multi_select_enum_schema_type_")]
type_: ::std::string::String,
}
impl UntitledMultiSelectEnumSchema {
pub fn new(
default: ::std::vec::Vec<::std::string::String>,
items: UntitledMultiSelectEnumSchemaItems,
description: ::std::option::Option<::std::string::String>,
max_items: ::std::option::Option<i64>,
min_items: ::std::option::Option<i64>,
title: ::std::option::Option<::std::string::String>,
) -> Self {
Self {
default,
description,
items,
max_items,
min_items,
title,
type_: "array".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "array"
pub fn type_value() -> &'static str {
"array"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"array"
}
}
///Schema for the array items.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Schema for the array items.",
/// "type": "object",
/// "required": [
/// "enum",
/// "type"
/// ],
/// "properties": {
/// "enum": {
/// "description": "Array of enum values to choose from.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "type": {
/// "type": "string",
/// "const": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct UntitledMultiSelectEnumSchemaItems {
///Array of enum values to choose from.
#[serde(rename = "enum")]
pub enum_: ::std::vec::Vec<::std::string::String>,
#[serde(
rename = "type",
deserialize_with = "validate::untitled_multi_select_enum_schema_items_type_"
)]
type_: ::std::string::String,
}
impl UntitledMultiSelectEnumSchemaItems {
pub fn new(enum_: ::std::vec::Vec<::std::string::String>) -> Self {
Self {
enum_,
type_: "string".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "string"
pub fn type_value() -> &'static str {
"string"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"string"
}
}
///Schema for single-selection enumeration without display titles for options.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Schema for single-selection enumeration without display titles for options.",
/// "type": "object",
/// "required": [
/// "enum",
/// "type"
/// ],
/// "properties": {
/// "default": {
/// "description": "Optional default value.",
/// "type": "string"
/// },
/// "description": {
/// "description": "Optional description for the enum field.",
/// "type": "string"
/// },
/// "enum": {
/// "description": "Array of enum values to choose from.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "title": {
/// "description": "Optional title for the enum field.",
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct UntitledSingleSelectEnumSchema {
///Optional default value.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub default: ::std::option::Option<::std::string::String>,
///Optional description for the enum field.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<::std::string::String>,
///Array of enum values to choose from.
#[serde(rename = "enum")]
pub enum_: ::std::vec::Vec<::std::string::String>,
///Optional title for the enum field.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub title: ::std::option::Option<::std::string::String>,
#[serde(rename = "type", deserialize_with = "validate::untitled_single_select_enum_schema_type_")]
type_: ::std::string::String,
}
impl UntitledSingleSelectEnumSchema {
pub fn new(
enum_: ::std::vec::Vec<::std::string::String>,
default: ::std::option::Option<::std::string::String>,
description: ::std::option::Option<::std::string::String>,
title: ::std::option::Option<::std::string::String>,
) -> Self {
Self {
default,
description,
enum_,
title,
type_: "string".to_string(),
}
}
pub fn type_(&self) -> &::std::string::String {
&self.type_
}
/// returns "string"
pub fn type_value() -> &'static str {
"string"
}
#[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
pub fn type_name() -> &'static str {
"string"
}
}
///UrlElicitError
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "allOf": [
/// {
/// "$ref": "#/$defs/Error"
/// },
/// {
/// "type": "object",
/// "required": [
/// "code",
/// "data"
/// ],
/// "properties": {
/// "code": {
/// "type": "integer"
/// },
/// "data": {
/// "type": "object",
/// "required": [
/// "elicitations"
/// ],
/// "properties": {
/// "elicitations": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/ElicitRequestURLParams"
/// }
/// }
/// },
/// "additionalProperties": {}
/// }
/// }
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct UrlElicitError {
#[serde(deserialize_with = "validate::url_elicit_error_code")]
code: i64,
pub data: UrlElicitErrorData,
///A short description of the error. The message SHOULD be limited to a concise single sentence.
pub message: ::std::string::String,
}
impl UrlElicitError {
pub fn new(data: UrlElicitErrorData, message: ::std::string::String) -> Self {
Self {
code: -32042i64,
data,
message,
}
}
pub fn code(&self) -> &i64 {
&self.code
}
/// returns -32042i64
pub fn code_value() -> i64 {
-32042i64
}
#[deprecated(since = "0.8.0", note = "Use `code_value()` instead.")]
pub fn code_name() -> i64 {
-32042i64
}
}
///UrlElicitErrorData
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "elicitations"
/// ],
/// "properties": {
/// "elicitations": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/ElicitRequestURLParams"
/// }
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct UrlElicitErrorData {
pub elicitations: ::std::vec::Vec<ElicitRequestUrlParams>,
#[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///An error response that indicates that the server requires the client to provide additional information via an elicitation request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "An error response that indicates that the server requires the client to provide additional information via an elicitation request.",
/// "type": "object",
/// "required": [
/// "error",
/// "jsonrpc"
/// ],
/// "properties": {
/// "error": {
/// "allOf": [
/// {
/// "$ref": "#/$defs/Error"
/// },
/// {
/// "type": "object",
/// "required": [
/// "code",
/// "data"
/// ],
/// "properties": {
/// "code": {
/// "type": "integer"
/// },
/// "data": {
/// "type": "object",
/// "required": [
/// "elicitations"
/// ],
/// "properties": {
/// "elicitations": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/ElicitRequestURLParams"
/// }
/// }
/// },
/// "additionalProperties": {}
/// }
/// }
/// }
/// ]
/// },
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct UrlElicitationRequiredError {
pub error: UrlElicitError,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub id: ::std::option::Option<RequestId>,
#[serde(deserialize_with = "validate::url_elicitation_required_error_jsonrpc")]
jsonrpc: ::std::string::String,
}
impl UrlElicitationRequiredError {
pub fn new(error: UrlElicitError, id: ::std::option::Option<RequestId>) -> Self {
Self {
error,
id,
jsonrpc: JSONRPC_VERSION.to_string(),
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
/// Implementing the Deserialize trait
/// This allows enum to be deserialized into correct type based on the value of the "method"
impl<'de> serde::Deserialize<'de> for ClientRequest {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value: serde_json::Value = serde::Deserialize::deserialize(deserializer)?;
let method_option = value.get("method").and_then(|v| v.as_str());
if let Some(method) = method_option {
match method {
"initialize" => {
let req = serde_json::from_value::<InitializeRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::InitializeRequest(req))
}
"ping" => {
let req = serde_json::from_value::<PingRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::PingRequest(req))
}
"resources/list" => {
let req = serde_json::from_value::<ListResourcesRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::ListResourcesRequest(req))
}
"resources/templates/list" => {
let req =
serde_json::from_value::<ListResourceTemplatesRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::ListResourceTemplatesRequest(req))
}
"resources/read" => {
let req = serde_json::from_value::<ReadResourceRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::ReadResourceRequest(req))
}
"resources/subscribe" => {
let req = serde_json::from_value::<SubscribeRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::SubscribeRequest(req))
}
"resources/unsubscribe" => {
let req = serde_json::from_value::<UnsubscribeRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::UnsubscribeRequest(req))
}
"prompts/list" => {
let req = serde_json::from_value::<ListPromptsRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::ListPromptsRequest(req))
}
"prompts/get" => {
let req = serde_json::from_value::<GetPromptRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::GetPromptRequest(req))
}
"tools/list" => {
let req = serde_json::from_value::<ListToolsRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::ListToolsRequest(req))
}
"tools/call" => {
let req = serde_json::from_value::<CallToolRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::CallToolRequest(req))
}
"tasks/get" => {
let req = serde_json::from_value::<GetTaskRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::GetTaskRequest(req))
}
"tasks/result" => {
let req = serde_json::from_value::<GetTaskPayloadRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::GetTaskPayloadRequest(req))
}
"tasks/cancel" => {
let req = serde_json::from_value::<CancelTaskRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::CancelTaskRequest(req))
}
"tasks/list" => {
let req = serde_json::from_value::<ListTasksRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::ListTasksRequest(req))
}
"logging/setLevel" => {
let req = serde_json::from_value::<SetLevelRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::SetLevelRequest(req))
}
"completion/complete" => {
let req = serde_json::from_value::<CompleteRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::CompleteRequest(req))
}
_ => Err(serde::de::Error::unknown_variant("method", &[""])),
}
} else {
Err(serde::de::Error::missing_field("method"))
}
}
}
impl ClientRequest {
pub fn method(&self) -> &str {
match self {
ClientRequest::InitializeRequest(request) => request.method(),
ClientRequest::PingRequest(request) => request.method(),
ClientRequest::ListResourcesRequest(request) => request.method(),
ClientRequest::ListResourceTemplatesRequest(request) => request.method(),
ClientRequest::ReadResourceRequest(request) => request.method(),
ClientRequest::SubscribeRequest(request) => request.method(),
ClientRequest::UnsubscribeRequest(request) => request.method(),
ClientRequest::ListPromptsRequest(request) => request.method(),
ClientRequest::GetPromptRequest(request) => request.method(),
ClientRequest::ListToolsRequest(request) => request.method(),
ClientRequest::CallToolRequest(request) => request.method(),
ClientRequest::GetTaskRequest(request) => request.method(),
ClientRequest::GetTaskPayloadRequest(request) => request.method(),
ClientRequest::CancelTaskRequest(request) => request.method(),
ClientRequest::ListTasksRequest(request) => request.method(),
ClientRequest::SetLevelRequest(request) => request.method(),
ClientRequest::CompleteRequest(request) => request.method(),
}
}
}
/// Implementing the Deserialize trait
/// This allows enum to be deserialized into correct type based on the value of the "method"
impl<'de> serde::Deserialize<'de> for ClientNotification {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value: serde_json::Value = serde::Deserialize::deserialize(deserializer)?;
let method_option = value.get("method").and_then(|v| v.as_str());
if let Some(method) = method_option {
match method {
"notifications/cancelled" => {
let req = serde_json::from_value::<CancelledNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ClientNotification::CancelledNotification(req))
}
"notifications/initialized" => {
let req = serde_json::from_value::<InitializedNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ClientNotification::InitializedNotification(req))
}
"notifications/progress" => {
let req = serde_json::from_value::<ProgressNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ClientNotification::ProgressNotification(req))
}
"notifications/tasks/status" => {
let req = serde_json::from_value::<TaskStatusNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ClientNotification::TaskStatusNotification(req))
}
"notifications/roots/list_changed" => {
let req =
serde_json::from_value::<RootsListChangedNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ClientNotification::RootsListChangedNotification(req))
}
_ => Err(serde::de::Error::unknown_variant("method", &[""])),
}
} else {
Err(serde::de::Error::missing_field("method"))
}
}
}
impl ClientNotification {
pub fn method(&self) -> &str {
match self {
ClientNotification::CancelledNotification(request) => request.method(),
ClientNotification::InitializedNotification(request) => request.method(),
ClientNotification::ProgressNotification(request) => request.method(),
ClientNotification::TaskStatusNotification(request) => request.method(),
ClientNotification::RootsListChangedNotification(request) => request.method(),
}
}
}
/// Implementing the Deserialize trait
/// This allows enum to be deserialized into correct type based on the value of the "method"
impl<'de> serde::Deserialize<'de> for ServerRequest {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value: serde_json::Value = serde::Deserialize::deserialize(deserializer)?;
let method_option = value.get("method").and_then(|v| v.as_str());
if let Some(method) = method_option {
match method {
"ping" => {
let req = serde_json::from_value::<PingRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ServerRequest::PingRequest(req))
}
"tasks/get" => {
let req = serde_json::from_value::<GetTaskRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ServerRequest::GetTaskRequest(req))
}
"tasks/result" => {
let req = serde_json::from_value::<GetTaskPayloadRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ServerRequest::GetTaskPayloadRequest(req))
}
"tasks/cancel" => {
let req = serde_json::from_value::<CancelTaskRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ServerRequest::CancelTaskRequest(req))
}
"tasks/list" => {
let req = serde_json::from_value::<ListTasksRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ServerRequest::ListTasksRequest(req))
}
"sampling/createMessage" => {
let req = serde_json::from_value::<CreateMessageRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ServerRequest::CreateMessageRequest(req))
}
"roots/list" => {
let req = serde_json::from_value::<ListRootsRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ServerRequest::ListRootsRequest(req))
}
"elicitation/create" => {
let req = serde_json::from_value::<ElicitRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ServerRequest::ElicitRequest(req))
}
_ => Err(serde::de::Error::unknown_variant("method", &[""])),
}
} else {
Err(serde::de::Error::missing_field("method"))
}
}
}
impl ServerRequest {
pub fn method(&self) -> &str {
match self {
ServerRequest::PingRequest(request) => request.method(),
ServerRequest::GetTaskRequest(request) => request.method(),
ServerRequest::GetTaskPayloadRequest(request) => request.method(),
ServerRequest::CancelTaskRequest(request) => request.method(),
ServerRequest::ListTasksRequest(request) => request.method(),
ServerRequest::CreateMessageRequest(request) => request.method(),
ServerRequest::ListRootsRequest(request) => request.method(),
ServerRequest::ElicitRequest(request) => request.method(),
}
}
}
/// Implementing the Deserialize trait
/// This allows enum to be deserialized into correct type based on the value of the "method"
impl<'de> serde::Deserialize<'de> for ServerNotification {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value: serde_json::Value = serde::Deserialize::deserialize(deserializer)?;
let method_option = value.get("method").and_then(|v| v.as_str());
if let Some(method) = method_option {
match method {
"notifications/cancelled" => {
let req = serde_json::from_value::<CancelledNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ServerNotification::CancelledNotification(req))
}
"notifications/progress" => {
let req = serde_json::from_value::<ProgressNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ServerNotification::ProgressNotification(req))
}
"notifications/resources/list_changed" => {
let req = serde_json::from_value::<ResourceListChangedNotification>(value)
.map_err(serde::de::Error::custom)?;
Ok(ServerNotification::ResourceListChangedNotification(req))
}
"notifications/resources/updated" => {
let req =
serde_json::from_value::<ResourceUpdatedNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ServerNotification::ResourceUpdatedNotification(req))
}
"notifications/prompts/list_changed" => {
let req =
serde_json::from_value::<PromptListChangedNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ServerNotification::PromptListChangedNotification(req))
}
"notifications/tools/list_changed" => {
let req =
serde_json::from_value::<ToolListChangedNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ServerNotification::ToolListChangedNotification(req))
}
"notifications/tasks/status" => {
let req = serde_json::from_value::<TaskStatusNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ServerNotification::TaskStatusNotification(req))
}
"notifications/message" => {
let req =
serde_json::from_value::<LoggingMessageNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ServerNotification::LoggingMessageNotification(req))
}
"notifications/elicitation/complete" => {
let req = serde_json::from_value::<ElicitationCompleteNotification>(value)
.map_err(serde::de::Error::custom)?;
Ok(ServerNotification::ElicitationCompleteNotification(req))
}
_ => Err(serde::de::Error::unknown_variant("method", &[""])),
}
} else {
Err(serde::de::Error::missing_field("method"))
}
}
}
impl ServerNotification {
pub fn method(&self) -> &str {
match self {
ServerNotification::CancelledNotification(request) => request.method(),
ServerNotification::ProgressNotification(request) => request.method(),
ServerNotification::ResourceListChangedNotification(request) => request.method(),
ServerNotification::ResourceUpdatedNotification(request) => request.method(),
ServerNotification::PromptListChangedNotification(request) => request.method(),
ServerNotification::ToolListChangedNotification(request) => request.method(),
ServerNotification::TaskStatusNotification(request) => request.method(),
ServerNotification::LoggingMessageNotification(request) => request.method(),
ServerNotification::ElicitationCompleteNotification(request) => request.method(),
}
}
}
/// Converts any serializable struct into a `GenericResult`.
/// This is used internally to convert ServerResult and ClientResult variants
/// into GenericResult (Result)
fn into_result<T>(value: T) -> GenericResult
where
T: serde::Serialize,
{
let json_value = serde_json::to_value(value).unwrap_or(serde_json::Value::Null);
if let serde_json::Value::Object(mut map) = json_value {
let meta = map.remove("_meta").and_then(|v| match v {
serde_json::Value::Object(obj) => Some(obj),
_ => None,
});
let extra = if map.is_empty() { None } else { Some(map) };
GenericResult { meta, extra }
} else {
GenericResult { meta: None, extra: None }
}
}
impl From<InitializeResult> for GenericResult {
fn from(value: InitializeResult) -> Self {
into_result(value)
}
}
impl From<ListResourcesResult> for GenericResult {
fn from(value: ListResourcesResult) -> Self {
into_result(value)
}
}
impl From<ListResourceTemplatesResult> for GenericResult {
fn from(value: ListResourceTemplatesResult) -> Self {
into_result(value)
}
}
impl From<ReadResourceResult> for GenericResult {
fn from(value: ReadResourceResult) -> Self {
into_result(value)
}
}
impl From<ListPromptsResult> for GenericResult {
fn from(value: ListPromptsResult) -> Self {
into_result(value)
}
}
impl From<GetPromptResult> for GenericResult {
fn from(value: GetPromptResult) -> Self {
into_result(value)
}
}
impl From<ListToolsResult> for GenericResult {
fn from(value: ListToolsResult) -> Self {
into_result(value)
}
}
impl From<CallToolResult> for GenericResult {
fn from(value: CallToolResult) -> Self {
into_result(value)
}
}
impl From<GetTaskResult> for GenericResult {
fn from(value: GetTaskResult) -> Self {
into_result(value)
}
}
impl From<GetTaskPayloadResult> for GenericResult {
fn from(value: GetTaskPayloadResult) -> Self {
into_result(value)
}
}
impl From<CancelTaskResult> for GenericResult {
fn from(value: CancelTaskResult) -> Self {
into_result(value)
}
}
impl From<ListTasksResult> for GenericResult {
fn from(value: ListTasksResult) -> Self {
into_result(value)
}
}
impl From<CompleteResult> for GenericResult {
fn from(value: CompleteResult) -> Self {
into_result(value)
}
}
/// Alias to avoid conflicts with Rust's standard `Result` type.
pub type GenericResult = Result;
/// Deprecating the old auto-generated verbose names.
/// These were renamed to clearer, shorter names in v0.8.0.
/// The old names are deprecated but kept for backward-compatibility for a smooth migration period.
///
#[deprecated(since = "0.8.0", note = "Use `IncludeContext` instead.")]
pub type CreateMessageRequestParamsIncludeContext = IncludeContext;
#[deprecated(since = "0.8.0", note = "Use `CompleteRequestContext` instead.")]
pub type CompleteRequestParamsContext = CompleteRequestContext;
#[deprecated(since = "0.8.0", note = "Use `CompleteRequestArgument` instead.")]
pub type CompleteRequestParamsArgument = CompleteRequestArgument;
#[deprecated(since = "0.8.0", note = "Use `CompleteRequestRef` instead.")]
pub type CompleteRequestParamsRef = CompleteRequestRef;
#[deprecated(since = "0.8.0", note = "Use `CreateMessageContent` instead.")]
pub type CreateMessageResultContent = CreateMessageContent;
#[deprecated(since = "0.8.0", note = "Use `ElicitResultContent` instead.")]
pub type ElicitResultContentValue = ElicitResultContent;
#[deprecated(since = "0.8.0", note = "Use `ClientRoots` instead.")]
pub type ClientCapabilitiesRoots = ClientRoots;
#[deprecated(since = "0.8.0", note = "Use `ReadResourceContent` instead.")]
pub type ReadResourceResultContentsItem = ReadResourceContent;