/// 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 : 4e67bdc2f3403a8602f72025b28ac27fe7fd4e44
/// Generated at : 2026-08-21 20:10:23
/// ----------------------------------------------------------------------------
///
use super::validators as validate;
/// MCP Protocol Version
pub const LATEST_PROTOCOL_VERSION: &str = "2026-07-28";
/// 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;
///HEADER_MISMATCH
pub const HEADER_MISMATCH: i64 = -32020i64;
///MISSING_REQUIRED_CLIENT_CAPABILITY
pub const MISSING_REQUIRED_CLIENT_CAPABILITY: i64 = -32021i64;
///UNSUPPORTED_PROTOCOL_VERSION
pub const UNSUPPORTED_PROTOCOL_VERSION: i64 = -32022i64;
///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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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<MetaObject>,
) -> 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 {@link Tool},\nwhere annotations.title should be given precedence over using name,\nif present).",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
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 {@link 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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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, Default)]
pub struct BlobResourceContents {
///A base64-encoded string representing the binary data of the item.
pub blob: ::std::string::String,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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"
}
}
///A result that supports a time-to-live (TTL) hint for client-side caching.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A result that supports a time-to-live (TTL) hint for client-side caching.",
/// "type": "object",
/// "required": [
/// "cacheScope",
/// "resultType",
/// "ttlMs"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "cacheScope": {
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// },
/// "ttlMs": {
/// "description": "A hint from the server indicating how long (in milliseconds) the\nclient MAY cache this response before re-fetching. Semantics are\nanalogous to HTTP Cache-Control max-age.\n\n- If 0, The response SHOULD be considered immediately stale,\n The client MAY re-fetch every time the result is needed.\n- If positive, the client SHOULD consider the result fresh for this many\n milliseconds after receiving the response.",
/// "type": "integer",
/// "minimum": 0.0
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CacheableResult {
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
#[serde(rename = "cacheScope")]
pub cache_scope: CacheableResultCacheScope,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
/**A hint from the server indicating how long (in milliseconds) the
client MAY cache this response before re-fetching. Semantics are
analogous to HTTP Cache-Control max-age.
- If 0, The response SHOULD be considered immediately stale,
The client MAY re-fetch every time the result is needed.
- If positive, the client SHOULD consider the result fresh for this many
milliseconds after receiving the response.*/
#[serde(rename = "ttlMs")]
pub ttl_ms: u64,
}
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum CacheableResultCacheScope {
#[serde(rename = "private")]
Private,
#[serde(rename = "public")]
Public,
}
impl ::std::fmt::Display for CacheableResultCacheScope {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Private => write!(f, "private"),
Self::Public => write!(f, "public"),
}
}
}
///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": [
/// "_meta",
/// "name"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/RequestMetaObject"
/// },
/// "arguments": {
/// "description": "Arguments to use for the tool call.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "inputResponses": {
/// "$ref": "#/$defs/InputResponses"
/// },
/// "name": {
/// "description": "The name of the tool.",
/// "type": "string"
/// },
/// "requestState": {
/// "type": "string"
/// }
/// }
///}
/// ```
/// </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 = "inputResponses", default, skip_serializing_if = "::std::option::Option::is_none")]
pub input_responses: ::std::option::Option<InputResponses>,
#[serde(rename = "_meta")]
pub meta: RequestMetaObject,
///The name of the tool.
pub name: ::std::string::String,
#[serde(rename = "requestState", default, skip_serializing_if = "::std::option::Option::is_none")]
pub request_state: ::std::option::Option<::std::string::String>,
}
///The result returned by the server for a {@link CallToolRequesttools/call} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The result returned by the server for a {@link CallToolRequesttools/call} request.",
/// "type": "object",
/// "required": [
/// "content",
/// "resultType"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "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"
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// },
/// "structuredContent": {
/// "description": "An optional JSON value that represents the structured result of the tool call.\n\nThis can be any JSON value (object, array, string, number, boolean, or null)\nthat conforms to the tool's outputSchema if one is defined."
/// }
/// }
///}
/// ```
/// </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>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
/**An optional JSON value that represents the structured result of the tool call.
This can be any JSON value (object, array, string, number, boolean, or null)
that conforms to the tool's outputSchema if one is defined.*/
#[serde(
rename = "structuredContent",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub structured_content: ::std::option::Option<::serde_json::Value>,
}
///A successful response from the server for a {@link CallToolRequesttools/call} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A successful response from the server for a {@link CallToolRequesttools/call} request.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "result"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "result": {
/// "anyOf": [
/// {
/// "$ref": "#/$defs/InputRequiredResult"
/// },
/// {
/// "$ref": "#/$defs/CallToolResult"
/// }
/// ]
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CallToolResultResponse {
pub id: RequestId,
#[serde(deserialize_with = "validate::call_tool_result_response_jsonrpc")]
jsonrpc: ::std::string::String,
pub result: CallToolResultResponseResult,
}
impl CallToolResultResponse {
pub fn new(id: RequestId, result: CallToolResultResponseResult) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
result,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///CallToolResultResponseResult
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/InputRequiredResult"
/// },
/// {
/// "$ref": "#/$defs/CallToolResult"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum CallToolResultResponseResult {
InputRequiredResult(InputRequiredResult),
CallToolResult(CallToolResult),
}
impl ::std::convert::From<InputRequiredResult> for CallToolResultResponseResult {
fn from(value: InputRequiredResult) -> Self {
Self::InputRequiredResult(value)
}
}
impl ::std::convert::From<CallToolResult> for CallToolResultResponseResult {
fn from(value: CallToolResult) -> Self {
Self::CallToolResult(value)
}
}
/**This notification is sent by the client to indicate that it is cancelling a request it previously issued.
On stdio, the server also sends this notification, solely to terminate a {@link SubscriptionsListenRequestsubscriptions/listen} stream: it references the ID of the subscriptions/listen request that opened the stream. Servers MUST NOT use this notification to cancel any other 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.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "This notification is sent by the client to indicate that it is cancelling a request it previously issued.\n\nOn stdio, the server also sends this notification, solely to terminate a {@link SubscriptionsListenRequestsubscriptions/listen} stream: it references the ID of the subscriptions/listen request that opened the stream. Servers MUST NOT use this notification to cancel any other 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.",
/// "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",
/// "required": [
/// "requestId"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/NotificationMetaObject"
/// },
/// "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 the client previously issued.",
/// "$ref": "#/$defs/RequestId"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct CancelledNotificationParams {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<NotificationMetaObject>,
///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 the client previously issued.*/
#[serde(rename = "requestId")]
pub request_id: RequestId,
}
///Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
///
/// <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": {
/// "$ref": "#/$defs/JSONObject"
/// },
/// "url": {
/// "$ref": "#/$defs/JSONObject"
/// }
/// }
/// },
/// "experimental": {
/// "description": "Experimental, non-standard capabilities that the client supports.",
/// "type": "object",
/// "additionalProperties": {
/// "$ref": "#/$defs/JSONObject"
/// }
/// },
/// "extensions": {
/// "description": "Optional MCP extensions that the client supports. Keys are extension identifiers\n(e.g., \"io.modelcontextprotocol/oauth-client-credentials\"), and values are\nper-extension settings objects. An empty object indicates support with no settings.\n\nKeys MUST follow the {@link MetaObject_meta key naming rules}, with a\nmandatory prefix.",
/// "type": "object",
/// "additionalProperties": {
/// "$ref": "#/$defs/JSONObject"
/// }
/// },
/// "roots": {
/// "description": "Present if the client supports listing roots.",
/// "type": "object"
/// },
/// "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).",
/// "$ref": "#/$defs/JSONObject"
/// },
/// "tools": {
/// "description": "Whether the client supports tool use via tools and toolChoice parameters.",
/// "$ref": "#/$defs/JSONObject"
/// }
/// }
/// }
/// }
///}
/// ```
/// </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, JsonObject>>,
/**Optional MCP extensions that the client supports. Keys are extension identifiers
(e.g., "io.modelcontextprotocol/oauth-client-credentials"), and values are
per-extension settings objects. An empty object indicates support with no settings.
Keys MUST follow the {@link MetaObject_meta key naming rules}, with a
mandatory prefix.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub extensions: ::std::option::Option<std::collections::BTreeMap<::std::string::String, JsonObject>>,
///Present if the client supports listing roots.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub roots: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub sampling: ::std::option::Option<ClientSampling>,
}
///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": {
/// "$ref": "#/$defs/JSONObject"
/// },
/// "url": {
/// "$ref": "#/$defs/JSONObject"
/// }
/// }
///}
/// ```
/// </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<JsonObject>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub url: ::std::option::Option<JsonObject>,
}
/**This notification is sent by the client to indicate that it is cancelling a request it previously issued.
On stdio, the server also sends this notification, solely to terminate a {@link SubscriptionsListenRequestsubscriptions/listen} stream: it references the ID of the subscriptions/listen request that opened the stream. Servers MUST NOT use this notification to cancel any other 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.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "This notification is sent by the client to indicate that it is cancelling a request it previously issued.\n\nOn stdio, the server also sends this notification, solely to terminate a {@link SubscriptionsListenRequestsubscriptions/listen} stream: it references the ID of the subscriptions/listen request that opened the stream. Servers MUST NOT use this notification to cancel any other 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.",
/// "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 ClientNotification {
#[serde(deserialize_with = "validate::client_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::client_notification_method")]
method: ::std::string::String,
pub params: CancelledNotificationParams,
}
impl ClientNotification {
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"
}
}
///ClientRequest
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/DiscoverRequest"
/// },
/// {
/// "$ref": "#/$defs/ListResourcesRequest"
/// },
/// {
/// "$ref": "#/$defs/ListResourceTemplatesRequest"
/// },
/// {
/// "$ref": "#/$defs/ReadResourceRequest"
/// },
/// {
/// "$ref": "#/$defs/SubscriptionsListenRequest"
/// },
/// {
/// "$ref": "#/$defs/ListPromptsRequest"
/// },
/// {
/// "$ref": "#/$defs/GetPromptRequest"
/// },
/// {
/// "$ref": "#/$defs/ListToolsRequest"
/// },
/// {
/// "$ref": "#/$defs/CallToolRequest"
/// },
/// {
/// "$ref": "#/$defs/CompleteRequest"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ClientRequest {
DiscoverRequest(DiscoverRequest),
ListResourcesRequest(ListResourcesRequest),
ListResourceTemplatesRequest(ListResourceTemplatesRequest),
ReadResourceRequest(ReadResourceRequest),
SubscriptionsListenRequest(SubscriptionsListenRequest),
ListPromptsRequest(ListPromptsRequest),
GetPromptRequest(GetPromptRequest),
ListToolsRequest(ListToolsRequest),
CallToolRequest(CallToolRequest),
CompleteRequest(CompleteRequest),
}
impl ::std::convert::From<DiscoverRequest> for ClientRequest {
fn from(value: DiscoverRequest) -> Self {
Self::DiscoverRequest(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<SubscriptionsListenRequest> for ClientRequest {
fn from(value: SubscriptionsListenRequest) -> Self {
Self::SubscriptionsListenRequest(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<CompleteRequest> for ClientRequest {
fn from(value: CompleteRequest) -> Self {
Self::CompleteRequest(value)
}
}
///Common result fields.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Common result fields.",
/// "$ref": "#/$defs/Result"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct ClientResult(pub Result);
///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).",
/// "$ref": "#/$defs/JSONObject"
/// },
/// "tools": {
/// "description": "Whether the client supports tool use via tools and toolChoice parameters.",
/// "$ref": "#/$defs/JSONObject"
/// }
/// }
///}
/// ```
/// </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<JsonObject>,
///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<JsonObject>,
}
///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, Default)]
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>>,
}
///Parameters for a completion/complete request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a completion/complete request.",
/// "type": "object",
/// "required": [
/// "_meta",
/// "argument",
/// "ref"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/RequestMetaObject"
/// },
/// "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")]
pub meta: RequestMetaObject,
#[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 result returned by the server for a {@link CompleteRequestcompletion/complete} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The result returned by the server for a {@link CompleteRequestcompletion/complete} request.",
/// "type": "object",
/// "required": [
/// "completion",
/// "resultType"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "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"
/// },
/// "maxItems": 100
/// }
/// }
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CompleteResult {
pub completion: CompleteResultCompletion,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
}
///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"
/// },
/// "maxItems": 100
/// }
/// }
///}
/// ```
/// </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>,
}
///A successful response from the server for a {@link CompleteRequestcompletion/complete} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A successful response from the server for a {@link CompleteRequestcompletion/complete} request.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "result"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "result": {
/// "$ref": "#/$defs/CompleteResult"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CompleteResultResponse {
pub id: RequestId,
#[serde(deserialize_with = "validate::complete_result_response_jsonrpc")]
jsonrpc: ::std::string::String,
pub result: CompleteResult,
}
impl CompleteResultResponse {
pub fn new(id: RequestId, result: CompleteResult) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
result,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///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": [
/// "method",
/// "params"
/// ],
/// "properties": {
/// "method": {
/// "type": "string",
/// "const": "sampling/createMessage"
/// },
/// "params": {
/// "$ref": "#/$defs/CreateMessageRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CreateMessageRequest {
#[serde(deserialize_with = "validate::create_message_request_method")]
method: ::std::string::String,
pub params: CreateMessageRequestParams,
}
impl CreateMessageRequest {
pub fn new(params: CreateMessageRequestParams) -> Self {
Self {
method: "sampling/createMessage".to_string(),
params,
}
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// 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": {
/// "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\". The values \"thisServer\" and \"allServers\" are deprecated (SEP-2596): servers SHOULD\nomit this field or use \"none\", and SHOULD only use the deprecated values if the client declares\n{@link ClientCapabilities.sampling.context}.",
/// "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.",
/// "$ref": "#/$defs/JSONObject"
/// },
/// "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"
/// },
/// "temperature": {
/// "type": "number"
/// },
/// "toolChoice": {
/// "description": "Controls how the model uses tools.\nThe client MUST return an error if this field is provided but {@link 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 {@link 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". The values "thisServer" and "allServers" are deprecated (SEP-2596): servers SHOULD
omit this field or use "none", and SHOULD only use the deprecated values if the client declares
{@link ClientCapabilities.sampling.context}.*/
#[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>,
///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<JsonObject>,
///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>,
#[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 {@link 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 {@link ClientCapabilities.sampling.tools} is not declared.*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub tools: ::std::vec::Vec<Tool>,
}
/**The result returned by the client for a {@link CreateMessageRequestsampling/createMessage} request.
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 result returned by the client for a {@link CreateMessageRequestsampling/createMessage} request.\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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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>,
}
///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, Default)]
#[serde(transparent)]
pub struct Cursor(pub ::std::string::String);
/**A request from the client asking the server to advertise its supported
protocol versions, capabilities, and other metadata. Servers **MUST**
implement server/discover. Clients **MAY** call it but are not required
to — version negotiation can also happen inline via per-request _meta.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request from the client asking the server to advertise its supported\nprotocol versions, capabilities, and other metadata. Servers **MUST**\nimplement server/discover. Clients **MAY** call it but are not required\nto — version negotiation can also happen inline via per-request _meta.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "server/discover"
/// },
/// "params": {
/// "$ref": "#/$defs/RequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct DiscoverRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::discover_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::discover_request_method")]
method: ::std::string::String,
pub params: RequestParams,
}
impl DiscoverRequest {
pub fn new(id: RequestId, params: RequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "server/discover".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "server/discover"
pub fn method_value() -> &'static str {
"server/discover"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"server/discover"
}
}
///The result returned by the server for a {@link DiscoverRequestserver/discover} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The result returned by the server for a {@link DiscoverRequestserver/discover} request.",
/// "type": "object",
/// "required": [
/// "cacheScope",
/// "capabilities",
/// "resultType",
/// "supportedVersions",
/// "ttlMs"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "cacheScope": {
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
/// },
/// "capabilities": {
/// "description": "The capabilities of the server.",
/// "$ref": "#/$defs/ServerCapabilities"
/// },
/// "instructions": {
/// "description": "Natural-language guidance describing the server and its features.\n\nThis can be used by clients to improve an LLM's understanding of\navailable tools (e.g., by including it in a system prompt). It should\nfocus on information that helps the model use the server effectively\nand should not duplicate information already in tool descriptions.",
/// "type": "string"
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// },
/// "supportedVersions": {
/// "description": "MCP Protocol Versions this server supports. The client should choose a\nversion from this list for use in subsequent requests.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "ttlMs": {
/// "description": "A hint from the server indicating how long (in milliseconds) the\nclient MAY cache this response before re-fetching. Semantics are\nanalogous to HTTP Cache-Control max-age.\n\n- If 0, The response SHOULD be considered immediately stale,\n The client MAY re-fetch every time the result is needed.\n- If positive, the client SHOULD consider the result fresh for this many\n milliseconds after receiving the response.",
/// "type": "integer",
/// "minimum": 0.0
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct DiscoverResult {
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
#[serde(rename = "cacheScope")]
pub cache_scope: DiscoverResultCacheScope,
///The capabilities of the server.
pub capabilities: ServerCapabilities,
/**Natural-language guidance describing the server and its features.
This can be used by clients to improve an LLM's understanding of
available tools (e.g., by including it in a system prompt). It should
focus on information that helps the model use the server effectively
and should not duplicate information already in tool descriptions.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub instructions: ::std::option::Option<::std::string::String>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
/**MCP Protocol Versions this server supports. The client should choose a
version from this list for use in subsequent requests.*/
#[serde(rename = "supportedVersions")]
pub supported_versions: ::std::vec::Vec<::std::string::String>,
/**A hint from the server indicating how long (in milliseconds) the
client MAY cache this response before re-fetching. Semantics are
analogous to HTTP Cache-Control max-age.
- If 0, The response SHOULD be considered immediately stale,
The client MAY re-fetch every time the result is needed.
- If positive, the client SHOULD consider the result fresh for this many
milliseconds after receiving the response.*/
#[serde(rename = "ttlMs")]
pub ttl_ms: u64,
}
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum DiscoverResultCacheScope {
#[serde(rename = "private")]
Private,
#[serde(rename = "public")]
Public,
}
impl ::std::fmt::Display for DiscoverResultCacheScope {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Private => write!(f, "private"),
Self::Public => write!(f, "public"),
}
}
}
///A successful response from the server for a {@link DiscoverRequestserver/discover} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A successful response from the server for a {@link DiscoverRequestserver/discover} request.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "result"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "result": {
/// "$ref": "#/$defs/DiscoverResult"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct DiscoverResultResponse {
pub id: RequestId,
#[serde(deserialize_with = "validate::discover_result_response_jsonrpc")]
jsonrpc: ::std::string::String,
pub result: DiscoverResult,
}
impl DiscoverResultResponse {
pub fn new(id: RequestId, result: DiscoverResult) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
result,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///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": [
/// "method",
/// "params"
/// ],
/// "properties": {
/// "method": {
/// "type": "string",
/// "const": "elicitation/create"
/// },
/// "params": {
/// "$ref": "#/$defs/ElicitRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ElicitRequest {
#[serde(deserialize_with = "validate::elicit_request_method")]
method: ::std::string::String,
pub params: ElicitRequestParams,
}
impl ElicitRequest {
pub fn new(params: ElicitRequestParams) -> Self {
Self {
method: "elicitation/create".to_string(),
params,
}
}
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": {
/// "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"
/// }
/// }
/// }
/// }
///}
/// ```
/// </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,
///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: ElicitRequestFormParamsRequestedSchema,
}
impl ElicitRequestFormParams {
pub fn new(message: ::std::string::String, requested_schema: ElicitRequestFormParamsRequestedSchema) -> Self {
Self {
message,
mode: Some("form".to_string()),
requested_schema,
}
}
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"
}
}
/**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 ElicitRequestFormParamsRequestedSchema {
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_request_form_params_requested_schema_type_"
)]
type_: ::std::string::String,
}
impl ElicitRequestFormParamsRequestedSchema {
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"
}
}
///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/ElicitRequestFormParams"
/// },
/// {
/// "$ref": "#/$defs/ElicitRequestURLParams"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ElicitRequestParams {
FormParams(ElicitRequestFormParams),
UrlParams(ElicitRequestUrlParams),
}
impl ::std::convert::From<ElicitRequestFormParams> for ElicitRequestParams {
fn from(value: ElicitRequestFormParams) -> Self {
Self::FormParams(value)
}
}
impl ::std::convert::From<ElicitRequestUrlParams> for ElicitRequestParams {
fn from(value: ElicitRequestUrlParams) -> Self {
Self::UrlParams(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": [
/// "message",
/// "mode",
/// "url"
/// ],
/// "properties": {
/// "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"
/// },
/// "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 message to present to the user explaining why the interaction is needed.
pub message: ::std::string::String,
///The elicitation mode.
#[serde(deserialize_with = "validate::elicit_request_url_params_mode")]
mode: ::std::string::String,
///The URL that the user should navigate to.
pub url: ::std::string::String,
}
impl ElicitRequestUrlParams {
pub fn new(message: ::std::string::String, url: ::std::string::String) -> Self {
Self {
message,
mode: "url".to_string(),
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 result returned by the client for an {@link ElicitRequestelicitation/create} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The result returned by the client for an {@link ElicitRequestelicitation/create} request.",
/// "type": "object",
/// "required": [
/// "action"
/// ],
/// "properties": {
/// "action": {
/// "description": "The user action in response to the elicitation.\n- \"accept\": User submitted the form/confirmed the action\n- \"decline\": User explicitly declined 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 declined 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>>,
}
/**The user action in response to the elicitation.
- "accept": User submitted the form/confirmed the action
- "decline": User explicitly declined 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 declined 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)
}
}
/**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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
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<MetaObject>,
) -> 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)
}
}
///Common result fields.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Common result fields.",
/// "$ref": "#/$defs/Result"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
#[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)
}
}
///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": [
/// "_meta",
/// "name"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/RequestMetaObject"
/// },
/// "arguments": {
/// "description": "Arguments to use for templating the prompt.",
/// "type": "object",
/// "additionalProperties": {
/// "type": "string"
/// }
/// },
/// "inputResponses": {
/// "$ref": "#/$defs/InputResponses"
/// },
/// "name": {
/// "description": "The name of the prompt or prompt template.",
/// "type": "string"
/// },
/// "requestState": {
/// "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 = "inputResponses", default, skip_serializing_if = "::std::option::Option::is_none")]
pub input_responses: ::std::option::Option<InputResponses>,
#[serde(rename = "_meta")]
pub meta: RequestMetaObject,
///The name of the prompt or prompt template.
pub name: ::std::string::String,
#[serde(rename = "requestState", default, skip_serializing_if = "::std::option::Option::is_none")]
pub request_state: ::std::option::Option<::std::string::String>,
}
///The result returned by the server for a {@link GetPromptRequestprompts/get} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The result returned by the server for a {@link GetPromptRequestprompts/get} request.",
/// "type": "object",
/// "required": [
/// "messages",
/// "resultType"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "description": {
/// "description": "An optional description for the prompt.",
/// "type": "string"
/// },
/// "messages": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/PromptMessage"
/// }
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </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>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
}
///A successful response from the server for a {@link GetPromptRequestprompts/get} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A successful response from the server for a {@link GetPromptRequestprompts/get} request.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "result"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "result": {
/// "anyOf": [
/// {
/// "$ref": "#/$defs/InputRequiredResult"
/// },
/// {
/// "$ref": "#/$defs/GetPromptResult"
/// }
/// ]
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct GetPromptResultResponse {
pub id: RequestId,
#[serde(deserialize_with = "validate::get_prompt_result_response_jsonrpc")]
jsonrpc: ::std::string::String,
pub result: GetPromptResultResponseResult,
}
impl GetPromptResultResponse {
pub fn new(id: RequestId, result: GetPromptResultResponseResult) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
result,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///GetPromptResultResponseResult
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/InputRequiredResult"
/// },
/// {
/// "$ref": "#/$defs/GetPromptResult"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum GetPromptResultResponseResult {
InputRequiredResult(InputRequiredResult),
GetPromptResult(GetPromptResult),
}
impl ::std::convert::From<InputRequiredResult> for GetPromptResultResponseResult {
fn from(value: InputRequiredResult) -> Self {
Self::InputRequiredResult(value)
}
}
impl ::std::convert::From<GetPromptResult> for GetPromptResultResponseResult {
fn from(value: GetPromptResult) -> Self {
Self::GetPromptResult(value)
}
}
/**Returned when a server rejects a request because the values in the HTTP
headers do not match the corresponding values in the request body, or
because required headers are missing or malformed. For HTTP, the response
status code MUST be 400 Bad Request.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Returned when a server rejects a request because the values in the HTTP\nheaders do not match the corresponding values in the request body, or\nbecause required headers are missing or malformed. For HTTP, the response\nstatus code MUST be 400 Bad Request.",
/// "type": "object",
/// "required": [
/// "error",
/// "jsonrpc"
/// ],
/// "properties": {
/// "error": {
/// "allOf": [
/// {
/// "$ref": "#/$defs/Error"
/// },
/// {
/// "type": "object",
/// "required": [
/// "code"
/// ],
/// "properties": {
/// "code": {
/// "type": "integer"
/// }
/// }
/// }
/// ]
/// },
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct HeaderMismatchError {
pub error: RpcError,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub id: ::std::option::Option<RequestId>,
#[serde(deserialize_with = "validate::header_mismatch_error_jsonrpc")]
jsonrpc: ::std::string::String,
}
impl HeaderMismatchError {
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
}
}
///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 take 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 take 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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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<MetaObject>,
) -> 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 {@link Tool},\nwhere annotations.title should be given precedence over using name,\nif present).",
/// "type": "string"
/// },
/// "version": {
/// "description": "The version of this implementation.",
/// "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, Default)]
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 {@link 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 version of this implementation.
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". The values "thisServer" and "allServers" are deprecated (SEP-2596): servers SHOULD
omit this field or use "none", and SHOULD only use the deprecated values if the client declares
{@link ClientCapabilities.sampling.context}.*/
///
/// <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\". The values \"thisServer\" and \"allServers\" are deprecated (SEP-2596): servers SHOULD\nomit this field or use \"none\", and SHOULD only use the deprecated values if the client declares\n{@link ClientCapabilities.sampling.context}.",
/// "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"),
}
}
}
///InputRequest
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/CreateMessageRequest"
/// },
/// {
/// "$ref": "#/$defs/ListRootsRequest"
/// },
/// {
/// "$ref": "#/$defs/ElicitRequest"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum InputRequest {
CreateMessageRequest(CreateMessageRequest),
ListRootsRequest(ListRootsRequest),
ElicitRequest(ElicitRequest),
}
impl ::std::convert::From<CreateMessageRequest> for InputRequest {
fn from(value: CreateMessageRequest) -> Self {
Self::CreateMessageRequest(value)
}
}
impl ::std::convert::From<ListRootsRequest> for InputRequest {
fn from(value: ListRootsRequest) -> Self {
Self::ListRootsRequest(value)
}
}
impl ::std::convert::From<ElicitRequest> for InputRequest {
fn from(value: ElicitRequest) -> Self {
Self::ElicitRequest(value)
}
}
/**A map of server-initiated requests that the client must fulfill.
Keys are server-assigned identifiers; values are the request objects.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A map of server-initiated requests that the client must fulfill.\nKeys are server-assigned identifiers; values are the request objects.",
/// "type": "object",
/// "additionalProperties": {
/// "$ref": "#/$defs/InputRequest"
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct InputRequests(pub std::collections::BTreeMap<::std::string::String, InputRequest>);
/**An InputRequiredResult sent by the server to indicate that additional input is needed
before the request can be completed.
At least one of inputRequests or requestState MUST be present.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "An InputRequiredResult sent by the server to indicate that additional input is needed\nbefore the request can be completed.\n\nAt least one of inputRequests or requestState MUST be present.",
/// "type": "object",
/// "required": [
/// "resultType"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "inputRequests": {
/// "$ref": "#/$defs/InputRequests"
/// },
/// "requestState": {
/// "type": "string"
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct InputRequiredResult {
#[serde(rename = "inputRequests", default, skip_serializing_if = "::std::option::Option::is_none")]
pub input_requests: ::std::option::Option<InputRequests>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
#[serde(rename = "requestState", default, skip_serializing_if = "::std::option::Option::is_none")]
pub request_state: ::std::option::Option<::std::string::String>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
}
///InputResponse
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/CreateMessageResult"
/// },
/// {
/// "$ref": "#/$defs/ListRootsResult"
/// },
/// {
/// "$ref": "#/$defs/ElicitResult"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum InputResponse {
CreateMessageResult(CreateMessageResult),
ListRootsResult(ListRootsResult),
ElicitResult(ElicitResult),
}
impl ::std::convert::From<CreateMessageResult> for InputResponse {
fn from(value: CreateMessageResult) -> Self {
Self::CreateMessageResult(value)
}
}
impl ::std::convert::From<ListRootsResult> for InputResponse {
fn from(value: ListRootsResult) -> Self {
Self::ListRootsResult(value)
}
}
impl ::std::convert::From<ElicitResult> for InputResponse {
fn from(value: ElicitResult) -> Self {
Self::ElicitResult(value)
}
}
///InputResponseRequestParams
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "_meta"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/RequestMetaObject"
/// },
/// "inputResponses": {
/// "$ref": "#/$defs/InputResponses"
/// },
/// "requestState": {
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct InputResponseRequestParams {
#[serde(rename = "inputResponses", default, skip_serializing_if = "::std::option::Option::is_none")]
pub input_responses: ::std::option::Option<InputResponses>,
#[serde(rename = "_meta")]
pub meta: RequestMetaObject,
#[serde(rename = "requestState", default, skip_serializing_if = "::std::option::Option::is_none")]
pub request_state: ::std::option::Option<::std::string::String>,
}
/**A map of client responses to server-initiated requests.
Keys correspond to the keys in the {@link InputRequests} map;
values are the client's result for each request.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A map of client responses to server-initiated requests.\nKeys correspond to the keys in the {@link InputRequests} map;\nvalues are the client's result for each request.",
/// "type": "object",
/// "additionalProperties": {
/// "$ref": "#/$defs/InputResponse"
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct InputResponses(pub std::collections::BTreeMap<::std::string::String, InputResponse>);
///A JSON-RPC error indicating that an internal error occurred on the receiver. This error is returned when the receiver encounters an unexpected condition that prevents it from fulfilling the request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A JSON-RPC error indicating that an internal error occurred on the receiver. This error is returned when the receiver encounters an unexpected condition that prevents it from fulfilling the request.",
/// "type": "object",
/// "required": [
/// "code",
/// "message"
/// ],
/// "properties": {
/// "code": {
/// "description": "The error type that occurred.",
/// "type": "integer",
/// "const": -32603
/// },
/// "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 InternalError {
///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,
}
/**A JSON-RPC error indicating that the method parameters are invalid or malformed.
In MCP, this error is returned in various contexts when request parameters fail validation:
- **Tools**: Unknown tool name or invalid tool arguments
- **Prompts**: Unknown prompt name or missing required arguments
- **Pagination**: Invalid or expired cursor values
- **Logging**: Invalid log level
- **Elicitation**: Server requests an elicitation mode not declared in client capabilities
- **Sampling**: Missing tool result or tool results mixed with other content*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A JSON-RPC error indicating that the method parameters are invalid or malformed.\n\nIn MCP, this error is returned in various contexts when request parameters fail validation:\n\n- **Tools**: Unknown tool name or invalid tool arguments\n- **Prompts**: Unknown prompt name or missing required arguments\n- **Pagination**: Invalid or expired cursor values\n- **Logging**: Invalid log level\n- **Elicitation**: Server requests an elicitation mode not declared in client capabilities\n- **Sampling**: Missing tool result or tool results mixed with other content",
/// "type": "object",
/// "required": [
/// "code",
/// "message"
/// ],
/// "properties": {
/// "code": {
/// "description": "The error type that occurred.",
/// "type": "integer",
/// "const": -32602
/// },
/// "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 InvalidParamsError {
///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,
}
///A JSON-RPC error indicating that the request is not a valid request object. This error is returned when the message structure does not conform to the JSON-RPC 2.0 specification requirements for a request (e.g., missing required fields like jsonrpc or method, or using invalid types for these fields).
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A JSON-RPC error indicating that the request is not a valid request object. This error is returned when the message structure does not conform to the JSON-RPC 2.0 specification requirements for a request (e.g., missing required fields like jsonrpc or method, or using invalid types for these fields).",
/// "type": "object",
/// "required": [
/// "code",
/// "message"
/// ],
/// "properties": {
/// "code": {
/// "description": "The error type that occurred.",
/// "type": "integer",
/// "const": -32600
/// },
/// "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 InvalidRequestError {
///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,
}
///JsonArray
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/JSONValue"
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct JsonArray(pub ::std::vec::Vec<JsonValue>);
///JsonObject
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "additionalProperties": {
/// "$ref": "#/$defs/JSONValue"
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct JsonObject(pub std::collections::BTreeMap<::std::string::String, JsonValue>);
///JsonValue
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/JSONObject"
/// },
/// {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/JSONValue"
/// }
/// },
/// {
/// "type": [
/// "string",
/// "integer",
/// "boolean"
/// ]
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum JsonValue {
Variant0(JsonObject),
Variant1(::std::vec::Vec<JsonValue>),
Variant2(JsonValueVariant2),
}
impl ::std::convert::From<JsonObject> for JsonValue {
fn from(value: JsonObject) -> Self {
Self::Variant0(value)
}
}
impl ::std::convert::From<::std::vec::Vec<JsonValue>> for JsonValue {
fn from(value: ::std::vec::Vec<JsonValue>) -> Self {
Self::Variant1(value)
}
}
impl ::std::convert::From<JsonValueVariant2> for JsonValue {
fn from(value: JsonValueVariant2) -> Self {
Self::Variant2(value)
}
}
///JsonValueVariant2
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": [
/// "string",
/// "integer",
/// "boolean"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum JsonValueVariant2 {
Boolean(bool),
String(::std::string::String),
Integer(i64),
}
impl ::std::convert::From<bool> for JsonValueVariant2 {
fn from(value: bool) -> Self {
Self::Boolean(value)
}
}
impl ::std::convert::From<i64> for JsonValueVariant2 {
fn from(value: i64) -> Self {
Self::Integer(value)
}
}
///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 {@link TitledSingleSelectEnumSchema} instead.
This interface will be removed in a future version.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Use {@link 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",
/// "params"
/// ],
/// "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,
pub params: PaginatedRequestParams,
}
impl ListPromptsRequest {
pub fn new(id: RequestId, params: 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 result returned by the server for a {@link ListPromptsRequestprompts/list} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The result returned by the server for a {@link ListPromptsRequestprompts/list} request.",
/// "type": "object",
/// "required": [
/// "cacheScope",
/// "prompts",
/// "resultType",
/// "ttlMs"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "cacheScope": {
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
/// },
/// "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"
/// }
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// },
/// "ttlMs": {
/// "description": "A hint from the server indicating how long (in milliseconds) the\nclient MAY cache this response before re-fetching. Semantics are\nanalogous to HTTP Cache-Control max-age.\n\n- If 0, The response SHOULD be considered immediately stale,\n The client MAY re-fetch every time the result is needed.\n- If positive, the client SHOULD consider the result fresh for this many\n milliseconds after receiving the response.",
/// "type": "integer",
/// "minimum": 0.0
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListPromptsResult {
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
#[serde(rename = "cacheScope")]
pub cache_scope: ListPromptsResultCacheScope,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
/**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>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
/**A hint from the server indicating how long (in milliseconds) the
client MAY cache this response before re-fetching. Semantics are
analogous to HTTP Cache-Control max-age.
- If 0, The response SHOULD be considered immediately stale,
The client MAY re-fetch every time the result is needed.
- If positive, the client SHOULD consider the result fresh for this many
milliseconds after receiving the response.*/
#[serde(rename = "ttlMs")]
pub ttl_ms: u64,
}
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ListPromptsResultCacheScope {
#[serde(rename = "private")]
Private,
#[serde(rename = "public")]
Public,
}
impl ::std::fmt::Display for ListPromptsResultCacheScope {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Private => write!(f, "private"),
Self::Public => write!(f, "public"),
}
}
}
///A successful response from the server for a {@link ListPromptsRequestprompts/list} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A successful response from the server for a {@link ListPromptsRequestprompts/list} request.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "result"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "result": {
/// "$ref": "#/$defs/ListPromptsResult"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListPromptsResultResponse {
pub id: RequestId,
#[serde(deserialize_with = "validate::list_prompts_result_response_jsonrpc")]
jsonrpc: ::std::string::String,
pub result: ListPromptsResult,
}
impl ListPromptsResultResponse {
pub fn new(id: RequestId, result: ListPromptsResult) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
result,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///Sent from the client to request a list of 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",
/// "params"
/// ],
/// "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,
pub params: PaginatedRequestParams,
}
impl ListResourceTemplatesRequest {
pub fn new(id: RequestId, params: 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 result returned by the server for a {@link ListResourceTemplatesRequestresources/templates/list} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The result returned by the server for a {@link ListResourceTemplatesRequestresources/templates/list} request.",
/// "type": "object",
/// "required": [
/// "cacheScope",
/// "resourceTemplates",
/// "resultType",
/// "ttlMs"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "cacheScope": {
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
/// },
/// "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"
/// }
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// },
/// "ttlMs": {
/// "description": "A hint from the server indicating how long (in milliseconds) the\nclient MAY cache this response before re-fetching. Semantics are\nanalogous to HTTP Cache-Control max-age.\n\n- If 0, The response SHOULD be considered immediately stale,\n The client MAY re-fetch every time the result is needed.\n- If positive, the client SHOULD consider the result fresh for this many\n milliseconds after receiving the response.",
/// "type": "integer",
/// "minimum": 0.0
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListResourceTemplatesResult {
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
#[serde(rename = "cacheScope")]
pub cache_scope: ListResourceTemplatesResultCacheScope,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
/**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>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
/**A hint from the server indicating how long (in milliseconds) the
client MAY cache this response before re-fetching. Semantics are
analogous to HTTP Cache-Control max-age.
- If 0, The response SHOULD be considered immediately stale,
The client MAY re-fetch every time the result is needed.
- If positive, the client SHOULD consider the result fresh for this many
milliseconds after receiving the response.*/
#[serde(rename = "ttlMs")]
pub ttl_ms: u64,
}
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ListResourceTemplatesResultCacheScope {
#[serde(rename = "private")]
Private,
#[serde(rename = "public")]
Public,
}
impl ::std::fmt::Display for ListResourceTemplatesResultCacheScope {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Private => write!(f, "private"),
Self::Public => write!(f, "public"),
}
}
}
///A successful response from the server for a {@link ListResourceTemplatesRequestresources/templates/list} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A successful response from the server for a {@link ListResourceTemplatesRequestresources/templates/list} request.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "result"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "result": {
/// "$ref": "#/$defs/ListResourceTemplatesResult"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListResourceTemplatesResultResponse {
pub id: RequestId,
#[serde(deserialize_with = "validate::list_resource_templates_result_response_jsonrpc")]
jsonrpc: ::std::string::String,
pub result: ListResourceTemplatesResult,
}
impl ListResourceTemplatesResultResponse {
pub fn new(id: RequestId, result: ListResourceTemplatesResult) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
result,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///Sent from the client to request a list of 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",
/// "params"
/// ],
/// "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,
pub params: PaginatedRequestParams,
}
impl ListResourcesRequest {
pub fn new(id: RequestId, params: 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 result returned by the server for a {@link ListResourcesRequestresources/list} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The result returned by the server for a {@link ListResourcesRequestresources/list} request.",
/// "type": "object",
/// "required": [
/// "cacheScope",
/// "resources",
/// "resultType",
/// "ttlMs"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "cacheScope": {
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
/// },
/// "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"
/// }
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// },
/// "ttlMs": {
/// "description": "A hint from the server indicating how long (in milliseconds) the\nclient MAY cache this response before re-fetching. Semantics are\nanalogous to HTTP Cache-Control max-age.\n\n- If 0, The response SHOULD be considered immediately stale,\n The client MAY re-fetch every time the result is needed.\n- If positive, the client SHOULD consider the result fresh for this many\n milliseconds after receiving the response.",
/// "type": "integer",
/// "minimum": 0.0
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListResourcesResult {
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
#[serde(rename = "cacheScope")]
pub cache_scope: ListResourcesResultCacheScope,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
/**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>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
/**A hint from the server indicating how long (in milliseconds) the
client MAY cache this response before re-fetching. Semantics are
analogous to HTTP Cache-Control max-age.
- If 0, The response SHOULD be considered immediately stale,
The client MAY re-fetch every time the result is needed.
- If positive, the client SHOULD consider the result fresh for this many
milliseconds after receiving the response.*/
#[serde(rename = "ttlMs")]
pub ttl_ms: u64,
}
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ListResourcesResultCacheScope {
#[serde(rename = "private")]
Private,
#[serde(rename = "public")]
Public,
}
impl ::std::fmt::Display for ListResourcesResultCacheScope {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Private => write!(f, "private"),
Self::Public => write!(f, "public"),
}
}
}
///A successful response from the server for a {@link ListResourcesRequestresources/list} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A successful response from the server for a {@link ListResourcesRequestresources/list} request.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "result"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "result": {
/// "$ref": "#/$defs/ListResourcesResult"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListResourcesResultResponse {
pub id: RequestId,
#[serde(deserialize_with = "validate::list_resources_result_response_jsonrpc")]
jsonrpc: ::std::string::String,
pub result: ListResourcesResult,
}
impl ListResourcesResultResponse {
pub fn new(id: RequestId, result: ListResourcesResult) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
result,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
/**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": [
/// "method"
/// ],
/// "properties": {
/// "method": {
/// "type": "string",
/// "const": "roots/list"
/// },
/// "params": {
/// "type": "object",
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/MetaObject"
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListRootsRequest {
#[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<ListRootsRequestParams>,
}
impl ListRootsRequest {
pub fn new(params: ::std::option::Option<ListRootsRequestParams>) -> Self {
Self {
method: "roots/list".to_string(),
params,
}
}
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"
}
}
///ListRootsRequestParams
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/MetaObject"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ListRootsRequestParams {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
}
/**The result returned by the client for a {@link ListRootsRequestroots/list} request.
This result contains an array of {@link Root} objects, each representing a root directory
or file that the server can operate on.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The result returned by the client for a {@link ListRootsRequestroots/list} request.\nThis result contains an array of {@link Root} objects, each representing a root directory\nor file that the server can operate on.",
/// "type": "object",
/// "required": [
/// "roots"
/// ],
/// "properties": {
/// "roots": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Root"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListRootsResult {
pub roots: ::std::vec::Vec<Root>,
}
///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",
/// "params"
/// ],
/// "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,
pub params: PaginatedRequestParams,
}
impl ListToolsRequest {
pub fn new(id: RequestId, params: 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 result returned by the server for a {@link ListToolsRequesttools/list} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The result returned by the server for a {@link ListToolsRequesttools/list} request.",
/// "type": "object",
/// "required": [
/// "cacheScope",
/// "resultType",
/// "tools",
/// "ttlMs"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "cacheScope": {
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
/// },
/// "nextCursor": {
/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
/// "type": "string"
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// },
/// "tools": {
/// "type": "array",
/// "items": {
/// "$ref": "#/$defs/Tool"
/// }
/// },
/// "ttlMs": {
/// "description": "A hint from the server indicating how long (in milliseconds) the\nclient MAY cache this response before re-fetching. Semantics are\nanalogous to HTTP Cache-Control max-age.\n\n- If 0, The response SHOULD be considered immediately stale,\n The client MAY re-fetch every time the result is needed.\n- If positive, the client SHOULD consider the result fresh for this many\n milliseconds after receiving the response.",
/// "type": "integer",
/// "minimum": 0.0
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListToolsResult {
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
#[serde(rename = "cacheScope")]
pub cache_scope: ListToolsResultCacheScope,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
/**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>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
pub tools: ::std::vec::Vec<Tool>,
/**A hint from the server indicating how long (in milliseconds) the
client MAY cache this response before re-fetching. Semantics are
analogous to HTTP Cache-Control max-age.
- If 0, The response SHOULD be considered immediately stale,
The client MAY re-fetch every time the result is needed.
- If positive, the client SHOULD consider the result fresh for this many
milliseconds after receiving the response.*/
#[serde(rename = "ttlMs")]
pub ttl_ms: u64,
}
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ListToolsResultCacheScope {
#[serde(rename = "private")]
Private,
#[serde(rename = "public")]
Public,
}
impl ::std::fmt::Display for ListToolsResultCacheScope {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Private => write!(f, "private"),
Self::Public => write!(f, "public"),
}
}
}
///A successful response from the server for a {@link ListToolsRequesttools/list} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A successful response from the server for a {@link ListToolsRequesttools/list} request.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "result"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "result": {
/// "$ref": "#/$defs/ListToolsResult"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListToolsResultResponse {
pub id: RequestId,
#[serde(deserialize_with = "validate::list_tools_result_response_jsonrpc")]
jsonrpc: ::std::string::String,
pub result: ListToolsResult,
}
impl ListToolsResultResponse {
pub fn new(id: RequestId, result: ListToolsResult) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
result,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
/**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, Debug, Default)]
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")]
#[default]
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. The client opts in by setting "io.modelcontextprotocol/logLevel" in a request's _meta.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "JSONRPCNotification of a log message passed from server to client. The client opts in by setting \"io.modelcontextprotocol/logLevel\" in a request's _meta.",
/// "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": {
/// "$ref": "#/$defs/NotificationMetaObject"
/// },
/// "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, Default)]
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>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<NotificationMetaObject>,
}
/**Represents the contents of a _meta field, which clients and servers use to attach additional metadata to their interactions.
Certain key names are reserved by MCP for protocol-level metadata; implementations MUST NOT make assumptions about values at these keys. Additionally, specific schema definitions may reserve particular names for purpose-specific metadata, as declared in those definitions.
Valid keys have two segments:
**Prefix:**
- Optional — if specified, MUST be a series of _labels_ separated by dots (.), followed by a slash (/).
- Labels MUST start with a letter and end with a letter or digit. Interior characters may be letters, digits, or hyphens (-).
- Implementations SHOULD use reverse DNS notation (e.g., com.example/ rather than example.com/).
- Any prefix where the second label is modelcontextprotocol or mcp is **reserved** for MCP use. For example: io.modelcontextprotocol/, dev.mcp/, org.modelcontextprotocol.api/, and com.mcp.tools/ are all reserved. However, com.example.mcp/ is NOT reserved, as the second label is example.
**Name:**
- Unless empty, MUST start and end with an alphanumeric character ([a-z0-9A-Z]).
- Interior characters may be alphanumeric, hyphens (-), underscores (_), or dots (.).*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Represents the contents of a _meta field, which clients and servers use to attach additional metadata to their interactions.\n\nCertain key names are reserved by MCP for protocol-level metadata; implementations MUST NOT make assumptions about values at these keys. Additionally, specific schema definitions may reserve particular names for purpose-specific metadata, as declared in those definitions.\n\nValid keys have two segments:\n\n**Prefix:**\n- Optional — if specified, MUST be a series of _labels_ separated by dots (.), followed by a slash (/).\n- Labels MUST start with a letter and end with a letter or digit. Interior characters may be letters, digits, or hyphens (-).\n- Implementations SHOULD use reverse DNS notation (e.g., com.example/ rather than example.com/).\n- Any prefix where the second label is modelcontextprotocol or mcp is **reserved** for MCP use. For example: io.modelcontextprotocol/, dev.mcp/, org.modelcontextprotocol.api/, and com.mcp.tools/ are all reserved. However, com.example.mcp/ is NOT reserved, as the second label is example.\n\n**Name:**\n- Unless empty, MUST start and end with an alphanumeric character ([a-z0-9A-Z]).\n- Interior characters may be alphanumeric, hyphens (-), underscores (_), or dots (.).",
/// "type": "object",
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
#[serde(transparent)]
pub struct MetaObject(pub ::serde_json::Map<::std::string::String, ::serde_json::Value>);
/**A JSON-RPC error indicating that the requested method does not exist or is not available.
In MCP, a server returns this error when a client invokes a method the server does not implement — either a genuinely unknown method, or one gated behind a server capability the server did not advertise (e.g., calling prompts/list when the prompts capability was not advertised).
A request that requires a client capability the client did not declare is signalled instead by {@link MissingRequiredClientCapabilityError} (-32021).*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A JSON-RPC error indicating that the requested method does not exist or is not available.\n\nIn MCP, a server returns this error when a client invokes a method the server does not implement — either a genuinely unknown method, or one gated behind a server capability the server did not advertise (e.g., calling prompts/list when the prompts capability was not advertised).\n\nA request that requires a client capability the client did not declare is signalled instead by {@link MissingRequiredClientCapabilityError} (-32021).",
/// "type": "object",
/// "required": [
/// "code",
/// "message"
/// ],
/// "properties": {
/// "code": {
/// "description": "The error type that occurred.",
/// "type": "integer",
/// "const": -32601
/// },
/// "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 MethodNotFoundError {
///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,
}
/**Returned when processing a request requires a capability the client did not
declare in clientCapabilities. For HTTP, the response status code MUST be
400 Bad Request.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Returned when processing a request requires a capability the client did not\ndeclare in clientCapabilities. For HTTP, the response status code MUST be\n400 Bad 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": [
/// "requiredCapabilities"
/// ],
/// "properties": {
/// "requiredCapabilities": {
/// "description": "The capabilities the server requires from the client to process this request.",
/// "$ref": "#/$defs/ClientCapabilities"
/// }
/// }
/// }
/// }
/// }
/// ]
/// },
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct MissingRequiredClientCapabilityError {
pub error: MissingRequiredClientCapabilityErrorError,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub id: ::std::option::Option<RequestId>,
#[serde(deserialize_with = "validate::missing_required_client_capability_error_jsonrpc")]
jsonrpc: ::std::string::String,
}
impl MissingRequiredClientCapabilityError {
pub fn new(error: MissingRequiredClientCapabilityErrorError, id: ::std::option::Option<RequestId>) -> Self {
Self {
error,
id,
jsonrpc: JSONRPC_VERSION.to_string(),
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///MissingRequiredClientCapabilityErrorError
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "allOf": [
/// {
/// "$ref": "#/$defs/Error"
/// },
/// {
/// "type": "object",
/// "required": [
/// "code",
/// "data"
/// ],
/// "properties": {
/// "code": {
/// "type": "integer"
/// },
/// "data": {
/// "type": "object",
/// "required": [
/// "requiredCapabilities"
/// ],
/// "properties": {
/// "requiredCapabilities": {
/// "description": "The capabilities the server requires from the client to process this request.",
/// "$ref": "#/$defs/ClientCapabilities"
/// }
/// }
/// }
/// }
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct MissingRequiredClientCapabilityErrorError {
pub code: i64,
pub data: MissingRequiredClientCapabilityErrorErrorData,
///A short description of the error. The message SHOULD be limited to a concise single sentence.
pub message: ::std::string::String,
}
///MissingRequiredClientCapabilityErrorErrorData
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "requiredCapabilities"
/// ],
/// "properties": {
/// "requiredCapabilities": {
/// "description": "The capabilities the server requires from the client to process this request.",
/// "$ref": "#/$defs/ClientCapabilities"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct MissingRequiredClientCapabilityErrorErrorData {
///The capabilities the server requires from the client to process this request.
#[serde(rename = "requiredCapabilities")]
pub required_capabilities: ClientCapabilities,
}
/**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>>,
}
///Extends {@link MetaObject} with additional notification-specific fields. All key naming rules from MetaObject apply.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Extends {@link MetaObject} with additional notification-specific fields. All key naming rules from MetaObject apply.",
/// "type": "object",
/// "properties": {
/// "io.modelcontextprotocol/subscriptionId": {
/// "description": "Identifies the subscription stream a notification was delivered on. The\nserver MUST include this key on every notification delivered via a\n{@link SubscriptionsListenRequestsubscriptions/listen} stream, so the\nclient can correlate the notification with the originating subscription.\nThe key is absent on notifications not delivered via a subscription\nstream (e.g. progress notifications for an in-flight request), which is\nwhy it is optional here.\n\nThe value is the JSON-RPC ID of the subscriptions/listen request that\nopened the stream.",
/// "$ref": "#/$defs/RequestId"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct NotificationMetaObject {
/**Identifies the subscription stream a notification was delivered on. The
server MUST include this key on every notification delivered via a
{@link SubscriptionsListenRequestsubscriptions/listen} stream, so the
client can correlate the notification with the originating subscription.
The key is absent on notifications not delivered via a subscription
stream (e.g. progress notifications for an in-flight request), which is
why it is optional here.
The value is the JSON-RPC ID of the subscriptions/listen request that
opened the stream.*/
#[serde(
rename = "io.modelcontextprotocol/subscriptionId",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub io_modelcontextprotocol_subscription_id: ::std::option::Option<RequestId>,
#[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 notification.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Common params for any notification.",
/// "type": "object",
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/NotificationMetaObject"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct NotificationParams {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<NotificationMetaObject>,
}
///NumberSchema
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "default": {
/// "type": "number"
/// },
/// "description": {
/// "type": "string"
/// },
/// "maximum": {
/// "type": "number"
/// },
/// "minimum": {
/// "type": "number"
/// },
/// "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<f64>,
#[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<f64>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub minimum: ::std::option::Option<f64>,
#[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"),
}
}
}
///PaginatedRequest
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "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,
pub params: PaginatedRequestParams,
}
impl PaginatedRequest {
pub fn new(id: RequestId, method: ::std::string::String, params: PaginatedRequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method,
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///Common params for paginated requests.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Common params for paginated requests.",
/// "type": "object",
/// "required": [
/// "_meta"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/RequestMetaObject"
/// },
/// "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")]
pub meta: RequestMetaObject,
}
///PaginatedResult
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "resultType"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "nextCursor": {
/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
/// "type": "string"
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct PaginatedResult {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
/**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>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
}
///A JSON-RPC error indicating that invalid JSON was received by the server. This error is returned when the server cannot parse the JSON text of a message.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A JSON-RPC error indicating that invalid JSON was received by the server. This error is returned when the server cannot parse the JSON text of a message.",
/// "type": "object",
/// "required": [
/// "code",
/// "message"
/// ],
/// "properties": {
/// "code": {
/// "description": "The error type that occurred.",
/// "type": "integer",
/// "const": -32700
/// },
/// "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 ParseError {
///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,
}
/**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 {@link ProgressNotificationnotifications/progress} notification.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a {@link ProgressNotificationnotifications/progress} notification.",
/// "type": "object",
/// "required": [
/// "progress",
/// "progressToken"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/NotificationMetaObject"
/// },
/// "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, Default)]
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>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<NotificationMetaObject>,
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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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 {@link 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>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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 {@link 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 {@link 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 {@link 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 is only delivered on a {@link SubscriptionsListenRequestsubscriptions/listen} stream when the client requested it via the promptsListChanged filter field.
///
/// <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 is only delivered on a {@link SubscriptionsListenRequestsubscriptions/listen} stream when the client requested it via the promptsListChanged filter field.",
/// "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 {@link 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 {@link 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 {@link 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 {@link 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)
}
}
///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": [
/// "_meta",
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/RequestMetaObject"
/// },
/// "inputResponses": {
/// "$ref": "#/$defs/InputResponses"
/// },
/// "requestState": {
/// "type": "string"
/// },
/// "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 = "inputResponses", default, skip_serializing_if = "::std::option::Option::is_none")]
pub input_responses: ::std::option::Option<InputResponses>,
#[serde(rename = "_meta")]
pub meta: RequestMetaObject,
#[serde(rename = "requestState", default, skip_serializing_if = "::std::option::Option::is_none")]
pub request_state: ::std::option::Option<::std::string::String>,
///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 result returned by the server for a {@link ReadResourceRequestresources/read} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The result returned by the server for a {@link ReadResourceRequestresources/read} request.",
/// "type": "object",
/// "required": [
/// "cacheScope",
/// "contents",
/// "resultType",
/// "ttlMs"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "cacheScope": {
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
/// },
/// "contents": {
/// "type": "array",
/// "items": {
/// "anyOf": [
/// {
/// "$ref": "#/$defs/TextResourceContents"
/// },
/// {
/// "$ref": "#/$defs/BlobResourceContents"
/// }
/// ]
/// }
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// },
/// "ttlMs": {
/// "description": "A hint from the server indicating how long (in milliseconds) the\nclient MAY cache this response before re-fetching. Semantics are\nanalogous to HTTP Cache-Control max-age.\n\n- If 0, The response SHOULD be considered immediately stale,\n The client MAY re-fetch every time the result is needed.\n- If positive, the client SHOULD consider the result fresh for this many\n milliseconds after receiving the response.",
/// "type": "integer",
/// "minimum": 0.0
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ReadResourceResult {
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
#[serde(rename = "cacheScope")]
pub cache_scope: ReadResourceResultCacheScope,
pub contents: ::std::vec::Vec<ReadResourceContent>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
/**A hint from the server indicating how long (in milliseconds) the
client MAY cache this response before re-fetching. Semantics are
analogous to HTTP Cache-Control max-age.
- If 0, The response SHOULD be considered immediately stale,
The client MAY re-fetch every time the result is needed.
- If positive, the client SHOULD consider the result fresh for this many
milliseconds after receiving the response.*/
#[serde(rename = "ttlMs")]
pub ttl_ms: u64,
}
/**Indicates the intended scope of the cached response, analogous to HTTP
Cache-Control: public vs Cache-Control: private.
- "public": The response does not contain user-specific data. Any
client or intermediary (e.g., shared gateway, caching proxy) MAY cache
the response and serve it across authorization contexts.
- "private": The response MAY be cached and reused only within the
same authorization context. Caches MUST NOT be shared across
authorization contexts (e.g., a different access token requires a
different cache).*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Indicates the intended scope of the cached response, analogous to HTTP\nCache-Control: public vs Cache-Control: private.\n\n- \"public\": The response does not contain user-specific data. Any\n client or intermediary (e.g., shared gateway, caching proxy) MAY cache\n the response and serve it across authorization contexts.\n- \"private\": The response MAY be cached and reused only within the\n same authorization context. Caches MUST NOT be shared across\n authorization contexts (e.g., a different access token requires a\n different cache).",
/// "type": "string",
/// "enum": [
/// "private",
/// "public"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ReadResourceResultCacheScope {
#[serde(rename = "private")]
Private,
#[serde(rename = "public")]
Public,
}
impl ::std::fmt::Display for ReadResourceResultCacheScope {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Private => write!(f, "private"),
Self::Public => write!(f, "public"),
}
}
}
///A successful response from the server for a {@link ReadResourceRequestresources/read} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A successful response from the server for a {@link ReadResourceRequestresources/read} request.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "result"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "result": {
/// "anyOf": [
/// {
/// "$ref": "#/$defs/InputRequiredResult"
/// },
/// {
/// "$ref": "#/$defs/ReadResourceResult"
/// }
/// ]
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ReadResourceResultResponse {
pub id: RequestId,
#[serde(deserialize_with = "validate::read_resource_result_response_jsonrpc")]
jsonrpc: ::std::string::String,
pub result: ReadResourceResultResponseResult,
}
impl ReadResourceResultResponse {
pub fn new(id: RequestId, result: ReadResourceResultResponseResult) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
result,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///ReadResourceResultResponseResult
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/InputRequiredResult"
/// },
/// {
/// "$ref": "#/$defs/ReadResourceResult"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ReadResourceResultResponseResult {
InputRequiredResult(InputRequiredResult),
ReadResourceResult(ReadResourceResult),
}
impl ::std::convert::From<InputRequiredResult> for ReadResourceResultResponseResult {
fn from(value: InputRequiredResult) -> Self {
Self::InputRequiredResult(value)
}
}
impl ::std::convert::From<ReadResourceResult> for ReadResourceResultResponseResult {
fn from(value: ReadResourceResult) -> Self {
Self::ReadResourceResult(value)
}
}
///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)
}
}
///Extends {@link MetaObject} with additional request-specific fields. All key naming rules from MetaObject apply.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Extends {@link MetaObject} with additional request-specific fields. All key naming rules from MetaObject apply.",
/// "type": "object",
/// "required": [
/// "io.modelcontextprotocol/clientCapabilities",
/// "io.modelcontextprotocol/protocolVersion"
/// ],
/// "properties": {
/// "io.modelcontextprotocol/clientCapabilities": {
/// "description": "The client's capabilities for this specific request. Required.\n\nCapabilities are declared per-request rather than once at initialization;\nan empty object means the client supports no optional capabilities.\nServers MUST NOT infer capabilities from prior requests.",
/// "$ref": "#/$defs/ClientCapabilities"
/// },
/// "io.modelcontextprotocol/clientInfo": {
/// "description": "Identifies the client software making the request. Clients SHOULD\ninclude this field on every request unless specifically configured not\nto do so.\n\nThe {@link Implementation} schema requires name and version; other\nfields are optional.\n\nThe value is self-reported by the client and is not verified by the\nprotocol. It is intended for display, logging, and debugging. Servers\nSHOULD NOT use it to change their behavior, and SHOULD NOT rely on it for\nsecurity decisions.",
/// "$ref": "#/$defs/Implementation"
/// },
/// "io.modelcontextprotocol/logLevel": {
/// "description": "The desired log level for this request. Optional.\n\nIf absent, the server MUST NOT send any {@link LoggingMessageNotificationnotifications/message}\nnotifications for this request. The client opts in to log messages by\nexplicitly setting a level. Replaces the former logging/setLevel RPC.",
/// "$ref": "#/$defs/LoggingLevel"
/// },
/// "io.modelcontextprotocol/protocolVersion": {
/// "description": "The MCP Protocol Version being used for this request. Required.\n\nFor the HTTP transport, this value MUST match the MCP-Protocol-Version\nheader; otherwise the server MUST return a 400 Bad Request. If the\nserver does not support the requested version, it MUST return an\n{@link UnsupportedProtocolVersionError}.",
/// "type": "string"
/// },
/// "progressToken": {
/// "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by {@link ProgressNotificationnotifications/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 RequestMetaObject {
/**The client's capabilities for this specific request. Required.
Capabilities are declared per-request rather than once at initialization;
an empty object means the client supports no optional capabilities.
Servers MUST NOT infer capabilities from prior requests.*/
#[serde(rename = "io.modelcontextprotocol/clientCapabilities")]
pub client_capabilities: ClientCapabilities,
/**Identifies the client software making the request. Clients SHOULD
include this field on every request unless specifically configured not
to do so.
The {@link Implementation} schema requires name and version; other
fields are optional.
The value is self-reported by the client and is not verified by the
protocol. It is intended for display, logging, and debugging. Servers
SHOULD NOT use it to change their behavior, and SHOULD NOT rely on it for
security decisions.*/
#[serde(
rename = "io.modelcontextprotocol/clientInfo",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub client_info: ::std::option::Option<Implementation>,
/**The desired log level for this request. Optional.
If absent, the server MUST NOT send any {@link LoggingMessageNotificationnotifications/message}
notifications for this request. The client opts in to log messages by
explicitly setting a level. Replaces the former logging/setLevel RPC.*/
#[serde(
rename = "io.modelcontextprotocol/logLevel",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub log_level: ::std::option::Option<LoggingLevel>,
/**The MCP Protocol Version being used for this request. Required.
For the HTTP transport, this value MUST match the MCP-Protocol-Version
header; otherwise the server MUST return a 400 Bad Request. If the
server does not support the requested version, it MUST return an
{@link UnsupportedProtocolVersionError}.*/
#[serde(rename = "io.modelcontextprotocol/protocolVersion")]
pub protocol_version: ::std::string::String,
///If specified, the caller is requesting out-of-band progress notifications for this request (as represented by {@link ProgressNotificationnotifications/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 request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Common params for any request.",
/// "type": "object",
/// "required": [
/// "_meta"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/RequestMetaObject"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct RequestParams {
#[serde(rename = "_meta")]
pub meta: RequestMetaObject,
}
///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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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 {@link 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>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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 {@link 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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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 {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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 {@link ListResourcesRequestresources/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 {@link ListResourcesRequestresources/list} requests.",
/// "type": "object",
/// "required": [
/// "name",
/// "type",
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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 {@link 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>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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 {@link 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<MetaObject>,
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 is only delivered on a {@link SubscriptionsListenRequestsubscriptions/listen} stream when the client requested it via the resourcesListChanged filter field.
///
/// <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 is only delivered on a {@link SubscriptionsListenRequestsubscriptions/listen} stream when the client requested it via the resourcesListChanged filter field.",
/// "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"
}
}
///Common params for resource-related requests.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Common params for resource-related requests.",
/// "type": "object",
/// "required": [
/// "_meta",
/// "uri"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/RequestMetaObject"
/// },
/// "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")]
pub meta: RequestMetaObject,
///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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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 {@link 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>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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 {@link 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 is only sent for resources the client opted in to via the resourceSubscriptions field of a {@link SubscriptionsListenRequestsubscriptions/listen} 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 is only sent for resources the client opted in to via the resourceSubscriptions field of a {@link SubscriptionsListenRequestsubscriptions/listen} 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": {
/// "$ref": "#/$defs/NotificationMetaObject"
/// },
/// "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, Default)]
pub struct ResourceUpdatedNotificationParams {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<NotificationMetaObject>,
///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,
}
///Common result fields.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Common result fields.",
/// "type": "object",
/// "required": [
/// "resultType"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/ResultMetaObject"
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct Result {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<ResultMetaObject>,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
#[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>>,
}
///Extends {@link MetaObject} with additional result-specific fields. All key naming rules from MetaObject apply.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Extends {@link MetaObject} with additional result-specific fields. All key naming rules from MetaObject apply.",
/// "type": "object",
/// "properties": {
/// "io.modelcontextprotocol/serverInfo": {
/// "description": "Identifies the server software producing the response. Servers SHOULD\ninclude this field on every response unless specifically configured not\nto do so.\n\nThe {@link Implementation} schema requires name and version; other\nfields are optional.\n\nThe value is self-reported by the server and is not verified by the\nprotocol. It is intended for display, logging, and debugging. Clients\nSHOULD NOT use it to change their behavior, and SHOULD NOT rely on it for\nsecurity decisions.",
/// "$ref": "#/$defs/Implementation"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ResultMetaObject {
/**Identifies the server software producing the response. Servers SHOULD
include this field on every response unless specifically configured not
to do so.
The {@link Implementation} schema requires name and version; other
fields are optional.
The value is self-reported by the server and is not verified by the
protocol. It is intended for display, logging, and debugging. Clients
SHOULD NOT use it to change their behavior, and SHOULD NOT rely on it for
security decisions.*/
#[serde(
rename = "io.modelcontextprotocol/serverInfo",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub io_modelcontextprotocol_server_info: ::std::option::Option<Implementation>,
#[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>>,
}
/**Indicates the type of a {@link Result} object, allowing the client to
determine how to parse the response.
complete - the request completed successfully and the result contains the final content.
input_required - the request requires additional input and the result contains an {@link InputRequiredResult} object with instructions for the client to provide additional input before retrying the original request.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Indicates the type of a {@link Result} object, allowing the client to\ndetermine how to parse the response.\n\ncomplete - the request completed successfully and the result contains the final content.\ninput_required - the request requires additional input and the result contains an {@link InputRequiredResult} object with instructions for the client to provide additional input before retrying the original request.",
/// "type": "string"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResultType(pub ::std::string::String);
///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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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 {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
/**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,
}
///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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
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.",
/// "$ref": "#/$defs/JSONObject"
/// },
/// "experimental": {
/// "description": "Experimental, non-standard capabilities that the server supports.",
/// "type": "object",
/// "additionalProperties": {
/// "$ref": "#/$defs/JSONObject"
/// }
/// },
/// "extensions": {
/// "description": "Optional MCP extensions that the server supports. Keys are extension identifiers\n(e.g., \"io.modelcontextprotocol/tasks\"), and values are per-extension settings\nobjects. An empty object indicates support with no settings.\n\nKeys MUST follow the {@link MetaObject_meta key naming rules}, with a\nmandatory prefix.",
/// "type": "object",
/// "additionalProperties": {
/// "$ref": "#/$defs/JSONObject"
/// }
/// },
/// "logging": {
/// "description": "Present if the server supports sending log messages to the client.",
/// "$ref": "#/$defs/JSONObject"
/// },
/// "prompts": {
/// "description": "Present if the server offers any prompt templates.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether this server supports notifications for changes to the prompt list.",
/// "type": "boolean"
/// }
/// }
/// },
/// "resources": {
/// "description": "Present if the server offers any resources to read.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether this server supports notifications for changes to the resource list.",
/// "type": "boolean"
/// },
/// "subscribe": {
/// "description": "Whether this server supports subscribing to resource updates.",
/// "type": "boolean"
/// }
/// }
/// },
/// "tools": {
/// "description": "Present if the server offers any tools to call.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether this server supports notifications for changes to the tool list.",
/// "type": "boolean"
/// }
/// }
/// }
/// }
///}
/// ```
/// </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<JsonObject>,
///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, JsonObject>>,
/**Optional MCP extensions that the server supports. Keys are extension identifiers
(e.g., "io.modelcontextprotocol/tasks"), and values are per-extension settings
objects. An empty object indicates support with no settings.
Keys MUST follow the {@link MetaObject_meta key naming rules}, with a
mandatory prefix.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub extensions: ::std::option::Option<std::collections::BTreeMap<::std::string::String, JsonObject>>,
///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<JsonObject>,
#[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 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/SubscriptionsAcknowledgedNotification"
/// },
/// {
/// "$ref": "#/$defs/ResourceUpdatedNotification"
/// },
/// {
/// "$ref": "#/$defs/PromptListChangedNotification"
/// },
/// {
/// "$ref": "#/$defs/ToolListChangedNotification"
/// },
/// {
/// "$ref": "#/$defs/LoggingMessageNotification"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ServerNotification {
CancelledNotification(CancelledNotification),
ProgressNotification(ProgressNotification),
ResourceListChangedNotification(ResourceListChangedNotification),
SubscriptionsAcknowledgedNotification(SubscriptionsAcknowledgedNotification),
ResourceUpdatedNotification(ResourceUpdatedNotification),
PromptListChangedNotification(PromptListChangedNotification),
ToolListChangedNotification(ToolListChangedNotification),
LoggingMessageNotification(LoggingMessageNotification),
}
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<SubscriptionsAcknowledgedNotification> for ServerNotification {
fn from(value: SubscriptionsAcknowledgedNotification) -> Self {
Self::SubscriptionsAcknowledgedNotification(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<LoggingMessageNotification> for ServerNotification {
fn from(value: LoggingMessageNotification) -> Self {
Self::LoggingMessageNotification(value)
}
}
///ServerResult
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/$defs/Result"
/// },
/// {
/// "$ref": "#/$defs/InputRequiredResult"
/// },
/// {
/// "$ref": "#/$defs/DiscoverResult"
/// },
/// {
/// "$ref": "#/$defs/ListResourcesResult"
/// },
/// {
/// "$ref": "#/$defs/ListResourceTemplatesResult"
/// },
/// {
/// "$ref": "#/$defs/ReadResourceResult"
/// },
/// {
/// "$ref": "#/$defs/SubscriptionsListenResult"
/// },
/// {
/// "$ref": "#/$defs/ListPromptsResult"
/// },
/// {
/// "$ref": "#/$defs/GetPromptResult"
/// },
/// {
/// "$ref": "#/$defs/ListToolsResult"
/// },
/// {
/// "$ref": "#/$defs/CallToolResult"
/// },
/// {
/// "$ref": "#/$defs/CompleteResult"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
#[allow(clippy::large_enum_variant)]
pub enum ServerResult {
InputRequiredResult(InputRequiredResult),
DiscoverResult(DiscoverResult),
ListResourcesResult(ListResourcesResult),
ListResourceTemplatesResult(ListResourceTemplatesResult),
ReadResourceResult(ReadResourceResult),
SubscriptionsListenResult(SubscriptionsListenResult),
ListPromptsResult(ListPromptsResult),
GetPromptResult(GetPromptResult),
ListToolsResult(ListToolsResult),
CallToolResult(CallToolResult),
CompleteResult(CompleteResult),
Result(Result),
}
impl ::std::convert::From<InputRequiredResult> for ServerResult {
fn from(value: InputRequiredResult) -> Self {
Self::InputRequiredResult(value)
}
}
impl ::std::convert::From<DiscoverResult> for ServerResult {
fn from(value: DiscoverResult) -> Self {
Self::DiscoverResult(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<SubscriptionsListenResult> for ServerResult {
fn from(value: SubscriptionsListenResult) -> Self {
Self::SubscriptionsListenResult(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<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)
}
}
///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"),
}
}
}
/**The set of notification types a client may opt in to on a
{@link SubscriptionsListenRequestsubscriptions/listen} request.
Each notification type is **opt-in**; the server **MUST NOT** send
notification types the client has not explicitly requested here.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The set of notification types a client may opt in to on a\n{@link SubscriptionsListenRequestsubscriptions/listen} request.\n\nEach notification type is **opt-in**; the server **MUST NOT** send\nnotification types the client has not explicitly requested here.",
/// "type": "object",
/// "properties": {
/// "promptsListChanged": {
/// "description": "If true, receive {@link PromptListChangedNotificationnotifications/prompts/list_changed}.",
/// "type": "boolean"
/// },
/// "resourceSubscriptions": {
/// "description": "Subscribe to {@link ResourceUpdatedNotificationnotifications/resources/updated} for these resource URIs.\nReplaces the former resources/subscribe RPC.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "resourcesListChanged": {
/// "description": "If true, receive {@link ResourceListChangedNotificationnotifications/resources/list_changed}.",
/// "type": "boolean"
/// },
/// "toolsListChanged": {
/// "description": "If true, receive {@link ToolListChangedNotificationnotifications/tools/list_changed}.",
/// "type": "boolean"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct SubscriptionFilter {
///If true, receive {@link PromptListChangedNotificationnotifications/prompts/list_changed}.
#[serde(
rename = "promptsListChanged",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub prompts_list_changed: ::std::option::Option<bool>,
/**Subscribe to {@link ResourceUpdatedNotificationnotifications/resources/updated} for these resource URIs.
Replaces the former resources/subscribe RPC.*/
#[serde(
rename = "resourceSubscriptions",
default,
skip_serializing_if = "::std::vec::Vec::is_empty"
)]
pub resource_subscriptions: ::std::vec::Vec<::std::string::String>,
///If true, receive {@link ResourceListChangedNotificationnotifications/resources/list_changed}.
#[serde(
rename = "resourcesListChanged",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub resources_list_changed: ::std::option::Option<bool>,
///If true, receive {@link ToolListChangedNotificationnotifications/tools/list_changed}.
#[serde(
rename = "toolsListChanged",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub tools_list_changed: ::std::option::Option<bool>,
}
/**Sent by the server to acknowledge that a
{@link SubscriptionsListenRequestsubscriptions/listen} subscription has been
established and to report which notification types it agreed to honor.
This notification MUST be the first message the server sends carrying the
subscription's ID in io.modelcontextprotocol/subscriptionId. The server MUST
NOT send any notification on the subscription before acknowledging it. On
stdio, where every subscription shares one channel, this ordering is defined
per subscription ID and not per channel: messages belonging to other
subscriptions MAY be interleaved before it.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Sent by the server to acknowledge that a\n{@link SubscriptionsListenRequestsubscriptions/listen} subscription has been\nestablished and to report which notification types it agreed to honor.\n\nThis notification MUST be the first message the server sends carrying the\nsubscription's ID in io.modelcontextprotocol/subscriptionId. The server MUST\nNOT send any notification on the subscription before acknowledging it. On\nstdio, where every subscription shares one channel, this ordering is defined\nper subscription ID and not per channel: messages belonging to other\nsubscriptions MAY be interleaved before it.",
/// "type": "object",
/// "required": [
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "notifications/subscriptions/acknowledged"
/// },
/// "params": {
/// "$ref": "#/$defs/SubscriptionsAcknowledgedNotificationParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SubscriptionsAcknowledgedNotification {
#[serde(deserialize_with = "validate::subscriptions_acknowledged_notification_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::subscriptions_acknowledged_notification_method")]
method: ::std::string::String,
pub params: SubscriptionsAcknowledgedNotificationParams,
}
impl SubscriptionsAcknowledgedNotification {
pub fn new(params: SubscriptionsAcknowledgedNotificationParams) -> Self {
Self {
jsonrpc: JSONRPC_VERSION.to_string(),
method: "notifications/subscriptions/acknowledged".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/subscriptions/acknowledged"
pub fn method_value() -> &'static str {
"notifications/subscriptions/acknowledged"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/subscriptions/acknowledged"
}
}
///Parameters for a {@link SubscriptionsAcknowledgedNotificationnotifications/subscriptions/acknowledged} notification.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a {@link SubscriptionsAcknowledgedNotificationnotifications/subscriptions/acknowledged} notification.",
/// "type": "object",
/// "required": [
/// "notifications"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/NotificationMetaObject"
/// },
/// "notifications": {
/// "description": "The subset of requested notification types the server agreed to honor.\nOnly includes notification types the server actually supports; if the\nclient requested an unsupported type (e.g., promptsListChanged when\nthe server has no prompts), it is omitted from this set.",
/// "$ref": "#/$defs/SubscriptionFilter"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct SubscriptionsAcknowledgedNotificationParams {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<NotificationMetaObject>,
/**The subset of requested notification types the server agreed to honor.
Only includes notification types the server actually supports; if the
client requested an unsupported type (e.g., promptsListChanged when
the server has no prompts), it is omitted from this set.*/
pub notifications: SubscriptionFilter,
}
/**Sent from the client to open a long-lived channel for receiving notifications
outside the context of a specific request. Replaces the previous HTTP GET
endpoint and ensures consistent behavior between HTTP and STDIO.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Sent from the client to open a long-lived channel for receiving notifications\noutside the context of a specific request. Replaces the previous HTTP GET\nendpoint and ensures consistent behavior between HTTP and STDIO.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "method",
/// "params"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "method": {
/// "type": "string",
/// "const": "subscriptions/listen"
/// },
/// "params": {
/// "$ref": "#/$defs/SubscriptionsListenRequestParams"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SubscriptionsListenRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::subscriptions_listen_request_jsonrpc")]
jsonrpc: ::std::string::String,
#[serde(deserialize_with = "validate::subscriptions_listen_request_method")]
method: ::std::string::String,
pub params: SubscriptionsListenRequestParams,
}
impl SubscriptionsListenRequest {
pub fn new(id: RequestId, params: SubscriptionsListenRequestParams) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
method: "subscriptions/listen".to_string(),
params,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "subscriptions/listen"
pub fn method_value() -> &'static str {
"subscriptions/listen"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"subscriptions/listen"
}
}
///Parameters for a {@link SubscriptionsListenRequestsubscriptions/listen} request.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Parameters for a {@link SubscriptionsListenRequestsubscriptions/listen} request.",
/// "type": "object",
/// "required": [
/// "_meta",
/// "notifications"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/RequestMetaObject"
/// },
/// "notifications": {
/// "description": "The notifications the client opts in to on this stream. The server\n**MUST NOT** send notification types the client has not explicitly\nrequested.",
/// "$ref": "#/$defs/SubscriptionFilter"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SubscriptionsListenRequestParams {
#[serde(rename = "_meta")]
pub meta: RequestMetaObject,
/**The notifications the client opts in to on this stream. The server
**MUST NOT** send notification types the client has not explicitly
requested.*/
pub notifications: SubscriptionFilter,
}
/**The response to a {@link SubscriptionsListenRequestsubscriptions/listen}
request, signalling that the subscription has ended gracefully (for example,
during server shutdown). Because the listen stream is long-lived, this result
is sent only when the server tears the subscription down; an abrupt transport
close carries no response. The result body is otherwise empty.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The response to a {@link SubscriptionsListenRequestsubscriptions/listen}\nrequest, signalling that the subscription has ended gracefully (for example,\nduring server shutdown). Because the listen stream is long-lived, this result\nis sent only when the server tears the subscription down; an abrupt transport\nclose carries no response. The result body is otherwise empty.",
/// "type": "object",
/// "required": [
/// "_meta",
/// "resultType"
/// ],
/// "properties": {
/// "_meta": {
/// "$ref": "#/$defs/SubscriptionsListenResultMetaObject"
/// },
/// "resultType": {
/// "description": "Indicates the type of the result, which allows the client to determine\nhow to parse the result object.\n\nServers implementing this protocol version MUST include this field.\nFor backward compatibility, when a client receives a result from a\nserver implementing an earlier protocol version (which does not include\nresultType), the client MUST treat the absent field as \"complete\".",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SubscriptionsListenResult {
#[serde(rename = "_meta")]
pub meta: SubscriptionsListenResultMetaObject,
/**Indicates the type of the result, which allows the client to determine
how to parse the result object.
Servers implementing this protocol version MUST include this field.
For backward compatibility, when a client receives a result from a
server implementing an earlier protocol version (which does not include
resultType), the client MUST treat the absent field as "complete".*/
#[serde(rename = "resultType")]
pub result_type: ::std::string::String,
}
/**Extends {@link ResultMetaObject} with the subscription-stream identifier carried by a
{@link SubscriptionsListenResult}. All key naming rules from MetaObject apply.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Extends {@link ResultMetaObject} with the subscription-stream identifier carried by a\n{@link SubscriptionsListenResult}. All key naming rules from MetaObject apply.",
/// "type": "object",
/// "required": [
/// "io.modelcontextprotocol/subscriptionId"
/// ],
/// "properties": {
/// "io.modelcontextprotocol/serverInfo": {
/// "description": "Identifies the server software producing the response. Servers SHOULD\ninclude this field on every response unless specifically configured not\nto do so.\n\nThe {@link Implementation} schema requires name and version; other\nfields are optional.\n\nThe value is self-reported by the server and is not verified by the\nprotocol. It is intended for display, logging, and debugging. Clients\nSHOULD NOT use it to change their behavior, and SHOULD NOT rely on it for\nsecurity decisions.",
/// "$ref": "#/$defs/Implementation"
/// },
/// "io.modelcontextprotocol/subscriptionId": {
/// "description": "Identifies the subscription stream this response closes, so the client can\ncorrelate it with the originating subscription — mirroring the same key on\nthe stream's notifications. The value is the JSON-RPC ID of the\nsubscriptions/listen request that opened the stream (and equals this\nresponse's id).",
/// "$ref": "#/$defs/RequestId"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SubscriptionsListenResultMetaObject {
/**Identifies the server software producing the response. Servers SHOULD
include this field on every response unless specifically configured not
to do so.
The {@link Implementation} schema requires name and version; other
fields are optional.
The value is self-reported by the server and is not verified by the
protocol. It is intended for display, logging, and debugging. Clients
SHOULD NOT use it to change their behavior, and SHOULD NOT rely on it for
security decisions.*/
#[serde(
rename = "io.modelcontextprotocol/serverInfo",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub io_modelcontextprotocol_server_info: ::std::option::Option<Implementation>,
/**Identifies the subscription stream this response closes, so the client can
correlate it with the originating subscription — mirroring the same key on
the stream's notifications. The value is the JSON-RPC ID of the
subscriptions/listen request that opened the stream (and equals this
response's id).*/
#[serde(rename = "io.modelcontextprotocol/subscriptionId")]
pub io_modelcontextprotocol_subscription_id: RequestId,
#[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 successful response from the server for a {@link SubscriptionsListenRequestsubscriptions/listen}
request, sent when the server tears the subscription down gracefully.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A successful response from the server for a {@link SubscriptionsListenRequestsubscriptions/listen}\nrequest, sent when the server tears the subscription down gracefully.",
/// "type": "object",
/// "required": [
/// "id",
/// "jsonrpc",
/// "result"
/// ],
/// "properties": {
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// },
/// "result": {
/// "$ref": "#/$defs/SubscriptionsListenResult"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SubscriptionsListenResultResponse {
pub id: RequestId,
#[serde(deserialize_with = "validate::subscriptions_listen_result_response_jsonrpc")]
jsonrpc: ::std::string::String,
pub result: SubscriptionsListenResult,
}
impl SubscriptionsListenResultResponse {
pub fn new(id: RequestId, result: SubscriptionsListenResult) -> Self {
Self {
id,
jsonrpc: JSONRPC_VERSION.to_string(),
result,
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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>,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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<MetaObject>,
) -> 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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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 {
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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": {
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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"
/// },
/// "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.\n\nTool arguments are always JSON objects, so type: \"object\" is required at the root.\nBeyond that, any JSON Schema 2020-12 keyword may appear alongside type — including\ncomposition keywords (oneOf, anyOf, allOf, not), conditional keywords\n(if/then/else), reference keywords ($ref, $defs, $anchor), and any other\nstandard validation or annotation keywords.\n\nProperty schemas may carry an x-mcp-header annotation to mirror the\nargument value into an HTTP header on the Streamable HTTP transport. See\nthe Streamable HTTP transport specification for the validity and\nextraction rules.\n\nDefaults to JSON Schema 2020-12 when no explicit $schema is provided.",
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "$schema": {
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "object"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "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 {@link CallToolResult}. This can be any valid JSON Schema 2020-12.\n\nDefaults to JSON Schema 2020-12 when no explicit $schema is provided.",
/// "type": "object",
/// "properties": {
/// "$schema": {
/// "type": "string"
/// }
/// },
/// "additionalProperties": {}
/// },
/// "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 {@link 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>,
/**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,
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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 {@link 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 {@link 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 {@link 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"),
}
}
}
/**A JSON Schema object defining the expected parameters for the tool.
Tool arguments are always JSON objects, so type: "object" is required at the root.
Beyond that, any JSON Schema 2020-12 keyword may appear alongside type — including
composition keywords (oneOf, anyOf, allOf, not), conditional keywords
(if/then/else), reference keywords ($ref, $defs, $anchor), and any other
standard validation or annotation keywords.
Property schemas may carry an x-mcp-header annotation to mirror the
argument value into an HTTP header on the Streamable HTTP transport. See
the Streamable HTTP transport specification for the validity and
extraction rules.
Defaults to JSON Schema 2020-12 when no explicit $schema is provided.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A JSON Schema object defining the expected parameters for the tool.\n\nTool arguments are always JSON objects, so type: \"object\" is required at the root.\nBeyond that, any JSON Schema 2020-12 keyword may appear alongside type — including\ncomposition keywords (oneOf, anyOf, allOf, not), conditional keywords\n(if/then/else), reference keywords ($ref, $defs, $anchor), and any other\nstandard validation or annotation keywords.\n\nProperty schemas may carry an x-mcp-header annotation to mirror the\nargument value into an HTTP header on the Streamable HTTP transport. See\nthe Streamable HTTP transport specification for the validity and\nextraction rules.\n\nDefaults to JSON Schema 2020-12 when no explicit $schema is provided.",
/// "type": "object",
/// "required": [
/// "type"
/// ],
/// "properties": {
/// "$schema": {
/// "type": "string"
/// },
/// "type": {
/// "type": "string",
/// "const": "object"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ToolInputSchema {
#[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,
#[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>>,
}
impl ToolInputSchema {
pub fn new(
schema: ::std::option::Option<::std::string::String>,
extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
) -> Self {
Self {
schema,
type_: "object".to_string(),
extra,
}
}
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 is only delivered on a {@link SubscriptionsListenRequestsubscriptions/listen} stream when the client requested it via the toolsListChanged filter field.
///
/// <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 is only delivered on a {@link SubscriptionsListenRequestsubscriptions/listen} stream when the client requested it via the toolsListChanged filter field.",
/// "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 {@link CallToolResult}. This can be any valid JSON Schema 2020-12.
Defaults to JSON Schema 2020-12 when no explicit $schema is provided.*/
///
/// <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 {@link CallToolResult}. This can be any valid JSON Schema 2020-12.\n\nDefaults to JSON Schema 2020-12 when no explicit $schema is provided.",
/// "type": "object",
/// "properties": {
/// "$schema": {
/// "type": "string"
/// }
/// },
/// "additionalProperties": {}
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ToolOutputSchema {
#[serde(rename = "$schema", default, skip_serializing_if = "::std::option::Option::is_none")]
pub schema: ::std::option::Option<::std::string::String>,
#[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 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.",
/// "$ref": "#/$defs/MetaObject"
/// },
/// "content": {
/// "description": "The unstructured result content of the tool use.\n\nThis has the same format as {@link 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 value.\n\nThis can be any JSON value (object, array, string, number, boolean, or null).\nIf the tool defined an {@link Tool.outputSchema}, this SHOULD conform to that schema."
/// },
/// "toolUseId": {
/// "description": "The ID of the tool use this result corresponds to.\n\nThis MUST match the ID from a previous {@link 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 {@link 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.*/
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
/**An optional structured result value.
This can be any JSON value (object, array, string, number, boolean, or null).
If the tool defined an {@link Tool.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::Value>,
/**The ID of the tool use this result corresponds to.
This MUST match the ID from a previous {@link 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<MetaObject>,
structured_content: ::std::option::Option<::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.",
/// "$ref": "#/$defs/MetaObject"
/// },
/// "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.*/
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<MetaObject>,
///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<MetaObject>,
) -> 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"
}
}
/**Returned when the request's protocol version is unknown to the server or
unsupported (e.g., a known experimental or draft version the server has
chosen not to implement). For HTTP, the response status code MUST be
400 Bad Request.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Returned when the request's protocol version is unknown to the server or\nunsupported (e.g., a known experimental or draft version the server has\nchosen not to implement). For HTTP, the response status code MUST be\n400 Bad 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": [
/// "requested",
/// "supported"
/// ],
/// "properties": {
/// "requested": {
/// "description": "The protocol version that was requested by the client.",
/// "type": "string"
/// },
/// "supported": {
/// "description": "Protocol versions the server supports. The client should choose a\nmutually supported version from this list and retry.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// }
/// }
/// }
/// }
/// }
/// ]
/// },
/// "id": {
/// "$ref": "#/$defs/RequestId"
/// },
/// "jsonrpc": {
/// "type": "string",
/// "const": "2.0"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct UnsupportedProtocolVersionError {
pub error: UnsupportedProtocolVersionErrorError,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub id: ::std::option::Option<RequestId>,
#[serde(deserialize_with = "validate::unsupported_protocol_version_error_jsonrpc")]
jsonrpc: ::std::string::String,
}
impl UnsupportedProtocolVersionError {
pub fn new(error: UnsupportedProtocolVersionErrorError, id: ::std::option::Option<RequestId>) -> Self {
Self {
error,
id,
jsonrpc: JSONRPC_VERSION.to_string(),
}
}
pub fn jsonrpc(&self) -> &::std::string::String {
&self.jsonrpc
}
}
///UnsupportedProtocolVersionErrorError
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "allOf": [
/// {
/// "$ref": "#/$defs/Error"
/// },
/// {
/// "type": "object",
/// "required": [
/// "code",
/// "data"
/// ],
/// "properties": {
/// "code": {
/// "type": "integer"
/// },
/// "data": {
/// "type": "object",
/// "required": [
/// "requested",
/// "supported"
/// ],
/// "properties": {
/// "requested": {
/// "description": "The protocol version that was requested by the client.",
/// "type": "string"
/// },
/// "supported": {
/// "description": "Protocol versions the server supports. The client should choose a\nmutually supported version from this list and retry.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// }
/// }
/// }
/// }
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct UnsupportedProtocolVersionErrorError {
pub code: i64,
pub data: UnsupportedProtocolVersionErrorErrorData,
///A short description of the error. The message SHOULD be limited to a concise single sentence.
pub message: ::std::string::String,
}
///UnsupportedProtocolVersionErrorErrorData
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "requested",
/// "supported"
/// ],
/// "properties": {
/// "requested": {
/// "description": "The protocol version that was requested by the client.",
/// "type": "string"
/// },
/// "supported": {
/// "description": "Protocol versions the server supports. The client should choose a\nmutually supported version from this list and retry.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct UnsupportedProtocolVersionErrorErrorData {
///The protocol version that was requested by the client.
pub requested: ::std::string::String,
/**Protocol versions the server supports. The client should choose a
mutually supported version from this list and retry.*/
pub supported: ::std::vec::Vec<::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"
}
}
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 {
"server/discover" => {
let req = serde_json::from_value::<DiscoverRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::DiscoverRequest(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))
}
"subscriptions/listen" => {
let req =
serde_json::from_value::<SubscriptionsListenRequest>(value).map_err(serde::de::Error::custom)?;
Ok(ClientRequest::SubscriptionsListenRequest(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))
}
"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::DiscoverRequest(request) => request.method(),
ClientRequest::ListResourcesRequest(request) => request.method(),
ClientRequest::ListResourceTemplatesRequest(request) => request.method(),
ClientRequest::ReadResourceRequest(request) => request.method(),
ClientRequest::SubscriptionsListenRequest(request) => request.method(),
ClientRequest::ListPromptsRequest(request) => request.method(),
ClientRequest::GetPromptRequest(request) => request.method(),
ClientRequest::ListToolsRequest(request) => request.method(),
ClientRequest::CallToolRequest(request) => request.method(),
ClientRequest::CompleteRequest(request) => request.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/subscriptions/acknowledged" => {
let req = serde_json::from_value::<SubscriptionsAcknowledgedNotification>(value)
.map_err(serde::de::Error::custom)?;
Ok(ServerNotification::SubscriptionsAcknowledgedNotification(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/message" => {
let req =
serde_json::from_value::<LoggingMessageNotification>(value).map_err(serde::de::Error::custom)?;
Ok(ServerNotification::LoggingMessageNotification(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::SubscriptionsAcknowledgedNotification(request) => request.method(),
ServerNotification::ResourceUpdatedNotification(request) => request.method(),
ServerNotification::PromptListChangedNotification(request) => request.method(),
ServerNotification::ToolListChangedNotification(request) => request.method(),
ServerNotification::LoggingMessageNotification(request) => request.method(),
}
}
}
impl<'de> serde::Deserialize<'de> for ServerResult {
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 result_type = value.get("resultType").and_then(|v| v.as_str());
if result_type == Some("input_required") {
return serde_json::from_value::<InputRequiredResult>(value)
.map(ServerResult::InputRequiredResult)
.map_err(serde::de::Error::custom);
}
let value = match result_type {
Some(_) => value,
None => match value {
serde_json::Value::Object(mut map) => {
map.insert("resultType".to_string(), serde_json::Value::String("complete".to_string()));
serde_json::Value::Object(map)
}
v => v,
},
};
if let ::std::result::Result::Ok(v) = serde_json::from_value::<DiscoverResult>(value.clone()) {
return ::std::result::Result::Ok(ServerResult::DiscoverResult(v));
}
if let ::std::result::Result::Ok(v) = serde_json::from_value::<ListResourcesResult>(value.clone()) {
return ::std::result::Result::Ok(ServerResult::ListResourcesResult(v));
}
if let ::std::result::Result::Ok(v) = serde_json::from_value::<ListResourceTemplatesResult>(value.clone()) {
return ::std::result::Result::Ok(ServerResult::ListResourceTemplatesResult(v));
}
if let ::std::result::Result::Ok(v) = serde_json::from_value::<ReadResourceResult>(value.clone()) {
return ::std::result::Result::Ok(ServerResult::ReadResourceResult(v));
}
if let ::std::result::Result::Ok(v) = serde_json::from_value::<SubscriptionsListenResult>(value.clone()) {
return ::std::result::Result::Ok(ServerResult::SubscriptionsListenResult(v));
}
if let ::std::result::Result::Ok(v) = serde_json::from_value::<ListPromptsResult>(value.clone()) {
return ::std::result::Result::Ok(ServerResult::ListPromptsResult(v));
}
if let ::std::result::Result::Ok(v) = serde_json::from_value::<GetPromptResult>(value.clone()) {
return ::std::result::Result::Ok(ServerResult::GetPromptResult(v));
}
if let ::std::result::Result::Ok(v) = serde_json::from_value::<ListToolsResult>(value.clone()) {
return ::std::result::Result::Ok(ServerResult::ListToolsResult(v));
}
if let ::std::result::Result::Ok(v) = serde_json::from_value::<CallToolResult>(value.clone()) {
return ::std::result::Result::Ok(ServerResult::CallToolResult(v));
}
if let ::std::result::Result::Ok(v) = serde_json::from_value::<CompleteResult>(value.clone()) {
return ::std::result::Result::Ok(ServerResult::CompleteResult(v));
}
serde_json::from_value::<Result>(value)
.map(ServerResult::Result)
.map_err(serde::de::Error::custom)
}
}
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) => serde_json::from_value(serde_json::Value::Object(obj)).ok(),
_ => None,
});
let result_type = map
.remove("resultType")
.and_then(|v| v.as_str().map(|s| s.to_string()))
.unwrap_or_else(|| "complete".to_string());
let extra = if map.is_empty() { None } else { Some(map) };
GenericResult {
meta,
result_type,
extra,
}
} else {
GenericResult {
meta: None,
result_type: "complete".to_string(),
extra: None,
}
}
}
impl From<InputRequiredResult> for GenericResult {
fn from(value: InputRequiredResult) -> Self {
into_result(value)
}
}
impl From<DiscoverResult> for GenericResult {
fn from(value: DiscoverResult) -> 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<SubscriptionsListenResult> for GenericResult {
fn from(value: SubscriptionsListenResult) -> 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<CompleteResult> for GenericResult {
fn from(value: CompleteResult) -> Self {
into_result(value)
}
}
impl ClientRequest {
pub fn request_id(&self) -> &RequestId {
match self {
ClientRequest::DiscoverRequest(request) => &request.id,
ClientRequest::ListResourcesRequest(request) => &request.id,
ClientRequest::ListResourceTemplatesRequest(request) => &request.id,
ClientRequest::ReadResourceRequest(request) => &request.id,
ClientRequest::SubscriptionsListenRequest(request) => &request.id,
ClientRequest::ListPromptsRequest(request) => &request.id,
ClientRequest::GetPromptRequest(request) => &request.id,
ClientRequest::ListToolsRequest(request) => &request.id,
ClientRequest::CallToolRequest(request) => &request.id,
ClientRequest::CompleteRequest(request) => &request.id,
}
}
}
impl Default for ProgressToken {
fn default() -> Self {
ProgressToken::Integer(0)
}
}
impl Default for RequestId {
fn default() -> Self {
RequestId::Integer(0)
}
}
/// Alias to avoid conflicts with Rust's standard `Result` type.
pub type GenericResult = Result;
#[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 `ReadResourceContent` instead.")]
pub type ReadResourceResultContentsItem = ReadResourceContent;