rust_mcp_schema/generated_schema/2026_07_28/mcp_schema.rs
1/// Copyright (c) 2025 Ali Hashemi (rust-mcp-stack)
2/// Licensed under the MIT License. See LICENSE in the project root.
3/// ----------------------------------------------------------------------------
4/// This file is auto-generated by mcp-schema-gen v0.5.2.
5/// WARNING:
6/// It is not recommended to modify this file directly. You are free to
7/// modify or extend the implementations as needed, but please do so at your own risk.
8///
9/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
10/// Hash : 4e67bdc2f3403a8602f72025b28ac27fe7fd4e44
11/// Generated at : 2026-08-21 20:10:23
12/// ----------------------------------------------------------------------------
13///
14use super::validators as validate;
15/// MCP Protocol Version
16pub const LATEST_PROTOCOL_VERSION: &str = "2026-07-28";
17/// JSON-RPC Version
18pub const JSONRPC_VERSION: &str = "2.0";
19/// Parse error. Invalid JSON was received. An error occurred while parsing the JSON text.
20pub const PARSE_ERROR: i64 = -32700i64;
21/// Invalid Request. The JSON sent is not a valid Request object.
22pub const INVALID_REQUEST: i64 = -32600i64;
23/// Method not found. The method does not exist / is not available.
24pub const METHOD_NOT_FOUND: i64 = -32601i64;
25/// Invalid param. Invalid method parameter(s).
26pub const INVALID_PARAMS: i64 = -32602i64;
27/// Internal error. Internal JSON-RPC error.
28pub const INTERNAL_ERROR: i64 = -32603i64;
29///HEADER_MISMATCH
30pub const HEADER_MISMATCH: i64 = -32020i64;
31///MISSING_REQUIRED_CLIENT_CAPABILITY
32pub const MISSING_REQUIRED_CLIENT_CAPABILITY: i64 = -32021i64;
33///UNSUPPORTED_PROTOCOL_VERSION
34pub const UNSUPPORTED_PROTOCOL_VERSION: i64 = -32022i64;
35///Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
36///
37/// <details><summary>JSON schema</summary>
38///
39/// ```json
40///{
41/// "description": "Optional annotations for the client. The client can use annotations to inform how objects are used or displayed",
42/// "type": "object",
43/// "properties": {
44/// "audience": {
45/// "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\"]).",
46/// "type": "array",
47/// "items": {
48/// "$ref": "#/$defs/Role"
49/// }
50/// },
51/// "lastModified": {
52/// "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.",
53/// "type": "string"
54/// },
55/// "priority": {
56/// "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.",
57/// "type": "number",
58/// "maximum": 1.0,
59/// "minimum": 0.0
60/// }
61/// }
62///}
63/// ```
64/// </details>
65#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
66pub struct Annotations {
67 /**Describes who the intended audience of this object or data is.
68 It can include multiple entries to indicate content useful for multiple audiences (e.g., ["user", "assistant"]).*/
69 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
70 pub audience: ::std::vec::Vec<Role>,
71 /**The moment the resource was last modified, as an ISO 8601 formatted string.
72 Should be an ISO 8601 formatted string (e.g., "2025-01-12T15:00:58Z").
73 Examples: last activity timestamp in an open file, timestamp when the resource
74 was attached, etc.*/
75 #[serde(rename = "lastModified", default, skip_serializing_if = "::std::option::Option::is_none")]
76 pub last_modified: ::std::option::Option<::std::string::String>,
77 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
78 pub priority: ::std::option::Option<f64>,
79}
80///Audio provided to or from an LLM.
81///
82/// <details><summary>JSON schema</summary>
83///
84/// ```json
85///{
86/// "description": "Audio provided to or from an LLM.",
87/// "type": "object",
88/// "required": [
89/// "data",
90/// "mimeType",
91/// "type"
92/// ],
93/// "properties": {
94/// "_meta": {
95/// "$ref": "#/$defs/MetaObject"
96/// },
97/// "annotations": {
98/// "description": "Optional annotations for the client.",
99/// "$ref": "#/$defs/Annotations"
100/// },
101/// "data": {
102/// "description": "The base64-encoded audio data.",
103/// "type": "string",
104/// "format": "byte"
105/// },
106/// "mimeType": {
107/// "description": "The MIME type of the audio. Different providers may support different audio types.",
108/// "type": "string"
109/// },
110/// "type": {
111/// "type": "string",
112/// "const": "audio"
113/// }
114/// }
115///}
116/// ```
117/// </details>
118#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
119pub struct AudioContent {
120 ///Optional annotations for the client.
121 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
122 pub annotations: ::std::option::Option<Annotations>,
123 ///The base64-encoded audio data.
124 pub data: ::std::string::String,
125 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
126 pub meta: ::std::option::Option<MetaObject>,
127 ///The MIME type of the audio. Different providers may support different audio types.
128 #[serde(rename = "mimeType")]
129 pub mime_type: ::std::string::String,
130 #[serde(rename = "type", deserialize_with = "validate::audio_content_type_")]
131 type_: ::std::string::String,
132}
133impl AudioContent {
134 pub fn new(
135 data: ::std::string::String,
136 mime_type: ::std::string::String,
137 annotations: ::std::option::Option<Annotations>,
138 meta: ::std::option::Option<MetaObject>,
139 ) -> Self {
140 Self {
141 annotations,
142 data,
143 meta,
144 mime_type,
145 type_: "audio".to_string(),
146 }
147 }
148 pub fn type_(&self) -> &::std::string::String {
149 &self.type_
150 }
151 /// returns "audio"
152 pub fn type_value() -> &'static str {
153 "audio"
154 }
155 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
156 pub fn type_name() -> &'static str {
157 "audio"
158 }
159}
160///Base interface for metadata with name (identifier) and title (display name) properties.
161///
162/// <details><summary>JSON schema</summary>
163///
164/// ```json
165///{
166/// "description": "Base interface for metadata with name (identifier) and title (display name) properties.",
167/// "type": "object",
168/// "required": [
169/// "name"
170/// ],
171/// "properties": {
172/// "name": {
173/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
174/// "type": "string"
175/// },
176/// "title": {
177/// "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).",
178/// "type": "string"
179/// }
180/// }
181///}
182/// ```
183/// </details>
184#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
185pub struct BaseMetadata {
186 ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
187 pub name: ::std::string::String,
188 /**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
189 even by those unfamiliar with domain-specific terminology.
190 If not provided, the name should be used for display (except for {@link Tool},
191 where annotations.title should be given precedence over using name,
192 if present).*/
193 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
194 pub title: ::std::option::Option<::std::string::String>,
195}
196///BlobResourceContents
197///
198/// <details><summary>JSON schema</summary>
199///
200/// ```json
201///{
202/// "type": "object",
203/// "required": [
204/// "blob",
205/// "uri"
206/// ],
207/// "properties": {
208/// "_meta": {
209/// "$ref": "#/$defs/MetaObject"
210/// },
211/// "blob": {
212/// "description": "A base64-encoded string representing the binary data of the item.",
213/// "type": "string",
214/// "format": "byte"
215/// },
216/// "mimeType": {
217/// "description": "The MIME type of this resource, if known.",
218/// "type": "string"
219/// },
220/// "uri": {
221/// "description": "The URI of this resource.",
222/// "type": "string",
223/// "format": "uri"
224/// }
225/// }
226///}
227/// ```
228/// </details>
229#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
230pub struct BlobResourceContents {
231 ///A base64-encoded string representing the binary data of the item.
232 pub blob: ::std::string::String,
233 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
234 pub meta: ::std::option::Option<MetaObject>,
235 ///The MIME type of this resource, if known.
236 #[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
237 pub mime_type: ::std::option::Option<::std::string::String>,
238 ///The URI of this resource.
239 pub uri: ::std::string::String,
240}
241///BooleanSchema
242///
243/// <details><summary>JSON schema</summary>
244///
245/// ```json
246///{
247/// "type": "object",
248/// "required": [
249/// "type"
250/// ],
251/// "properties": {
252/// "default": {
253/// "type": "boolean"
254/// },
255/// "description": {
256/// "type": "string"
257/// },
258/// "title": {
259/// "type": "string"
260/// },
261/// "type": {
262/// "type": "string",
263/// "const": "boolean"
264/// }
265/// }
266///}
267/// ```
268/// </details>
269#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
270pub struct BooleanSchema {
271 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
272 pub default: ::std::option::Option<bool>,
273 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
274 pub description: ::std::option::Option<::std::string::String>,
275 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
276 pub title: ::std::option::Option<::std::string::String>,
277 #[serde(rename = "type", deserialize_with = "validate::boolean_schema_type_")]
278 type_: ::std::string::String,
279}
280impl BooleanSchema {
281 pub fn new(
282 default: ::std::option::Option<bool>,
283 description: ::std::option::Option<::std::string::String>,
284 title: ::std::option::Option<::std::string::String>,
285 ) -> Self {
286 Self {
287 default,
288 description,
289 title,
290 type_: "boolean".to_string(),
291 }
292 }
293 pub fn type_(&self) -> &::std::string::String {
294 &self.type_
295 }
296 /// returns "boolean"
297 pub fn type_value() -> &'static str {
298 "boolean"
299 }
300 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
301 pub fn type_name() -> &'static str {
302 "boolean"
303 }
304}
305///A result that supports a time-to-live (TTL) hint for client-side caching.
306///
307/// <details><summary>JSON schema</summary>
308///
309/// ```json
310///{
311/// "description": "A result that supports a time-to-live (TTL) hint for client-side caching.",
312/// "type": "object",
313/// "required": [
314/// "cacheScope",
315/// "resultType",
316/// "ttlMs"
317/// ],
318/// "properties": {
319/// "_meta": {
320/// "$ref": "#/$defs/ResultMetaObject"
321/// },
322/// "cacheScope": {
323/// "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).",
324/// "type": "string",
325/// "enum": [
326/// "private",
327/// "public"
328/// ]
329/// },
330/// "resultType": {
331/// "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\".",
332/// "type": "string"
333/// },
334/// "ttlMs": {
335/// "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.",
336/// "type": "integer",
337/// "minimum": 0.0
338/// }
339/// }
340///}
341/// ```
342/// </details>
343#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
344pub struct CacheableResult {
345 /**Indicates the intended scope of the cached response, analogous to HTTP
346 Cache-Control: public vs Cache-Control: private.
347 - "public": The response does not contain user-specific data. Any
348 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
349 the response and serve it across authorization contexts.
350 - "private": The response MAY be cached and reused only within the
351 same authorization context. Caches MUST NOT be shared across
352 authorization contexts (e.g., a different access token requires a
353 different cache).*/
354 #[serde(rename = "cacheScope")]
355 pub cache_scope: CacheableResultCacheScope,
356 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
357 pub meta: ::std::option::Option<ResultMetaObject>,
358 /**Indicates the type of the result, which allows the client to determine
359 how to parse the result object.
360 Servers implementing this protocol version MUST include this field.
361 For backward compatibility, when a client receives a result from a
362 server implementing an earlier protocol version (which does not include
363 resultType), the client MUST treat the absent field as "complete".*/
364 #[serde(rename = "resultType")]
365 pub result_type: ::std::string::String,
366 /**A hint from the server indicating how long (in milliseconds) the
367 client MAY cache this response before re-fetching. Semantics are
368 analogous to HTTP Cache-Control max-age.
369 - If 0, The response SHOULD be considered immediately stale,
370 The client MAY re-fetch every time the result is needed.
371 - If positive, the client SHOULD consider the result fresh for this many
372 milliseconds after receiving the response.*/
373 #[serde(rename = "ttlMs")]
374 pub ttl_ms: u64,
375}
376/**Indicates the intended scope of the cached response, analogous to HTTP
377Cache-Control: public vs Cache-Control: private.
378- "public": The response does not contain user-specific data. Any
379 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
380 the response and serve it across authorization contexts.
381- "private": The response MAY be cached and reused only within the
382 same authorization context. Caches MUST NOT be shared across
383 authorization contexts (e.g., a different access token requires a
384 different cache).*/
385///
386/// <details><summary>JSON schema</summary>
387///
388/// ```json
389///{
390/// "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).",
391/// "type": "string",
392/// "enum": [
393/// "private",
394/// "public"
395/// ]
396///}
397/// ```
398/// </details>
399#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
400pub enum CacheableResultCacheScope {
401 #[serde(rename = "private")]
402 Private,
403 #[serde(rename = "public")]
404 Public,
405}
406impl ::std::fmt::Display for CacheableResultCacheScope {
407 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
408 match *self {
409 Self::Private => write!(f, "private"),
410 Self::Public => write!(f, "public"),
411 }
412 }
413}
414///Used by the client to invoke a tool provided by the server.
415///
416/// <details><summary>JSON schema</summary>
417///
418/// ```json
419///{
420/// "description": "Used by the client to invoke a tool provided by the server.",
421/// "type": "object",
422/// "required": [
423/// "id",
424/// "jsonrpc",
425/// "method",
426/// "params"
427/// ],
428/// "properties": {
429/// "id": {
430/// "$ref": "#/$defs/RequestId"
431/// },
432/// "jsonrpc": {
433/// "type": "string",
434/// "const": "2.0"
435/// },
436/// "method": {
437/// "type": "string",
438/// "const": "tools/call"
439/// },
440/// "params": {
441/// "$ref": "#/$defs/CallToolRequestParams"
442/// }
443/// }
444///}
445/// ```
446/// </details>
447#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
448pub struct CallToolRequest {
449 pub id: RequestId,
450 #[serde(deserialize_with = "validate::call_tool_request_jsonrpc")]
451 jsonrpc: ::std::string::String,
452 #[serde(deserialize_with = "validate::call_tool_request_method")]
453 method: ::std::string::String,
454 pub params: CallToolRequestParams,
455}
456impl CallToolRequest {
457 pub fn new(id: RequestId, params: CallToolRequestParams) -> Self {
458 Self {
459 id,
460 jsonrpc: JSONRPC_VERSION.to_string(),
461 method: "tools/call".to_string(),
462 params,
463 }
464 }
465 pub fn jsonrpc(&self) -> &::std::string::String {
466 &self.jsonrpc
467 }
468 pub fn method(&self) -> &::std::string::String {
469 &self.method
470 }
471 /// returns "tools/call"
472 pub fn method_value() -> &'static str {
473 "tools/call"
474 }
475 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
476 pub fn method_name() -> &'static str {
477 "tools/call"
478 }
479}
480///Parameters for a tools/call request.
481///
482/// <details><summary>JSON schema</summary>
483///
484/// ```json
485///{
486/// "description": "Parameters for a tools/call request.",
487/// "type": "object",
488/// "required": [
489/// "_meta",
490/// "name"
491/// ],
492/// "properties": {
493/// "_meta": {
494/// "$ref": "#/$defs/RequestMetaObject"
495/// },
496/// "arguments": {
497/// "description": "Arguments to use for the tool call.",
498/// "type": "object",
499/// "additionalProperties": {}
500/// },
501/// "inputResponses": {
502/// "$ref": "#/$defs/InputResponses"
503/// },
504/// "name": {
505/// "description": "The name of the tool.",
506/// "type": "string"
507/// },
508/// "requestState": {
509/// "type": "string"
510/// }
511/// }
512///}
513/// ```
514/// </details>
515#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
516pub struct CallToolRequestParams {
517 ///Arguments to use for the tool call.
518 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
519 pub arguments: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
520 #[serde(rename = "inputResponses", default, skip_serializing_if = "::std::option::Option::is_none")]
521 pub input_responses: ::std::option::Option<InputResponses>,
522 #[serde(rename = "_meta")]
523 pub meta: RequestMetaObject,
524 ///The name of the tool.
525 pub name: ::std::string::String,
526 #[serde(rename = "requestState", default, skip_serializing_if = "::std::option::Option::is_none")]
527 pub request_state: ::std::option::Option<::std::string::String>,
528}
529///The result returned by the server for a {@link CallToolRequesttools/call} request.
530///
531/// <details><summary>JSON schema</summary>
532///
533/// ```json
534///{
535/// "description": "The result returned by the server for a {@link CallToolRequesttools/call} request.",
536/// "type": "object",
537/// "required": [
538/// "content",
539/// "resultType"
540/// ],
541/// "properties": {
542/// "_meta": {
543/// "$ref": "#/$defs/ResultMetaObject"
544/// },
545/// "content": {
546/// "description": "A list of content objects that represent the unstructured result of the tool call.",
547/// "type": "array",
548/// "items": {
549/// "$ref": "#/$defs/ContentBlock"
550/// }
551/// },
552/// "isError": {
553/// "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.",
554/// "type": "boolean"
555/// },
556/// "resultType": {
557/// "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\".",
558/// "type": "string"
559/// },
560/// "structuredContent": {
561/// "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."
562/// }
563/// }
564///}
565/// ```
566/// </details>
567#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
568pub struct CallToolResult {
569 ///A list of content objects that represent the unstructured result of the tool call.
570 pub content: ::std::vec::Vec<ContentBlock>,
571 /**Whether the tool call ended in an error.
572 If not set, this is assumed to be false (the call was successful).
573 Any errors that originate from the tool SHOULD be reported inside the result
574 object, with isError set to true, _not_ as an MCP protocol-level error
575 response. Otherwise, the LLM would not be able to see that an error occurred
576 and self-correct.
577 However, any errors in _finding_ the tool, an error indicating that the
578 server does not support tool calls, or any other exceptional conditions,
579 should be reported as an MCP error response.*/
580 #[serde(rename = "isError", default, skip_serializing_if = "::std::option::Option::is_none")]
581 pub is_error: ::std::option::Option<bool>,
582 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
583 pub meta: ::std::option::Option<ResultMetaObject>,
584 /**Indicates the type of the result, which allows the client to determine
585 how to parse the result object.
586 Servers implementing this protocol version MUST include this field.
587 For backward compatibility, when a client receives a result from a
588 server implementing an earlier protocol version (which does not include
589 resultType), the client MUST treat the absent field as "complete".*/
590 #[serde(rename = "resultType")]
591 pub result_type: ::std::string::String,
592 /**An optional JSON value that represents the structured result of the tool call.
593 This can be any JSON value (object, array, string, number, boolean, or null)
594 that conforms to the tool's outputSchema if one is defined.*/
595 #[serde(
596 rename = "structuredContent",
597 default,
598 skip_serializing_if = "::std::option::Option::is_none"
599 )]
600 pub structured_content: ::std::option::Option<::serde_json::Value>,
601}
602///A successful response from the server for a {@link CallToolRequesttools/call} request.
603///
604/// <details><summary>JSON schema</summary>
605///
606/// ```json
607///{
608/// "description": "A successful response from the server for a {@link CallToolRequesttools/call} request.",
609/// "type": "object",
610/// "required": [
611/// "id",
612/// "jsonrpc",
613/// "result"
614/// ],
615/// "properties": {
616/// "id": {
617/// "$ref": "#/$defs/RequestId"
618/// },
619/// "jsonrpc": {
620/// "type": "string",
621/// "const": "2.0"
622/// },
623/// "result": {
624/// "anyOf": [
625/// {
626/// "$ref": "#/$defs/InputRequiredResult"
627/// },
628/// {
629/// "$ref": "#/$defs/CallToolResult"
630/// }
631/// ]
632/// }
633/// }
634///}
635/// ```
636/// </details>
637#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
638pub struct CallToolResultResponse {
639 pub id: RequestId,
640 #[serde(deserialize_with = "validate::call_tool_result_response_jsonrpc")]
641 jsonrpc: ::std::string::String,
642 pub result: CallToolResultResponseResult,
643}
644impl CallToolResultResponse {
645 pub fn new(id: RequestId, result: CallToolResultResponseResult) -> Self {
646 Self {
647 id,
648 jsonrpc: JSONRPC_VERSION.to_string(),
649 result,
650 }
651 }
652 pub fn jsonrpc(&self) -> &::std::string::String {
653 &self.jsonrpc
654 }
655}
656///CallToolResultResponseResult
657///
658/// <details><summary>JSON schema</summary>
659///
660/// ```json
661///{
662/// "anyOf": [
663/// {
664/// "$ref": "#/$defs/InputRequiredResult"
665/// },
666/// {
667/// "$ref": "#/$defs/CallToolResult"
668/// }
669/// ]
670///}
671/// ```
672/// </details>
673#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
674#[serde(untagged)]
675pub enum CallToolResultResponseResult {
676 InputRequiredResult(InputRequiredResult),
677 CallToolResult(CallToolResult),
678}
679impl ::std::convert::From<InputRequiredResult> for CallToolResultResponseResult {
680 fn from(value: InputRequiredResult) -> Self {
681 Self::InputRequiredResult(value)
682 }
683}
684impl ::std::convert::From<CallToolResult> for CallToolResultResponseResult {
685 fn from(value: CallToolResult) -> Self {
686 Self::CallToolResult(value)
687 }
688}
689/**This notification is sent by the client to indicate that it is cancelling a request it previously issued.
690On 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.
691The 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.
692This notification indicates that the result will be unused, so any associated processing SHOULD cease.*/
693///
694/// <details><summary>JSON schema</summary>
695///
696/// ```json
697///{
698/// "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.",
699/// "type": "object",
700/// "required": [
701/// "jsonrpc",
702/// "method",
703/// "params"
704/// ],
705/// "properties": {
706/// "jsonrpc": {
707/// "type": "string",
708/// "const": "2.0"
709/// },
710/// "method": {
711/// "type": "string",
712/// "const": "notifications/cancelled"
713/// },
714/// "params": {
715/// "$ref": "#/$defs/CancelledNotificationParams"
716/// }
717/// }
718///}
719/// ```
720/// </details>
721#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
722pub struct CancelledNotification {
723 #[serde(deserialize_with = "validate::cancelled_notification_jsonrpc")]
724 jsonrpc: ::std::string::String,
725 #[serde(deserialize_with = "validate::cancelled_notification_method")]
726 method: ::std::string::String,
727 pub params: CancelledNotificationParams,
728}
729impl CancelledNotification {
730 pub fn new(params: CancelledNotificationParams) -> Self {
731 Self {
732 jsonrpc: JSONRPC_VERSION.to_string(),
733 method: "notifications/cancelled".to_string(),
734 params,
735 }
736 }
737 pub fn jsonrpc(&self) -> &::std::string::String {
738 &self.jsonrpc
739 }
740 pub fn method(&self) -> &::std::string::String {
741 &self.method
742 }
743 /// returns "notifications/cancelled"
744 pub fn method_value() -> &'static str {
745 "notifications/cancelled"
746 }
747 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
748 pub fn method_name() -> &'static str {
749 "notifications/cancelled"
750 }
751}
752///Parameters for a notifications/cancelled notification.
753///
754/// <details><summary>JSON schema</summary>
755///
756/// ```json
757///{
758/// "description": "Parameters for a notifications/cancelled notification.",
759/// "type": "object",
760/// "required": [
761/// "requestId"
762/// ],
763/// "properties": {
764/// "_meta": {
765/// "$ref": "#/$defs/NotificationMetaObject"
766/// },
767/// "reason": {
768/// "description": "An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.",
769/// "type": "string"
770/// },
771/// "requestId": {
772/// "description": "The ID of the request to cancel.\n\nThis MUST correspond to the ID of a request the client previously issued.",
773/// "$ref": "#/$defs/RequestId"
774/// }
775/// }
776///}
777/// ```
778/// </details>
779#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
780pub struct CancelledNotificationParams {
781 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
782 pub meta: ::std::option::Option<NotificationMetaObject>,
783 ///An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
784 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
785 pub reason: ::std::option::Option<::std::string::String>,
786 /**The ID of the request to cancel.
787 This MUST correspond to the ID of a request the client previously issued.*/
788 #[serde(rename = "requestId")]
789 pub request_id: RequestId,
790}
791///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.
792///
793/// <details><summary>JSON schema</summary>
794///
795/// ```json
796///{
797/// "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.",
798/// "type": "object",
799/// "properties": {
800/// "elicitation": {
801/// "description": "Present if the client supports elicitation from the server.",
802/// "type": "object",
803/// "properties": {
804/// "form": {
805/// "$ref": "#/$defs/JSONObject"
806/// },
807/// "url": {
808/// "$ref": "#/$defs/JSONObject"
809/// }
810/// }
811/// },
812/// "experimental": {
813/// "description": "Experimental, non-standard capabilities that the client supports.",
814/// "type": "object",
815/// "additionalProperties": {
816/// "$ref": "#/$defs/JSONObject"
817/// }
818/// },
819/// "extensions": {
820/// "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.",
821/// "type": "object",
822/// "additionalProperties": {
823/// "$ref": "#/$defs/JSONObject"
824/// }
825/// },
826/// "roots": {
827/// "description": "Present if the client supports listing roots.",
828/// "type": "object"
829/// },
830/// "sampling": {
831/// "description": "Present if the client supports sampling from an LLM.",
832/// "type": "object",
833/// "properties": {
834/// "context": {
835/// "description": "Whether the client supports context inclusion via includeContext parameter.\nIf not declared, servers SHOULD only use includeContext: \"none\" (or omit it).",
836/// "$ref": "#/$defs/JSONObject"
837/// },
838/// "tools": {
839/// "description": "Whether the client supports tool use via tools and toolChoice parameters.",
840/// "$ref": "#/$defs/JSONObject"
841/// }
842/// }
843/// }
844/// }
845///}
846/// ```
847/// </details>
848#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
849pub struct ClientCapabilities {
850 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
851 pub elicitation: ::std::option::Option<ClientElicitation>,
852 ///Experimental, non-standard capabilities that the client supports.
853 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
854 pub experimental: ::std::option::Option<std::collections::BTreeMap<::std::string::String, JsonObject>>,
855 /**Optional MCP extensions that the client supports. Keys are extension identifiers
856 (e.g., "io.modelcontextprotocol/oauth-client-credentials"), and values are
857 per-extension settings objects. An empty object indicates support with no settings.
858 Keys MUST follow the {@link MetaObject_meta key naming rules}, with a
859 mandatory prefix.*/
860 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
861 pub extensions: ::std::option::Option<std::collections::BTreeMap<::std::string::String, JsonObject>>,
862 ///Present if the client supports listing roots.
863 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
864 pub roots: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
865 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
866 pub sampling: ::std::option::Option<ClientSampling>,
867}
868///Present if the client supports elicitation from the server.
869///
870/// <details><summary>JSON schema</summary>
871///
872/// ```json
873///{
874/// "description": "Present if the client supports elicitation from the server.",
875/// "type": "object",
876/// "properties": {
877/// "form": {
878/// "$ref": "#/$defs/JSONObject"
879/// },
880/// "url": {
881/// "$ref": "#/$defs/JSONObject"
882/// }
883/// }
884///}
885/// ```
886/// </details>
887#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
888pub struct ClientElicitation {
889 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
890 pub form: ::std::option::Option<JsonObject>,
891 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
892 pub url: ::std::option::Option<JsonObject>,
893}
894/**This notification is sent by the client to indicate that it is cancelling a request it previously issued.
895On 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.
896The 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.
897This notification indicates that the result will be unused, so any associated processing SHOULD cease.*/
898///
899/// <details><summary>JSON schema</summary>
900///
901/// ```json
902///{
903/// "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.",
904/// "type": "object",
905/// "required": [
906/// "jsonrpc",
907/// "method",
908/// "params"
909/// ],
910/// "properties": {
911/// "jsonrpc": {
912/// "type": "string",
913/// "const": "2.0"
914/// },
915/// "method": {
916/// "type": "string",
917/// "const": "notifications/cancelled"
918/// },
919/// "params": {
920/// "$ref": "#/$defs/CancelledNotificationParams"
921/// }
922/// }
923///}
924/// ```
925/// </details>
926#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
927pub struct ClientNotification {
928 #[serde(deserialize_with = "validate::client_notification_jsonrpc")]
929 jsonrpc: ::std::string::String,
930 #[serde(deserialize_with = "validate::client_notification_method")]
931 method: ::std::string::String,
932 pub params: CancelledNotificationParams,
933}
934impl ClientNotification {
935 pub fn new(params: CancelledNotificationParams) -> Self {
936 Self {
937 jsonrpc: JSONRPC_VERSION.to_string(),
938 method: "notifications/cancelled".to_string(),
939 params,
940 }
941 }
942 pub fn jsonrpc(&self) -> &::std::string::String {
943 &self.jsonrpc
944 }
945 pub fn method(&self) -> &::std::string::String {
946 &self.method
947 }
948 /// returns "notifications/cancelled"
949 pub fn method_value() -> &'static str {
950 "notifications/cancelled"
951 }
952 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
953 pub fn method_name() -> &'static str {
954 "notifications/cancelled"
955 }
956}
957///ClientRequest
958///
959/// <details><summary>JSON schema</summary>
960///
961/// ```json
962///{
963/// "anyOf": [
964/// {
965/// "$ref": "#/$defs/DiscoverRequest"
966/// },
967/// {
968/// "$ref": "#/$defs/ListResourcesRequest"
969/// },
970/// {
971/// "$ref": "#/$defs/ListResourceTemplatesRequest"
972/// },
973/// {
974/// "$ref": "#/$defs/ReadResourceRequest"
975/// },
976/// {
977/// "$ref": "#/$defs/SubscriptionsListenRequest"
978/// },
979/// {
980/// "$ref": "#/$defs/ListPromptsRequest"
981/// },
982/// {
983/// "$ref": "#/$defs/GetPromptRequest"
984/// },
985/// {
986/// "$ref": "#/$defs/ListToolsRequest"
987/// },
988/// {
989/// "$ref": "#/$defs/CallToolRequest"
990/// },
991/// {
992/// "$ref": "#/$defs/CompleteRequest"
993/// }
994/// ]
995///}
996/// ```
997/// </details>
998#[derive(::serde::Serialize, Clone, Debug)]
999#[serde(untagged)]
1000pub enum ClientRequest {
1001 DiscoverRequest(DiscoverRequest),
1002 ListResourcesRequest(ListResourcesRequest),
1003 ListResourceTemplatesRequest(ListResourceTemplatesRequest),
1004 ReadResourceRequest(ReadResourceRequest),
1005 SubscriptionsListenRequest(SubscriptionsListenRequest),
1006 ListPromptsRequest(ListPromptsRequest),
1007 GetPromptRequest(GetPromptRequest),
1008 ListToolsRequest(ListToolsRequest),
1009 CallToolRequest(CallToolRequest),
1010 CompleteRequest(CompleteRequest),
1011}
1012impl ::std::convert::From<DiscoverRequest> for ClientRequest {
1013 fn from(value: DiscoverRequest) -> Self {
1014 Self::DiscoverRequest(value)
1015 }
1016}
1017impl ::std::convert::From<ListResourcesRequest> for ClientRequest {
1018 fn from(value: ListResourcesRequest) -> Self {
1019 Self::ListResourcesRequest(value)
1020 }
1021}
1022impl ::std::convert::From<ListResourceTemplatesRequest> for ClientRequest {
1023 fn from(value: ListResourceTemplatesRequest) -> Self {
1024 Self::ListResourceTemplatesRequest(value)
1025 }
1026}
1027impl ::std::convert::From<ReadResourceRequest> for ClientRequest {
1028 fn from(value: ReadResourceRequest) -> Self {
1029 Self::ReadResourceRequest(value)
1030 }
1031}
1032impl ::std::convert::From<SubscriptionsListenRequest> for ClientRequest {
1033 fn from(value: SubscriptionsListenRequest) -> Self {
1034 Self::SubscriptionsListenRequest(value)
1035 }
1036}
1037impl ::std::convert::From<ListPromptsRequest> for ClientRequest {
1038 fn from(value: ListPromptsRequest) -> Self {
1039 Self::ListPromptsRequest(value)
1040 }
1041}
1042impl ::std::convert::From<GetPromptRequest> for ClientRequest {
1043 fn from(value: GetPromptRequest) -> Self {
1044 Self::GetPromptRequest(value)
1045 }
1046}
1047impl ::std::convert::From<ListToolsRequest> for ClientRequest {
1048 fn from(value: ListToolsRequest) -> Self {
1049 Self::ListToolsRequest(value)
1050 }
1051}
1052impl ::std::convert::From<CallToolRequest> for ClientRequest {
1053 fn from(value: CallToolRequest) -> Self {
1054 Self::CallToolRequest(value)
1055 }
1056}
1057impl ::std::convert::From<CompleteRequest> for ClientRequest {
1058 fn from(value: CompleteRequest) -> Self {
1059 Self::CompleteRequest(value)
1060 }
1061}
1062///Common result fields.
1063///
1064/// <details><summary>JSON schema</summary>
1065///
1066/// ```json
1067///{
1068/// "description": "Common result fields.",
1069/// "$ref": "#/$defs/Result"
1070///}
1071/// ```
1072/// </details>
1073#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1074#[serde(transparent)]
1075pub struct ClientResult(pub Result);
1076///Present if the client supports sampling from an LLM.
1077///
1078/// <details><summary>JSON schema</summary>
1079///
1080/// ```json
1081///{
1082/// "description": "Present if the client supports sampling from an LLM.",
1083/// "type": "object",
1084/// "properties": {
1085/// "context": {
1086/// "description": "Whether the client supports context inclusion via includeContext parameter.\nIf not declared, servers SHOULD only use includeContext: \"none\" (or omit it).",
1087/// "$ref": "#/$defs/JSONObject"
1088/// },
1089/// "tools": {
1090/// "description": "Whether the client supports tool use via tools and toolChoice parameters.",
1091/// "$ref": "#/$defs/JSONObject"
1092/// }
1093/// }
1094///}
1095/// ```
1096/// </details>
1097#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
1098pub struct ClientSampling {
1099 /**Whether the client supports context inclusion via includeContext parameter.
1100 If not declared, servers SHOULD only use includeContext: "none" (or omit it).*/
1101 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1102 pub context: ::std::option::Option<JsonObject>,
1103 ///Whether the client supports tool use via tools and toolChoice parameters.
1104 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1105 pub tools: ::std::option::Option<JsonObject>,
1106}
1107///A request from the client to the server, to ask for completion options.
1108///
1109/// <details><summary>JSON schema</summary>
1110///
1111/// ```json
1112///{
1113/// "description": "A request from the client to the server, to ask for completion options.",
1114/// "type": "object",
1115/// "required": [
1116/// "id",
1117/// "jsonrpc",
1118/// "method",
1119/// "params"
1120/// ],
1121/// "properties": {
1122/// "id": {
1123/// "$ref": "#/$defs/RequestId"
1124/// },
1125/// "jsonrpc": {
1126/// "type": "string",
1127/// "const": "2.0"
1128/// },
1129/// "method": {
1130/// "type": "string",
1131/// "const": "completion/complete"
1132/// },
1133/// "params": {
1134/// "$ref": "#/$defs/CompleteRequestParams"
1135/// }
1136/// }
1137///}
1138/// ```
1139/// </details>
1140#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1141pub struct CompleteRequest {
1142 pub id: RequestId,
1143 #[serde(deserialize_with = "validate::complete_request_jsonrpc")]
1144 jsonrpc: ::std::string::String,
1145 #[serde(deserialize_with = "validate::complete_request_method")]
1146 method: ::std::string::String,
1147 pub params: CompleteRequestParams,
1148}
1149impl CompleteRequest {
1150 pub fn new(id: RequestId, params: CompleteRequestParams) -> Self {
1151 Self {
1152 id,
1153 jsonrpc: JSONRPC_VERSION.to_string(),
1154 method: "completion/complete".to_string(),
1155 params,
1156 }
1157 }
1158 pub fn jsonrpc(&self) -> &::std::string::String {
1159 &self.jsonrpc
1160 }
1161 pub fn method(&self) -> &::std::string::String {
1162 &self.method
1163 }
1164 /// returns "completion/complete"
1165 pub fn method_value() -> &'static str {
1166 "completion/complete"
1167 }
1168 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
1169 pub fn method_name() -> &'static str {
1170 "completion/complete"
1171 }
1172}
1173///The argument's information
1174///
1175/// <details><summary>JSON schema</summary>
1176///
1177/// ```json
1178///{
1179/// "description": "The argument's information",
1180/// "type": "object",
1181/// "required": [
1182/// "name",
1183/// "value"
1184/// ],
1185/// "properties": {
1186/// "name": {
1187/// "description": "The name of the argument",
1188/// "type": "string"
1189/// },
1190/// "value": {
1191/// "description": "The value of the argument to use for completion matching.",
1192/// "type": "string"
1193/// }
1194/// }
1195///}
1196/// ```
1197/// </details>
1198#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
1199pub struct CompleteRequestArgument {
1200 ///The name of the argument
1201 pub name: ::std::string::String,
1202 ///The value of the argument to use for completion matching.
1203 pub value: ::std::string::String,
1204}
1205///Additional, optional context for completions
1206///
1207/// <details><summary>JSON schema</summary>
1208///
1209/// ```json
1210///{
1211/// "description": "Additional, optional context for completions",
1212/// "type": "object",
1213/// "properties": {
1214/// "arguments": {
1215/// "description": "Previously-resolved variables in a URI template or prompt.",
1216/// "type": "object",
1217/// "additionalProperties": {
1218/// "type": "string"
1219/// }
1220/// }
1221/// }
1222///}
1223/// ```
1224/// </details>
1225#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
1226pub struct CompleteRequestContext {
1227 ///Previously-resolved variables in a URI template or prompt.
1228 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1229 pub arguments: ::std::option::Option<std::collections::BTreeMap<::std::string::String, ::std::string::String>>,
1230}
1231///Parameters for a completion/complete request.
1232///
1233/// <details><summary>JSON schema</summary>
1234///
1235/// ```json
1236///{
1237/// "description": "Parameters for a completion/complete request.",
1238/// "type": "object",
1239/// "required": [
1240/// "_meta",
1241/// "argument",
1242/// "ref"
1243/// ],
1244/// "properties": {
1245/// "_meta": {
1246/// "$ref": "#/$defs/RequestMetaObject"
1247/// },
1248/// "argument": {
1249/// "description": "The argument's information",
1250/// "type": "object",
1251/// "required": [
1252/// "name",
1253/// "value"
1254/// ],
1255/// "properties": {
1256/// "name": {
1257/// "description": "The name of the argument",
1258/// "type": "string"
1259/// },
1260/// "value": {
1261/// "description": "The value of the argument to use for completion matching.",
1262/// "type": "string"
1263/// }
1264/// }
1265/// },
1266/// "context": {
1267/// "description": "Additional, optional context for completions",
1268/// "type": "object",
1269/// "properties": {
1270/// "arguments": {
1271/// "description": "Previously-resolved variables in a URI template or prompt.",
1272/// "type": "object",
1273/// "additionalProperties": {
1274/// "type": "string"
1275/// }
1276/// }
1277/// }
1278/// },
1279/// "ref": {
1280/// "anyOf": [
1281/// {
1282/// "$ref": "#/$defs/PromptReference"
1283/// },
1284/// {
1285/// "$ref": "#/$defs/ResourceTemplateReference"
1286/// }
1287/// ]
1288/// }
1289/// }
1290///}
1291/// ```
1292/// </details>
1293#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1294pub struct CompleteRequestParams {
1295 pub argument: CompleteRequestArgument,
1296 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1297 pub context: ::std::option::Option<CompleteRequestContext>,
1298 #[serde(rename = "_meta")]
1299 pub meta: RequestMetaObject,
1300 #[serde(rename = "ref")]
1301 pub ref_: CompleteRequestRef,
1302}
1303///CompleteRequestRef
1304///
1305/// <details><summary>JSON schema</summary>
1306///
1307/// ```json
1308///{
1309/// "anyOf": [
1310/// {
1311/// "$ref": "#/$defs/PromptReference"
1312/// },
1313/// {
1314/// "$ref": "#/$defs/ResourceTemplateReference"
1315/// }
1316/// ]
1317///}
1318/// ```
1319/// </details>
1320#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1321#[serde(untagged)]
1322pub enum CompleteRequestRef {
1323 PromptReference(PromptReference),
1324 ResourceTemplateReference(ResourceTemplateReference),
1325}
1326impl ::std::convert::From<PromptReference> for CompleteRequestRef {
1327 fn from(value: PromptReference) -> Self {
1328 Self::PromptReference(value)
1329 }
1330}
1331impl ::std::convert::From<ResourceTemplateReference> for CompleteRequestRef {
1332 fn from(value: ResourceTemplateReference) -> Self {
1333 Self::ResourceTemplateReference(value)
1334 }
1335}
1336///The result returned by the server for a {@link CompleteRequestcompletion/complete} request.
1337///
1338/// <details><summary>JSON schema</summary>
1339///
1340/// ```json
1341///{
1342/// "description": "The result returned by the server for a {@link CompleteRequestcompletion/complete} request.",
1343/// "type": "object",
1344/// "required": [
1345/// "completion",
1346/// "resultType"
1347/// ],
1348/// "properties": {
1349/// "_meta": {
1350/// "$ref": "#/$defs/ResultMetaObject"
1351/// },
1352/// "completion": {
1353/// "type": "object",
1354/// "required": [
1355/// "values"
1356/// ],
1357/// "properties": {
1358/// "hasMore": {
1359/// "description": "Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.",
1360/// "type": "boolean"
1361/// },
1362/// "total": {
1363/// "description": "The total number of completion options available. This can exceed the number of values actually sent in the response.",
1364/// "type": "integer"
1365/// },
1366/// "values": {
1367/// "description": "An array of completion values. Must not exceed 100 items.",
1368/// "type": "array",
1369/// "items": {
1370/// "type": "string"
1371/// },
1372/// "maxItems": 100
1373/// }
1374/// }
1375/// },
1376/// "resultType": {
1377/// "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\".",
1378/// "type": "string"
1379/// }
1380/// }
1381///}
1382/// ```
1383/// </details>
1384#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1385pub struct CompleteResult {
1386 pub completion: CompleteResultCompletion,
1387 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
1388 pub meta: ::std::option::Option<ResultMetaObject>,
1389 /**Indicates the type of the result, which allows the client to determine
1390 how to parse the result object.
1391 Servers implementing this protocol version MUST include this field.
1392 For backward compatibility, when a client receives a result from a
1393 server implementing an earlier protocol version (which does not include
1394 resultType), the client MUST treat the absent field as "complete".*/
1395 #[serde(rename = "resultType")]
1396 pub result_type: ::std::string::String,
1397}
1398///CompleteResultCompletion
1399///
1400/// <details><summary>JSON schema</summary>
1401///
1402/// ```json
1403///{
1404/// "type": "object",
1405/// "required": [
1406/// "values"
1407/// ],
1408/// "properties": {
1409/// "hasMore": {
1410/// "description": "Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.",
1411/// "type": "boolean"
1412/// },
1413/// "total": {
1414/// "description": "The total number of completion options available. This can exceed the number of values actually sent in the response.",
1415/// "type": "integer"
1416/// },
1417/// "values": {
1418/// "description": "An array of completion values. Must not exceed 100 items.",
1419/// "type": "array",
1420/// "items": {
1421/// "type": "string"
1422/// },
1423/// "maxItems": 100
1424/// }
1425/// }
1426///}
1427/// ```
1428/// </details>
1429#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1430pub struct CompleteResultCompletion {
1431 ///Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
1432 #[serde(rename = "hasMore", default, skip_serializing_if = "::std::option::Option::is_none")]
1433 pub has_more: ::std::option::Option<bool>,
1434 ///The total number of completion options available. This can exceed the number of values actually sent in the response.
1435 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1436 pub total: ::std::option::Option<i64>,
1437 ///An array of completion values. Must not exceed 100 items.
1438 pub values: ::std::vec::Vec<::std::string::String>,
1439}
1440///A successful response from the server for a {@link CompleteRequestcompletion/complete} request.
1441///
1442/// <details><summary>JSON schema</summary>
1443///
1444/// ```json
1445///{
1446/// "description": "A successful response from the server for a {@link CompleteRequestcompletion/complete} request.",
1447/// "type": "object",
1448/// "required": [
1449/// "id",
1450/// "jsonrpc",
1451/// "result"
1452/// ],
1453/// "properties": {
1454/// "id": {
1455/// "$ref": "#/$defs/RequestId"
1456/// },
1457/// "jsonrpc": {
1458/// "type": "string",
1459/// "const": "2.0"
1460/// },
1461/// "result": {
1462/// "$ref": "#/$defs/CompleteResult"
1463/// }
1464/// }
1465///}
1466/// ```
1467/// </details>
1468#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1469pub struct CompleteResultResponse {
1470 pub id: RequestId,
1471 #[serde(deserialize_with = "validate::complete_result_response_jsonrpc")]
1472 jsonrpc: ::std::string::String,
1473 pub result: CompleteResult,
1474}
1475impl CompleteResultResponse {
1476 pub fn new(id: RequestId, result: CompleteResult) -> Self {
1477 Self {
1478 id,
1479 jsonrpc: JSONRPC_VERSION.to_string(),
1480 result,
1481 }
1482 }
1483 pub fn jsonrpc(&self) -> &::std::string::String {
1484 &self.jsonrpc
1485 }
1486}
1487///ContentBlock
1488///
1489/// <details><summary>JSON schema</summary>
1490///
1491/// ```json
1492///{
1493/// "anyOf": [
1494/// {
1495/// "$ref": "#/$defs/TextContent"
1496/// },
1497/// {
1498/// "$ref": "#/$defs/ImageContent"
1499/// },
1500/// {
1501/// "$ref": "#/$defs/AudioContent"
1502/// },
1503/// {
1504/// "$ref": "#/$defs/ResourceLink"
1505/// },
1506/// {
1507/// "$ref": "#/$defs/EmbeddedResource"
1508/// }
1509/// ]
1510///}
1511/// ```
1512/// </details>
1513#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1514#[serde(untagged)]
1515pub enum ContentBlock {
1516 TextContent(TextContent),
1517 ImageContent(ImageContent),
1518 AudioContent(AudioContent),
1519 ResourceLink(ResourceLink),
1520 EmbeddedResource(EmbeddedResource),
1521}
1522impl ::std::convert::From<TextContent> for ContentBlock {
1523 fn from(value: TextContent) -> Self {
1524 Self::TextContent(value)
1525 }
1526}
1527impl ::std::convert::From<ImageContent> for ContentBlock {
1528 fn from(value: ImageContent) -> Self {
1529 Self::ImageContent(value)
1530 }
1531}
1532impl ::std::convert::From<AudioContent> for ContentBlock {
1533 fn from(value: AudioContent) -> Self {
1534 Self::AudioContent(value)
1535 }
1536}
1537impl ::std::convert::From<ResourceLink> for ContentBlock {
1538 fn from(value: ResourceLink) -> Self {
1539 Self::ResourceLink(value)
1540 }
1541}
1542impl ::std::convert::From<EmbeddedResource> for ContentBlock {
1543 fn from(value: EmbeddedResource) -> Self {
1544 Self::EmbeddedResource(value)
1545 }
1546}
1547///CreateMessageContent
1548///
1549/// <details><summary>JSON schema</summary>
1550///
1551/// ```json
1552///{
1553/// "anyOf": [
1554/// {
1555/// "$ref": "#/$defs/TextContent"
1556/// },
1557/// {
1558/// "$ref": "#/$defs/ImageContent"
1559/// },
1560/// {
1561/// "$ref": "#/$defs/AudioContent"
1562/// },
1563/// {
1564/// "$ref": "#/$defs/ToolUseContent"
1565/// },
1566/// {
1567/// "$ref": "#/$defs/ToolResultContent"
1568/// },
1569/// {
1570/// "type": "array",
1571/// "items": {
1572/// "$ref": "#/$defs/SamplingMessageContentBlock"
1573/// }
1574/// }
1575/// ]
1576///}
1577/// ```
1578/// </details>
1579#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1580#[serde(untagged)]
1581pub enum CreateMessageContent {
1582 TextContent(TextContent),
1583 ImageContent(ImageContent),
1584 AudioContent(AudioContent),
1585 ToolUseContent(ToolUseContent),
1586 ToolResultContent(ToolResultContent),
1587 SamplingMessageContentBlock(::std::vec::Vec<SamplingMessageContentBlock>),
1588}
1589impl ::std::convert::From<TextContent> for CreateMessageContent {
1590 fn from(value: TextContent) -> Self {
1591 Self::TextContent(value)
1592 }
1593}
1594impl ::std::convert::From<ImageContent> for CreateMessageContent {
1595 fn from(value: ImageContent) -> Self {
1596 Self::ImageContent(value)
1597 }
1598}
1599impl ::std::convert::From<AudioContent> for CreateMessageContent {
1600 fn from(value: AudioContent) -> Self {
1601 Self::AudioContent(value)
1602 }
1603}
1604impl ::std::convert::From<ToolUseContent> for CreateMessageContent {
1605 fn from(value: ToolUseContent) -> Self {
1606 Self::ToolUseContent(value)
1607 }
1608}
1609impl ::std::convert::From<ToolResultContent> for CreateMessageContent {
1610 fn from(value: ToolResultContent) -> Self {
1611 Self::ToolResultContent(value)
1612 }
1613}
1614impl ::std::convert::From<::std::vec::Vec<SamplingMessageContentBlock>> for CreateMessageContent {
1615 fn from(value: ::std::vec::Vec<SamplingMessageContentBlock>) -> Self {
1616 Self::SamplingMessageContentBlock(value)
1617 }
1618}
1619///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.
1620///
1621/// <details><summary>JSON schema</summary>
1622///
1623/// ```json
1624///{
1625/// "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.",
1626/// "type": "object",
1627/// "required": [
1628/// "method",
1629/// "params"
1630/// ],
1631/// "properties": {
1632/// "method": {
1633/// "type": "string",
1634/// "const": "sampling/createMessage"
1635/// },
1636/// "params": {
1637/// "$ref": "#/$defs/CreateMessageRequestParams"
1638/// }
1639/// }
1640///}
1641/// ```
1642/// </details>
1643#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1644pub struct CreateMessageRequest {
1645 #[serde(deserialize_with = "validate::create_message_request_method")]
1646 method: ::std::string::String,
1647 pub params: CreateMessageRequestParams,
1648}
1649impl CreateMessageRequest {
1650 pub fn new(params: CreateMessageRequestParams) -> Self {
1651 Self {
1652 method: "sampling/createMessage".to_string(),
1653 params,
1654 }
1655 }
1656 pub fn method(&self) -> &::std::string::String {
1657 &self.method
1658 }
1659 /// returns "sampling/createMessage"
1660 pub fn method_value() -> &'static str {
1661 "sampling/createMessage"
1662 }
1663 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
1664 pub fn method_name() -> &'static str {
1665 "sampling/createMessage"
1666 }
1667}
1668///Parameters for a sampling/createMessage request.
1669///
1670/// <details><summary>JSON schema</summary>
1671///
1672/// ```json
1673///{
1674/// "description": "Parameters for a sampling/createMessage request.",
1675/// "type": "object",
1676/// "required": [
1677/// "maxTokens",
1678/// "messages"
1679/// ],
1680/// "properties": {
1681/// "includeContext": {
1682/// "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}.",
1683/// "type": "string",
1684/// "enum": [
1685/// "allServers",
1686/// "none",
1687/// "thisServer"
1688/// ]
1689/// },
1690/// "maxTokens": {
1691/// "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.",
1692/// "type": "integer"
1693/// },
1694/// "messages": {
1695/// "type": "array",
1696/// "items": {
1697/// "$ref": "#/$defs/SamplingMessage"
1698/// }
1699/// },
1700/// "metadata": {
1701/// "description": "Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.",
1702/// "$ref": "#/$defs/JSONObject"
1703/// },
1704/// "modelPreferences": {
1705/// "description": "The server's preferences for which model to select. The client MAY ignore these preferences.",
1706/// "$ref": "#/$defs/ModelPreferences"
1707/// },
1708/// "stopSequences": {
1709/// "type": "array",
1710/// "items": {
1711/// "type": "string"
1712/// }
1713/// },
1714/// "systemPrompt": {
1715/// "description": "An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.",
1716/// "type": "string"
1717/// },
1718/// "temperature": {
1719/// "type": "number"
1720/// },
1721/// "toolChoice": {
1722/// "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\" }.",
1723/// "$ref": "#/$defs/ToolChoice"
1724/// },
1725/// "tools": {
1726/// "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.",
1727/// "type": "array",
1728/// "items": {
1729/// "$ref": "#/$defs/Tool"
1730/// }
1731/// }
1732/// }
1733///}
1734/// ```
1735/// </details>
1736#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1737pub struct CreateMessageRequestParams {
1738 /**A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.
1739 The client MAY ignore this request.
1740 Default is "none". The values "thisServer" and "allServers" are deprecated (SEP-2596): servers SHOULD
1741 omit this field or use "none", and SHOULD only use the deprecated values if the client declares
1742 {@link ClientCapabilities.sampling.context}.*/
1743 #[serde(rename = "includeContext", default, skip_serializing_if = "::std::option::Option::is_none")]
1744 pub include_context: ::std::option::Option<IncludeContext>,
1745 /**The requested maximum number of tokens to sample (to prevent runaway completions).
1746 The client MAY choose to sample fewer tokens than the requested maximum.*/
1747 #[serde(rename = "maxTokens")]
1748 pub max_tokens: i64,
1749 pub messages: ::std::vec::Vec<SamplingMessage>,
1750 ///Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
1751 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1752 pub metadata: ::std::option::Option<JsonObject>,
1753 ///The server's preferences for which model to select. The client MAY ignore these preferences.
1754 #[serde(
1755 rename = "modelPreferences",
1756 default,
1757 skip_serializing_if = "::std::option::Option::is_none"
1758 )]
1759 pub model_preferences: ::std::option::Option<ModelPreferences>,
1760 #[serde(rename = "stopSequences", default, skip_serializing_if = "::std::vec::Vec::is_empty")]
1761 pub stop_sequences: ::std::vec::Vec<::std::string::String>,
1762 ///An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
1763 #[serde(rename = "systemPrompt", default, skip_serializing_if = "::std::option::Option::is_none")]
1764 pub system_prompt: ::std::option::Option<::std::string::String>,
1765 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1766 pub temperature: ::std::option::Option<f64>,
1767 /**Controls how the model uses tools.
1768 The client MUST return an error if this field is provided but {@link ClientCapabilities.sampling.tools} is not declared.
1769 Default is { mode: "auto" }.*/
1770 #[serde(rename = "toolChoice", default, skip_serializing_if = "::std::option::Option::is_none")]
1771 pub tool_choice: ::std::option::Option<ToolChoice>,
1772 /**Tools that the model may use during generation.
1773 The client MUST return an error if this field is provided but {@link ClientCapabilities.sampling.tools} is not declared.*/
1774 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
1775 pub tools: ::std::vec::Vec<Tool>,
1776}
1777/**The result returned by the client for a {@link CreateMessageRequestsampling/createMessage} request.
1778The client should inform the user before returning the sampled message, to allow them
1779to inspect the response (human in the loop) and decide whether to allow the server to see it.*/
1780///
1781/// <details><summary>JSON schema</summary>
1782///
1783/// ```json
1784///{
1785/// "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.",
1786/// "type": "object",
1787/// "required": [
1788/// "content",
1789/// "model",
1790/// "role"
1791/// ],
1792/// "properties": {
1793/// "_meta": {
1794/// "$ref": "#/$defs/MetaObject"
1795/// },
1796/// "content": {
1797/// "anyOf": [
1798/// {
1799/// "$ref": "#/$defs/TextContent"
1800/// },
1801/// {
1802/// "$ref": "#/$defs/ImageContent"
1803/// },
1804/// {
1805/// "$ref": "#/$defs/AudioContent"
1806/// },
1807/// {
1808/// "$ref": "#/$defs/ToolUseContent"
1809/// },
1810/// {
1811/// "$ref": "#/$defs/ToolResultContent"
1812/// },
1813/// {
1814/// "type": "array",
1815/// "items": {
1816/// "$ref": "#/$defs/SamplingMessageContentBlock"
1817/// }
1818/// }
1819/// ]
1820/// },
1821/// "model": {
1822/// "description": "The name of the model that generated the message.",
1823/// "type": "string"
1824/// },
1825/// "role": {
1826/// "$ref": "#/$defs/Role"
1827/// },
1828/// "stopReason": {
1829/// "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.",
1830/// "type": "string"
1831/// }
1832/// }
1833///}
1834/// ```
1835/// </details>
1836#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1837pub struct CreateMessageResult {
1838 pub content: CreateMessageContent,
1839 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
1840 pub meta: ::std::option::Option<MetaObject>,
1841 ///The name of the model that generated the message.
1842 pub model: ::std::string::String,
1843 pub role: Role,
1844 /**The reason why sampling stopped, if known.
1845 Standard values:
1846 - "endTurn": Natural end of the assistant's turn
1847 - "stopSequence": A stop sequence was encountered
1848 - "maxTokens": Maximum token limit was reached
1849 - "toolUse": The model wants to use one or more tools
1850 This field is an open string to allow for provider-specific stop reasons.*/
1851 #[serde(rename = "stopReason", default, skip_serializing_if = "::std::option::Option::is_none")]
1852 pub stop_reason: ::std::option::Option<::std::string::String>,
1853}
1854///An opaque token used to represent a cursor for pagination.
1855///
1856/// <details><summary>JSON schema</summary>
1857///
1858/// ```json
1859///{
1860/// "description": "An opaque token used to represent a cursor for pagination.",
1861/// "type": "string"
1862///}
1863/// ```
1864/// </details>
1865#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
1866#[serde(transparent)]
1867pub struct Cursor(pub ::std::string::String);
1868/**A request from the client asking the server to advertise its supported
1869protocol versions, capabilities, and other metadata. Servers **MUST**
1870implement server/discover. Clients **MAY** call it but are not required
1871to — version negotiation can also happen inline via per-request _meta.*/
1872///
1873/// <details><summary>JSON schema</summary>
1874///
1875/// ```json
1876///{
1877/// "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.",
1878/// "type": "object",
1879/// "required": [
1880/// "id",
1881/// "jsonrpc",
1882/// "method",
1883/// "params"
1884/// ],
1885/// "properties": {
1886/// "id": {
1887/// "$ref": "#/$defs/RequestId"
1888/// },
1889/// "jsonrpc": {
1890/// "type": "string",
1891/// "const": "2.0"
1892/// },
1893/// "method": {
1894/// "type": "string",
1895/// "const": "server/discover"
1896/// },
1897/// "params": {
1898/// "$ref": "#/$defs/RequestParams"
1899/// }
1900/// }
1901///}
1902/// ```
1903/// </details>
1904#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1905pub struct DiscoverRequest {
1906 pub id: RequestId,
1907 #[serde(deserialize_with = "validate::discover_request_jsonrpc")]
1908 jsonrpc: ::std::string::String,
1909 #[serde(deserialize_with = "validate::discover_request_method")]
1910 method: ::std::string::String,
1911 pub params: RequestParams,
1912}
1913impl DiscoverRequest {
1914 pub fn new(id: RequestId, params: RequestParams) -> Self {
1915 Self {
1916 id,
1917 jsonrpc: JSONRPC_VERSION.to_string(),
1918 method: "server/discover".to_string(),
1919 params,
1920 }
1921 }
1922 pub fn jsonrpc(&self) -> &::std::string::String {
1923 &self.jsonrpc
1924 }
1925 pub fn method(&self) -> &::std::string::String {
1926 &self.method
1927 }
1928 /// returns "server/discover"
1929 pub fn method_value() -> &'static str {
1930 "server/discover"
1931 }
1932 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
1933 pub fn method_name() -> &'static str {
1934 "server/discover"
1935 }
1936}
1937///The result returned by the server for a {@link DiscoverRequestserver/discover} request.
1938///
1939/// <details><summary>JSON schema</summary>
1940///
1941/// ```json
1942///{
1943/// "description": "The result returned by the server for a {@link DiscoverRequestserver/discover} request.",
1944/// "type": "object",
1945/// "required": [
1946/// "cacheScope",
1947/// "capabilities",
1948/// "resultType",
1949/// "supportedVersions",
1950/// "ttlMs"
1951/// ],
1952/// "properties": {
1953/// "_meta": {
1954/// "$ref": "#/$defs/ResultMetaObject"
1955/// },
1956/// "cacheScope": {
1957/// "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).",
1958/// "type": "string",
1959/// "enum": [
1960/// "private",
1961/// "public"
1962/// ]
1963/// },
1964/// "capabilities": {
1965/// "description": "The capabilities of the server.",
1966/// "$ref": "#/$defs/ServerCapabilities"
1967/// },
1968/// "instructions": {
1969/// "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.",
1970/// "type": "string"
1971/// },
1972/// "resultType": {
1973/// "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\".",
1974/// "type": "string"
1975/// },
1976/// "supportedVersions": {
1977/// "description": "MCP Protocol Versions this server supports. The client should choose a\nversion from this list for use in subsequent requests.",
1978/// "type": "array",
1979/// "items": {
1980/// "type": "string"
1981/// }
1982/// },
1983/// "ttlMs": {
1984/// "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.",
1985/// "type": "integer",
1986/// "minimum": 0.0
1987/// }
1988/// }
1989///}
1990/// ```
1991/// </details>
1992#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1993pub struct DiscoverResult {
1994 /**Indicates the intended scope of the cached response, analogous to HTTP
1995 Cache-Control: public vs Cache-Control: private.
1996 - "public": The response does not contain user-specific data. Any
1997 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
1998 the response and serve it across authorization contexts.
1999 - "private": The response MAY be cached and reused only within the
2000 same authorization context. Caches MUST NOT be shared across
2001 authorization contexts (e.g., a different access token requires a
2002 different cache).*/
2003 #[serde(rename = "cacheScope")]
2004 pub cache_scope: DiscoverResultCacheScope,
2005 ///The capabilities of the server.
2006 pub capabilities: ServerCapabilities,
2007 /**Natural-language guidance describing the server and its features.
2008 This can be used by clients to improve an LLM's understanding of
2009 available tools (e.g., by including it in a system prompt). It should
2010 focus on information that helps the model use the server effectively
2011 and should not duplicate information already in tool descriptions.*/
2012 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2013 pub instructions: ::std::option::Option<::std::string::String>,
2014 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
2015 pub meta: ::std::option::Option<ResultMetaObject>,
2016 /**Indicates the type of the result, which allows the client to determine
2017 how to parse the result object.
2018 Servers implementing this protocol version MUST include this field.
2019 For backward compatibility, when a client receives a result from a
2020 server implementing an earlier protocol version (which does not include
2021 resultType), the client MUST treat the absent field as "complete".*/
2022 #[serde(rename = "resultType")]
2023 pub result_type: ::std::string::String,
2024 /**MCP Protocol Versions this server supports. The client should choose a
2025 version from this list for use in subsequent requests.*/
2026 #[serde(rename = "supportedVersions")]
2027 pub supported_versions: ::std::vec::Vec<::std::string::String>,
2028 /**A hint from the server indicating how long (in milliseconds) the
2029 client MAY cache this response before re-fetching. Semantics are
2030 analogous to HTTP Cache-Control max-age.
2031 - If 0, The response SHOULD be considered immediately stale,
2032 The client MAY re-fetch every time the result is needed.
2033 - If positive, the client SHOULD consider the result fresh for this many
2034 milliseconds after receiving the response.*/
2035 #[serde(rename = "ttlMs")]
2036 pub ttl_ms: u64,
2037}
2038/**Indicates the intended scope of the cached response, analogous to HTTP
2039Cache-Control: public vs Cache-Control: private.
2040- "public": The response does not contain user-specific data. Any
2041 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
2042 the response and serve it across authorization contexts.
2043- "private": The response MAY be cached and reused only within the
2044 same authorization context. Caches MUST NOT be shared across
2045 authorization contexts (e.g., a different access token requires a
2046 different cache).*/
2047///
2048/// <details><summary>JSON schema</summary>
2049///
2050/// ```json
2051///{
2052/// "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).",
2053/// "type": "string",
2054/// "enum": [
2055/// "private",
2056/// "public"
2057/// ]
2058///}
2059/// ```
2060/// </details>
2061#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2062pub enum DiscoverResultCacheScope {
2063 #[serde(rename = "private")]
2064 Private,
2065 #[serde(rename = "public")]
2066 Public,
2067}
2068impl ::std::fmt::Display for DiscoverResultCacheScope {
2069 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2070 match *self {
2071 Self::Private => write!(f, "private"),
2072 Self::Public => write!(f, "public"),
2073 }
2074 }
2075}
2076///A successful response from the server for a {@link DiscoverRequestserver/discover} request.
2077///
2078/// <details><summary>JSON schema</summary>
2079///
2080/// ```json
2081///{
2082/// "description": "A successful response from the server for a {@link DiscoverRequestserver/discover} request.",
2083/// "type": "object",
2084/// "required": [
2085/// "id",
2086/// "jsonrpc",
2087/// "result"
2088/// ],
2089/// "properties": {
2090/// "id": {
2091/// "$ref": "#/$defs/RequestId"
2092/// },
2093/// "jsonrpc": {
2094/// "type": "string",
2095/// "const": "2.0"
2096/// },
2097/// "result": {
2098/// "$ref": "#/$defs/DiscoverResult"
2099/// }
2100/// }
2101///}
2102/// ```
2103/// </details>
2104#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2105pub struct DiscoverResultResponse {
2106 pub id: RequestId,
2107 #[serde(deserialize_with = "validate::discover_result_response_jsonrpc")]
2108 jsonrpc: ::std::string::String,
2109 pub result: DiscoverResult,
2110}
2111impl DiscoverResultResponse {
2112 pub fn new(id: RequestId, result: DiscoverResult) -> Self {
2113 Self {
2114 id,
2115 jsonrpc: JSONRPC_VERSION.to_string(),
2116 result,
2117 }
2118 }
2119 pub fn jsonrpc(&self) -> &::std::string::String {
2120 &self.jsonrpc
2121 }
2122}
2123///A request from the server to elicit additional information from the user via the client.
2124///
2125/// <details><summary>JSON schema</summary>
2126///
2127/// ```json
2128///{
2129/// "description": "A request from the server to elicit additional information from the user via the client.",
2130/// "type": "object",
2131/// "required": [
2132/// "method",
2133/// "params"
2134/// ],
2135/// "properties": {
2136/// "method": {
2137/// "type": "string",
2138/// "const": "elicitation/create"
2139/// },
2140/// "params": {
2141/// "$ref": "#/$defs/ElicitRequestParams"
2142/// }
2143/// }
2144///}
2145/// ```
2146/// </details>
2147#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2148pub struct ElicitRequest {
2149 #[serde(deserialize_with = "validate::elicit_request_method")]
2150 method: ::std::string::String,
2151 pub params: ElicitRequestParams,
2152}
2153impl ElicitRequest {
2154 pub fn new(params: ElicitRequestParams) -> Self {
2155 Self {
2156 method: "elicitation/create".to_string(),
2157 params,
2158 }
2159 }
2160 pub fn method(&self) -> &::std::string::String {
2161 &self.method
2162 }
2163 /// returns "elicitation/create"
2164 pub fn method_value() -> &'static str {
2165 "elicitation/create"
2166 }
2167 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
2168 pub fn method_name() -> &'static str {
2169 "elicitation/create"
2170 }
2171}
2172///The parameters for a request to elicit non-sensitive information from the user via a form in the client.
2173///
2174/// <details><summary>JSON schema</summary>
2175///
2176/// ```json
2177///{
2178/// "description": "The parameters for a request to elicit non-sensitive information from the user via a form in the client.",
2179/// "type": "object",
2180/// "required": [
2181/// "message",
2182/// "requestedSchema"
2183/// ],
2184/// "properties": {
2185/// "message": {
2186/// "description": "The message to present to the user describing what information is being requested.",
2187/// "type": "string"
2188/// },
2189/// "mode": {
2190/// "description": "The elicitation mode.",
2191/// "type": "string",
2192/// "const": "form"
2193/// },
2194/// "requestedSchema": {
2195/// "description": "A restricted subset of JSON Schema.\nOnly top-level properties are allowed, without nesting.",
2196/// "type": "object",
2197/// "required": [
2198/// "properties",
2199/// "type"
2200/// ],
2201/// "properties": {
2202/// "$schema": {
2203/// "type": "string"
2204/// },
2205/// "properties": {
2206/// "type": "object",
2207/// "additionalProperties": {
2208/// "$ref": "#/$defs/PrimitiveSchemaDefinition"
2209/// }
2210/// },
2211/// "required": {
2212/// "type": "array",
2213/// "items": {
2214/// "type": "string"
2215/// }
2216/// },
2217/// "type": {
2218/// "type": "string",
2219/// "const": "object"
2220/// }
2221/// }
2222/// }
2223/// }
2224///}
2225/// ```
2226/// </details>
2227#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2228pub struct ElicitRequestFormParams {
2229 ///The message to present to the user describing what information is being requested.
2230 pub message: ::std::string::String,
2231 ///The elicitation mode.
2232 #[serde(
2233 default,
2234 skip_serializing_if = "::std::option::Option::is_none",
2235 deserialize_with = "validate::elicit_request_form_params_mode"
2236 )]
2237 mode: ::std::option::Option<::std::string::String>,
2238 #[serde(rename = "requestedSchema")]
2239 pub requested_schema: ElicitRequestFormParamsRequestedSchema,
2240}
2241impl ElicitRequestFormParams {
2242 pub fn new(message: ::std::string::String, requested_schema: ElicitRequestFormParamsRequestedSchema) -> Self {
2243 Self {
2244 message,
2245 mode: Some("form".to_string()),
2246 requested_schema,
2247 }
2248 }
2249 pub fn mode(&self) -> &::std::option::Option<::std::string::String> {
2250 &self.mode
2251 }
2252 /// returns "form"
2253 pub fn mode_value() -> &'static str {
2254 "form"
2255 }
2256 #[deprecated(since = "0.8.0", note = "Use `mode_value()` instead.")]
2257 pub fn mode_name() -> &'static str {
2258 "form"
2259 }
2260}
2261/**A restricted subset of JSON Schema.
2262Only top-level properties are allowed, without nesting.*/
2263///
2264/// <details><summary>JSON schema</summary>
2265///
2266/// ```json
2267///{
2268/// "description": "A restricted subset of JSON Schema.\nOnly top-level properties are allowed, without nesting.",
2269/// "type": "object",
2270/// "required": [
2271/// "properties",
2272/// "type"
2273/// ],
2274/// "properties": {
2275/// "$schema": {
2276/// "type": "string"
2277/// },
2278/// "properties": {
2279/// "type": "object",
2280/// "additionalProperties": {
2281/// "$ref": "#/$defs/PrimitiveSchemaDefinition"
2282/// }
2283/// },
2284/// "required": {
2285/// "type": "array",
2286/// "items": {
2287/// "type": "string"
2288/// }
2289/// },
2290/// "type": {
2291/// "type": "string",
2292/// "const": "object"
2293/// }
2294/// }
2295///}
2296/// ```
2297/// </details>
2298#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2299pub struct ElicitRequestFormParamsRequestedSchema {
2300 pub properties: std::collections::BTreeMap<::std::string::String, PrimitiveSchemaDefinition>,
2301 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
2302 pub required: ::std::vec::Vec<::std::string::String>,
2303 #[serde(rename = "$schema", default, skip_serializing_if = "::std::option::Option::is_none")]
2304 pub schema: ::std::option::Option<::std::string::String>,
2305 #[serde(
2306 rename = "type",
2307 deserialize_with = "validate::elicit_request_form_params_requested_schema_type_"
2308 )]
2309 type_: ::std::string::String,
2310}
2311impl ElicitRequestFormParamsRequestedSchema {
2312 pub fn new(
2313 properties: std::collections::BTreeMap<::std::string::String, PrimitiveSchemaDefinition>,
2314 required: ::std::vec::Vec<::std::string::String>,
2315 schema: ::std::option::Option<::std::string::String>,
2316 ) -> Self {
2317 Self {
2318 properties,
2319 required,
2320 schema,
2321 type_: "object".to_string(),
2322 }
2323 }
2324 pub fn type_(&self) -> &::std::string::String {
2325 &self.type_
2326 }
2327 /// returns "object"
2328 pub fn type_value() -> &'static str {
2329 "object"
2330 }
2331 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
2332 pub fn type_name() -> &'static str {
2333 "object"
2334 }
2335}
2336///The parameters for a request to elicit additional information from the user via the client.
2337///
2338/// <details><summary>JSON schema</summary>
2339///
2340/// ```json
2341///{
2342/// "description": "The parameters for a request to elicit additional information from the user via the client.",
2343/// "anyOf": [
2344/// {
2345/// "$ref": "#/$defs/ElicitRequestFormParams"
2346/// },
2347/// {
2348/// "$ref": "#/$defs/ElicitRequestURLParams"
2349/// }
2350/// ]
2351///}
2352/// ```
2353/// </details>
2354#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2355#[serde(untagged)]
2356pub enum ElicitRequestParams {
2357 FormParams(ElicitRequestFormParams),
2358 UrlParams(ElicitRequestUrlParams),
2359}
2360impl ::std::convert::From<ElicitRequestFormParams> for ElicitRequestParams {
2361 fn from(value: ElicitRequestFormParams) -> Self {
2362 Self::FormParams(value)
2363 }
2364}
2365impl ::std::convert::From<ElicitRequestUrlParams> for ElicitRequestParams {
2366 fn from(value: ElicitRequestUrlParams) -> Self {
2367 Self::UrlParams(value)
2368 }
2369}
2370///The parameters for a request to elicit information from the user via a URL in the client.
2371///
2372/// <details><summary>JSON schema</summary>
2373///
2374/// ```json
2375///{
2376/// "description": "The parameters for a request to elicit information from the user via a URL in the client.",
2377/// "type": "object",
2378/// "required": [
2379/// "message",
2380/// "mode",
2381/// "url"
2382/// ],
2383/// "properties": {
2384/// "message": {
2385/// "description": "The message to present to the user explaining why the interaction is needed.",
2386/// "type": "string"
2387/// },
2388/// "mode": {
2389/// "description": "The elicitation mode.",
2390/// "type": "string",
2391/// "const": "url"
2392/// },
2393/// "url": {
2394/// "description": "The URL that the user should navigate to.",
2395/// "type": "string",
2396/// "format": "uri"
2397/// }
2398/// }
2399///}
2400/// ```
2401/// </details>
2402#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2403pub struct ElicitRequestUrlParams {
2404 ///The message to present to the user explaining why the interaction is needed.
2405 pub message: ::std::string::String,
2406 ///The elicitation mode.
2407 #[serde(deserialize_with = "validate::elicit_request_url_params_mode")]
2408 mode: ::std::string::String,
2409 ///The URL that the user should navigate to.
2410 pub url: ::std::string::String,
2411}
2412impl ElicitRequestUrlParams {
2413 pub fn new(message: ::std::string::String, url: ::std::string::String) -> Self {
2414 Self {
2415 message,
2416 mode: "url".to_string(),
2417 url,
2418 }
2419 }
2420 pub fn mode(&self) -> &::std::string::String {
2421 &self.mode
2422 }
2423 /// returns "url"
2424 pub fn mode_value() -> &'static str {
2425 "url"
2426 }
2427 #[deprecated(since = "0.8.0", note = "Use `mode_value()` instead.")]
2428 pub fn mode_name() -> &'static str {
2429 "url"
2430 }
2431}
2432///The result returned by the client for an {@link ElicitRequestelicitation/create} request.
2433///
2434/// <details><summary>JSON schema</summary>
2435///
2436/// ```json
2437///{
2438/// "description": "The result returned by the client for an {@link ElicitRequestelicitation/create} request.",
2439/// "type": "object",
2440/// "required": [
2441/// "action"
2442/// ],
2443/// "properties": {
2444/// "action": {
2445/// "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",
2446/// "type": "string",
2447/// "enum": [
2448/// "accept",
2449/// "cancel",
2450/// "decline"
2451/// ]
2452/// },
2453/// "content": {
2454/// "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.",
2455/// "type": "object",
2456/// "additionalProperties": {
2457/// "anyOf": [
2458/// {
2459/// "type": "array",
2460/// "items": {
2461/// "type": "string"
2462/// }
2463/// },
2464/// {
2465/// "type": [
2466/// "string",
2467/// "integer",
2468/// "boolean"
2469/// ]
2470/// }
2471/// ]
2472/// }
2473/// }
2474/// }
2475///}
2476/// ```
2477/// </details>
2478#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2479pub struct ElicitResult {
2480 /**The user action in response to the elicitation.
2481 - "accept": User submitted the form/confirmed the action
2482 - "decline": User explicitly declined the action
2483 - "cancel": User dismissed without making an explicit choice*/
2484 pub action: ElicitResultAction,
2485 /**The submitted form data, only present when action is "accept" and mode was "form".
2486 Contains values matching the requested schema.
2487 Omitted for out-of-band mode responses.*/
2488 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2489 pub content: ::std::option::Option<std::collections::BTreeMap<::std::string::String, ElicitResultContent>>,
2490}
2491/**The user action in response to the elicitation.
2492- "accept": User submitted the form/confirmed the action
2493- "decline": User explicitly declined the action
2494- "cancel": User dismissed without making an explicit choice*/
2495///
2496/// <details><summary>JSON schema</summary>
2497///
2498/// ```json
2499///{
2500/// "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",
2501/// "type": "string",
2502/// "enum": [
2503/// "accept",
2504/// "cancel",
2505/// "decline"
2506/// ]
2507///}
2508/// ```
2509/// </details>
2510#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2511pub enum ElicitResultAction {
2512 #[serde(rename = "accept")]
2513 Accept,
2514 #[serde(rename = "cancel")]
2515 Cancel,
2516 #[serde(rename = "decline")]
2517 Decline,
2518}
2519impl ::std::fmt::Display for ElicitResultAction {
2520 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2521 match *self {
2522 Self::Accept => write!(f, "accept"),
2523 Self::Cancel => write!(f, "cancel"),
2524 Self::Decline => write!(f, "decline"),
2525 }
2526 }
2527}
2528///ElicitResultContent
2529///
2530/// <details><summary>JSON schema</summary>
2531///
2532/// ```json
2533///{
2534/// "anyOf": [
2535/// {
2536/// "type": "array",
2537/// "items": {
2538/// "type": "string"
2539/// }
2540/// },
2541/// {
2542/// "type": [
2543/// "string",
2544/// "integer",
2545/// "boolean"
2546/// ]
2547/// }
2548/// ]
2549///}
2550/// ```
2551/// </details>
2552#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2553#[serde(untagged)]
2554pub enum ElicitResultContent {
2555 StringArray(::std::vec::Vec<::std::string::String>),
2556 Primitive(ElicitResultContentPrimitive),
2557}
2558impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for ElicitResultContent {
2559 fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
2560 Self::StringArray(value)
2561 }
2562}
2563impl ::std::convert::From<ElicitResultContentPrimitive> for ElicitResultContent {
2564 fn from(value: ElicitResultContentPrimitive) -> Self {
2565 Self::Primitive(value)
2566 }
2567}
2568///ElicitResultContentPrimitive
2569///
2570/// <details><summary>JSON schema</summary>
2571///
2572/// ```json
2573///{
2574/// "type": [
2575/// "string",
2576/// "integer",
2577/// "boolean"
2578/// ]
2579///}
2580/// ```
2581/// </details>
2582#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2583#[serde(untagged)]
2584pub enum ElicitResultContentPrimitive {
2585 Boolean(bool),
2586 String(::std::string::String),
2587 Integer(i64),
2588}
2589impl ::std::convert::From<bool> for ElicitResultContentPrimitive {
2590 fn from(value: bool) -> Self {
2591 Self::Boolean(value)
2592 }
2593}
2594impl ::std::convert::From<i64> for ElicitResultContentPrimitive {
2595 fn from(value: i64) -> Self {
2596 Self::Integer(value)
2597 }
2598}
2599/**The contents of a resource, embedded into a prompt or tool call result.
2600It is up to the client how best to render embedded resources for the benefit
2601of the LLM and/or the user.*/
2602///
2603/// <details><summary>JSON schema</summary>
2604///
2605/// ```json
2606///{
2607/// "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.",
2608/// "type": "object",
2609/// "required": [
2610/// "resource",
2611/// "type"
2612/// ],
2613/// "properties": {
2614/// "_meta": {
2615/// "$ref": "#/$defs/MetaObject"
2616/// },
2617/// "annotations": {
2618/// "description": "Optional annotations for the client.",
2619/// "$ref": "#/$defs/Annotations"
2620/// },
2621/// "resource": {
2622/// "anyOf": [
2623/// {
2624/// "$ref": "#/$defs/TextResourceContents"
2625/// },
2626/// {
2627/// "$ref": "#/$defs/BlobResourceContents"
2628/// }
2629/// ]
2630/// },
2631/// "type": {
2632/// "type": "string",
2633/// "const": "resource"
2634/// }
2635/// }
2636///}
2637/// ```
2638/// </details>
2639#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2640pub struct EmbeddedResource {
2641 ///Optional annotations for the client.
2642 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2643 pub annotations: ::std::option::Option<Annotations>,
2644 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
2645 pub meta: ::std::option::Option<MetaObject>,
2646 pub resource: EmbeddedResourceResource,
2647 #[serde(rename = "type", deserialize_with = "validate::embedded_resource_type_")]
2648 type_: ::std::string::String,
2649}
2650impl EmbeddedResource {
2651 pub fn new(
2652 resource: EmbeddedResourceResource,
2653 annotations: ::std::option::Option<Annotations>,
2654 meta: ::std::option::Option<MetaObject>,
2655 ) -> Self {
2656 Self {
2657 annotations,
2658 meta,
2659 resource,
2660 type_: "resource".to_string(),
2661 }
2662 }
2663 pub fn type_(&self) -> &::std::string::String {
2664 &self.type_
2665 }
2666 /// returns "resource"
2667 pub fn type_value() -> &'static str {
2668 "resource"
2669 }
2670 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
2671 pub fn type_name() -> &'static str {
2672 "resource"
2673 }
2674}
2675///EmbeddedResourceResource
2676///
2677/// <details><summary>JSON schema</summary>
2678///
2679/// ```json
2680///{
2681/// "anyOf": [
2682/// {
2683/// "$ref": "#/$defs/TextResourceContents"
2684/// },
2685/// {
2686/// "$ref": "#/$defs/BlobResourceContents"
2687/// }
2688/// ]
2689///}
2690/// ```
2691/// </details>
2692#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2693#[serde(untagged)]
2694pub enum EmbeddedResourceResource {
2695 TextResourceContents(TextResourceContents),
2696 BlobResourceContents(BlobResourceContents),
2697}
2698impl ::std::convert::From<TextResourceContents> for EmbeddedResourceResource {
2699 fn from(value: TextResourceContents) -> Self {
2700 Self::TextResourceContents(value)
2701 }
2702}
2703impl ::std::convert::From<BlobResourceContents> for EmbeddedResourceResource {
2704 fn from(value: BlobResourceContents) -> Self {
2705 Self::BlobResourceContents(value)
2706 }
2707}
2708///Common result fields.
2709///
2710/// <details><summary>JSON schema</summary>
2711///
2712/// ```json
2713///{
2714/// "description": "Common result fields.",
2715/// "$ref": "#/$defs/Result"
2716///}
2717/// ```
2718/// </details>
2719#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
2720#[serde(transparent)]
2721pub struct EmptyResult(pub Result);
2722///EnumSchema
2723///
2724/// <details><summary>JSON schema</summary>
2725///
2726/// ```json
2727///{
2728/// "anyOf": [
2729/// {
2730/// "$ref": "#/$defs/UntitledSingleSelectEnumSchema"
2731/// },
2732/// {
2733/// "$ref": "#/$defs/TitledSingleSelectEnumSchema"
2734/// },
2735/// {
2736/// "$ref": "#/$defs/UntitledMultiSelectEnumSchema"
2737/// },
2738/// {
2739/// "$ref": "#/$defs/TitledMultiSelectEnumSchema"
2740/// },
2741/// {
2742/// "$ref": "#/$defs/LegacyTitledEnumSchema"
2743/// }
2744/// ]
2745///}
2746/// ```
2747/// </details>
2748#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2749#[serde(untagged)]
2750pub enum EnumSchema {
2751 UntitledSingleSelectEnumSchema(UntitledSingleSelectEnumSchema),
2752 TitledSingleSelectEnumSchema(TitledSingleSelectEnumSchema),
2753 UntitledMultiSelectEnumSchema(UntitledMultiSelectEnumSchema),
2754 TitledMultiSelectEnumSchema(TitledMultiSelectEnumSchema),
2755 LegacyTitledEnumSchema(LegacyTitledEnumSchema),
2756}
2757impl ::std::convert::From<UntitledSingleSelectEnumSchema> for EnumSchema {
2758 fn from(value: UntitledSingleSelectEnumSchema) -> Self {
2759 Self::UntitledSingleSelectEnumSchema(value)
2760 }
2761}
2762impl ::std::convert::From<TitledSingleSelectEnumSchema> for EnumSchema {
2763 fn from(value: TitledSingleSelectEnumSchema) -> Self {
2764 Self::TitledSingleSelectEnumSchema(value)
2765 }
2766}
2767impl ::std::convert::From<UntitledMultiSelectEnumSchema> for EnumSchema {
2768 fn from(value: UntitledMultiSelectEnumSchema) -> Self {
2769 Self::UntitledMultiSelectEnumSchema(value)
2770 }
2771}
2772impl ::std::convert::From<TitledMultiSelectEnumSchema> for EnumSchema {
2773 fn from(value: TitledMultiSelectEnumSchema) -> Self {
2774 Self::TitledMultiSelectEnumSchema(value)
2775 }
2776}
2777impl ::std::convert::From<LegacyTitledEnumSchema> for EnumSchema {
2778 fn from(value: LegacyTitledEnumSchema) -> Self {
2779 Self::LegacyTitledEnumSchema(value)
2780 }
2781}
2782///Used by the client to get a prompt provided by the server.
2783///
2784/// <details><summary>JSON schema</summary>
2785///
2786/// ```json
2787///{
2788/// "description": "Used by the client to get a prompt provided by the server.",
2789/// "type": "object",
2790/// "required": [
2791/// "id",
2792/// "jsonrpc",
2793/// "method",
2794/// "params"
2795/// ],
2796/// "properties": {
2797/// "id": {
2798/// "$ref": "#/$defs/RequestId"
2799/// },
2800/// "jsonrpc": {
2801/// "type": "string",
2802/// "const": "2.0"
2803/// },
2804/// "method": {
2805/// "type": "string",
2806/// "const": "prompts/get"
2807/// },
2808/// "params": {
2809/// "$ref": "#/$defs/GetPromptRequestParams"
2810/// }
2811/// }
2812///}
2813/// ```
2814/// </details>
2815#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2816pub struct GetPromptRequest {
2817 pub id: RequestId,
2818 #[serde(deserialize_with = "validate::get_prompt_request_jsonrpc")]
2819 jsonrpc: ::std::string::String,
2820 #[serde(deserialize_with = "validate::get_prompt_request_method")]
2821 method: ::std::string::String,
2822 pub params: GetPromptRequestParams,
2823}
2824impl GetPromptRequest {
2825 pub fn new(id: RequestId, params: GetPromptRequestParams) -> Self {
2826 Self {
2827 id,
2828 jsonrpc: JSONRPC_VERSION.to_string(),
2829 method: "prompts/get".to_string(),
2830 params,
2831 }
2832 }
2833 pub fn jsonrpc(&self) -> &::std::string::String {
2834 &self.jsonrpc
2835 }
2836 pub fn method(&self) -> &::std::string::String {
2837 &self.method
2838 }
2839 /// returns "prompts/get"
2840 pub fn method_value() -> &'static str {
2841 "prompts/get"
2842 }
2843 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
2844 pub fn method_name() -> &'static str {
2845 "prompts/get"
2846 }
2847}
2848///Parameters for a prompts/get request.
2849///
2850/// <details><summary>JSON schema</summary>
2851///
2852/// ```json
2853///{
2854/// "description": "Parameters for a prompts/get request.",
2855/// "type": "object",
2856/// "required": [
2857/// "_meta",
2858/// "name"
2859/// ],
2860/// "properties": {
2861/// "_meta": {
2862/// "$ref": "#/$defs/RequestMetaObject"
2863/// },
2864/// "arguments": {
2865/// "description": "Arguments to use for templating the prompt.",
2866/// "type": "object",
2867/// "additionalProperties": {
2868/// "type": "string"
2869/// }
2870/// },
2871/// "inputResponses": {
2872/// "$ref": "#/$defs/InputResponses"
2873/// },
2874/// "name": {
2875/// "description": "The name of the prompt or prompt template.",
2876/// "type": "string"
2877/// },
2878/// "requestState": {
2879/// "type": "string"
2880/// }
2881/// }
2882///}
2883/// ```
2884/// </details>
2885#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2886pub struct GetPromptRequestParams {
2887 ///Arguments to use for templating the prompt.
2888 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2889 pub arguments: ::std::option::Option<std::collections::BTreeMap<::std::string::String, ::std::string::String>>,
2890 #[serde(rename = "inputResponses", default, skip_serializing_if = "::std::option::Option::is_none")]
2891 pub input_responses: ::std::option::Option<InputResponses>,
2892 #[serde(rename = "_meta")]
2893 pub meta: RequestMetaObject,
2894 ///The name of the prompt or prompt template.
2895 pub name: ::std::string::String,
2896 #[serde(rename = "requestState", default, skip_serializing_if = "::std::option::Option::is_none")]
2897 pub request_state: ::std::option::Option<::std::string::String>,
2898}
2899///The result returned by the server for a {@link GetPromptRequestprompts/get} request.
2900///
2901/// <details><summary>JSON schema</summary>
2902///
2903/// ```json
2904///{
2905/// "description": "The result returned by the server for a {@link GetPromptRequestprompts/get} request.",
2906/// "type": "object",
2907/// "required": [
2908/// "messages",
2909/// "resultType"
2910/// ],
2911/// "properties": {
2912/// "_meta": {
2913/// "$ref": "#/$defs/ResultMetaObject"
2914/// },
2915/// "description": {
2916/// "description": "An optional description for the prompt.",
2917/// "type": "string"
2918/// },
2919/// "messages": {
2920/// "type": "array",
2921/// "items": {
2922/// "$ref": "#/$defs/PromptMessage"
2923/// }
2924/// },
2925/// "resultType": {
2926/// "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\".",
2927/// "type": "string"
2928/// }
2929/// }
2930///}
2931/// ```
2932/// </details>
2933#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2934pub struct GetPromptResult {
2935 ///An optional description for the prompt.
2936 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2937 pub description: ::std::option::Option<::std::string::String>,
2938 pub messages: ::std::vec::Vec<PromptMessage>,
2939 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
2940 pub meta: ::std::option::Option<ResultMetaObject>,
2941 /**Indicates the type of the result, which allows the client to determine
2942 how to parse the result object.
2943 Servers implementing this protocol version MUST include this field.
2944 For backward compatibility, when a client receives a result from a
2945 server implementing an earlier protocol version (which does not include
2946 resultType), the client MUST treat the absent field as "complete".*/
2947 #[serde(rename = "resultType")]
2948 pub result_type: ::std::string::String,
2949}
2950///A successful response from the server for a {@link GetPromptRequestprompts/get} request.
2951///
2952/// <details><summary>JSON schema</summary>
2953///
2954/// ```json
2955///{
2956/// "description": "A successful response from the server for a {@link GetPromptRequestprompts/get} request.",
2957/// "type": "object",
2958/// "required": [
2959/// "id",
2960/// "jsonrpc",
2961/// "result"
2962/// ],
2963/// "properties": {
2964/// "id": {
2965/// "$ref": "#/$defs/RequestId"
2966/// },
2967/// "jsonrpc": {
2968/// "type": "string",
2969/// "const": "2.0"
2970/// },
2971/// "result": {
2972/// "anyOf": [
2973/// {
2974/// "$ref": "#/$defs/InputRequiredResult"
2975/// },
2976/// {
2977/// "$ref": "#/$defs/GetPromptResult"
2978/// }
2979/// ]
2980/// }
2981/// }
2982///}
2983/// ```
2984/// </details>
2985#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2986pub struct GetPromptResultResponse {
2987 pub id: RequestId,
2988 #[serde(deserialize_with = "validate::get_prompt_result_response_jsonrpc")]
2989 jsonrpc: ::std::string::String,
2990 pub result: GetPromptResultResponseResult,
2991}
2992impl GetPromptResultResponse {
2993 pub fn new(id: RequestId, result: GetPromptResultResponseResult) -> Self {
2994 Self {
2995 id,
2996 jsonrpc: JSONRPC_VERSION.to_string(),
2997 result,
2998 }
2999 }
3000 pub fn jsonrpc(&self) -> &::std::string::String {
3001 &self.jsonrpc
3002 }
3003}
3004///GetPromptResultResponseResult
3005///
3006/// <details><summary>JSON schema</summary>
3007///
3008/// ```json
3009///{
3010/// "anyOf": [
3011/// {
3012/// "$ref": "#/$defs/InputRequiredResult"
3013/// },
3014/// {
3015/// "$ref": "#/$defs/GetPromptResult"
3016/// }
3017/// ]
3018///}
3019/// ```
3020/// </details>
3021#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3022#[serde(untagged)]
3023pub enum GetPromptResultResponseResult {
3024 InputRequiredResult(InputRequiredResult),
3025 GetPromptResult(GetPromptResult),
3026}
3027impl ::std::convert::From<InputRequiredResult> for GetPromptResultResponseResult {
3028 fn from(value: InputRequiredResult) -> Self {
3029 Self::InputRequiredResult(value)
3030 }
3031}
3032impl ::std::convert::From<GetPromptResult> for GetPromptResultResponseResult {
3033 fn from(value: GetPromptResult) -> Self {
3034 Self::GetPromptResult(value)
3035 }
3036}
3037/**Returned when a server rejects a request because the values in the HTTP
3038headers do not match the corresponding values in the request body, or
3039because required headers are missing or malformed. For HTTP, the response
3040status code MUST be 400 Bad Request.*/
3041///
3042/// <details><summary>JSON schema</summary>
3043///
3044/// ```json
3045///{
3046/// "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.",
3047/// "type": "object",
3048/// "required": [
3049/// "error",
3050/// "jsonrpc"
3051/// ],
3052/// "properties": {
3053/// "error": {
3054/// "allOf": [
3055/// {
3056/// "$ref": "#/$defs/Error"
3057/// },
3058/// {
3059/// "type": "object",
3060/// "required": [
3061/// "code"
3062/// ],
3063/// "properties": {
3064/// "code": {
3065/// "type": "integer"
3066/// }
3067/// }
3068/// }
3069/// ]
3070/// },
3071/// "id": {
3072/// "$ref": "#/$defs/RequestId"
3073/// },
3074/// "jsonrpc": {
3075/// "type": "string",
3076/// "const": "2.0"
3077/// }
3078/// }
3079///}
3080/// ```
3081/// </details>
3082#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3083pub struct HeaderMismatchError {
3084 pub error: RpcError,
3085 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3086 pub id: ::std::option::Option<RequestId>,
3087 #[serde(deserialize_with = "validate::header_mismatch_error_jsonrpc")]
3088 jsonrpc: ::std::string::String,
3089}
3090impl HeaderMismatchError {
3091 pub fn new(error: RpcError, id: ::std::option::Option<RequestId>) -> Self {
3092 Self {
3093 error,
3094 id,
3095 jsonrpc: JSONRPC_VERSION.to_string(),
3096 }
3097 }
3098 pub fn jsonrpc(&self) -> &::std::string::String {
3099 &self.jsonrpc
3100 }
3101}
3102///An optionally-sized icon that can be displayed in a user interface.
3103///
3104/// <details><summary>JSON schema</summary>
3105///
3106/// ```json
3107///{
3108/// "description": "An optionally-sized icon that can be displayed in a user interface.",
3109/// "type": "object",
3110/// "required": [
3111/// "src"
3112/// ],
3113/// "properties": {
3114/// "mimeType": {
3115/// "description": "Optional MIME type override if the source MIME type is missing or generic.\nFor example: \"image/png\", \"image/jpeg\", or \"image/svg+xml\".",
3116/// "type": "string"
3117/// },
3118/// "sizes": {
3119/// "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.",
3120/// "type": "array",
3121/// "items": {
3122/// "type": "string"
3123/// }
3124/// },
3125/// "src": {
3126/// "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.",
3127/// "type": "string",
3128/// "format": "uri"
3129/// },
3130/// "theme": {
3131/// "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.",
3132/// "type": "string",
3133/// "enum": [
3134/// "dark",
3135/// "light"
3136/// ]
3137/// }
3138/// }
3139///}
3140/// ```
3141/// </details>
3142#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3143pub struct Icon {
3144 /**Optional MIME type override if the source MIME type is missing or generic.
3145 For example: "image/png", "image/jpeg", or "image/svg+xml".*/
3146 #[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
3147 pub mime_type: ::std::option::Option<::std::string::String>,
3148 /**Optional array of strings that specify sizes at which the icon can be used.
3149 Each string should be in WxH format (e.g., "48x48", "96x96") or "any" for scalable formats like SVG.
3150 If not provided, the client should assume that the icon can be used at any size.*/
3151 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
3152 pub sizes: ::std::vec::Vec<::std::string::String>,
3153 /**A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a
3154 data: URI with Base64-encoded image data.
3155 Consumers SHOULD take steps to ensure URLs serving icons are from the
3156 same domain as the client/server or a trusted domain.
3157 Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain
3158 executable JavaScript.*/
3159 pub src: ::std::string::String,
3160 /**Optional specifier for the theme this icon is designed for. "light" indicates
3161 the icon is designed to be used with a light background, and "dark" indicates
3162 the icon is designed to be used with a dark background.
3163 If not provided, the client should assume the icon can be used with any theme.*/
3164 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3165 pub theme: ::std::option::Option<IconTheme>,
3166}
3167/**Optional specifier for the theme this icon is designed for. "light" indicates
3168the icon is designed to be used with a light background, and "dark" indicates
3169the icon is designed to be used with a dark background.
3170If not provided, the client should assume the icon can be used with any theme.*/
3171///
3172/// <details><summary>JSON schema</summary>
3173///
3174/// ```json
3175///{
3176/// "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.",
3177/// "type": "string",
3178/// "enum": [
3179/// "dark",
3180/// "light"
3181/// ]
3182///}
3183/// ```
3184/// </details>
3185#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3186pub enum IconTheme {
3187 #[serde(rename = "dark")]
3188 Dark,
3189 #[serde(rename = "light")]
3190 Light,
3191}
3192impl ::std::fmt::Display for IconTheme {
3193 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3194 match *self {
3195 Self::Dark => write!(f, "dark"),
3196 Self::Light => write!(f, "light"),
3197 }
3198 }
3199}
3200///Base interface to add icons property.
3201///
3202/// <details><summary>JSON schema</summary>
3203///
3204/// ```json
3205///{
3206/// "description": "Base interface to add icons property.",
3207/// "type": "object",
3208/// "properties": {
3209/// "icons": {
3210/// "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)",
3211/// "type": "array",
3212/// "items": {
3213/// "$ref": "#/$defs/Icon"
3214/// }
3215/// }
3216/// }
3217///}
3218/// ```
3219/// </details>
3220#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
3221pub struct Icons {
3222 /**Optional set of sized icons that the client can display in a user interface.
3223 Clients that support rendering icons MUST support at least the following MIME types:
3224 - image/png - PNG images (safe, universal compatibility)
3225 - image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
3226 Clients that support rendering icons SHOULD also support:
3227 - image/svg+xml - SVG images (scalable but requires security precautions)
3228 - image/webp - WebP images (modern, efficient format)*/
3229 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
3230 pub icons: ::std::vec::Vec<Icon>,
3231}
3232///An image provided to or from an LLM.
3233///
3234/// <details><summary>JSON schema</summary>
3235///
3236/// ```json
3237///{
3238/// "description": "An image provided to or from an LLM.",
3239/// "type": "object",
3240/// "required": [
3241/// "data",
3242/// "mimeType",
3243/// "type"
3244/// ],
3245/// "properties": {
3246/// "_meta": {
3247/// "$ref": "#/$defs/MetaObject"
3248/// },
3249/// "annotations": {
3250/// "description": "Optional annotations for the client.",
3251/// "$ref": "#/$defs/Annotations"
3252/// },
3253/// "data": {
3254/// "description": "The base64-encoded image data.",
3255/// "type": "string",
3256/// "format": "byte"
3257/// },
3258/// "mimeType": {
3259/// "description": "The MIME type of the image. Different providers may support different image types.",
3260/// "type": "string"
3261/// },
3262/// "type": {
3263/// "type": "string",
3264/// "const": "image"
3265/// }
3266/// }
3267///}
3268/// ```
3269/// </details>
3270#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3271pub struct ImageContent {
3272 ///Optional annotations for the client.
3273 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3274 pub annotations: ::std::option::Option<Annotations>,
3275 ///The base64-encoded image data.
3276 pub data: ::std::string::String,
3277 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
3278 pub meta: ::std::option::Option<MetaObject>,
3279 ///The MIME type of the image. Different providers may support different image types.
3280 #[serde(rename = "mimeType")]
3281 pub mime_type: ::std::string::String,
3282 #[serde(rename = "type", deserialize_with = "validate::image_content_type_")]
3283 type_: ::std::string::String,
3284}
3285impl ImageContent {
3286 pub fn new(
3287 data: ::std::string::String,
3288 mime_type: ::std::string::String,
3289 annotations: ::std::option::Option<Annotations>,
3290 meta: ::std::option::Option<MetaObject>,
3291 ) -> Self {
3292 Self {
3293 annotations,
3294 data,
3295 meta,
3296 mime_type,
3297 type_: "image".to_string(),
3298 }
3299 }
3300 pub fn type_(&self) -> &::std::string::String {
3301 &self.type_
3302 }
3303 /// returns "image"
3304 pub fn type_value() -> &'static str {
3305 "image"
3306 }
3307 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
3308 pub fn type_name() -> &'static str {
3309 "image"
3310 }
3311}
3312///Describes the MCP implementation.
3313///
3314/// <details><summary>JSON schema</summary>
3315///
3316/// ```json
3317///{
3318/// "description": "Describes the MCP implementation.",
3319/// "type": "object",
3320/// "required": [
3321/// "name",
3322/// "version"
3323/// ],
3324/// "properties": {
3325/// "description": {
3326/// "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.",
3327/// "type": "string"
3328/// },
3329/// "icons": {
3330/// "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)",
3331/// "type": "array",
3332/// "items": {
3333/// "$ref": "#/$defs/Icon"
3334/// }
3335/// },
3336/// "name": {
3337/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
3338/// "type": "string"
3339/// },
3340/// "title": {
3341/// "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).",
3342/// "type": "string"
3343/// },
3344/// "version": {
3345/// "description": "The version of this implementation.",
3346/// "type": "string"
3347/// },
3348/// "websiteUrl": {
3349/// "description": "An optional URL of the website for this implementation.",
3350/// "type": "string",
3351/// "format": "uri"
3352/// }
3353/// }
3354///}
3355/// ```
3356/// </details>
3357#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
3358pub struct Implementation {
3359 /**An optional human-readable description of what this implementation does.
3360 This can be used by clients or servers to provide context about their purpose
3361 and capabilities. For example, a server might describe the types of resources
3362 or tools it provides, while a client might describe its intended use case.*/
3363 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3364 pub description: ::std::option::Option<::std::string::String>,
3365 /**Optional set of sized icons that the client can display in a user interface.
3366 Clients that support rendering icons MUST support at least the following MIME types:
3367 - image/png - PNG images (safe, universal compatibility)
3368 - image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
3369 Clients that support rendering icons SHOULD also support:
3370 - image/svg+xml - SVG images (scalable but requires security precautions)
3371 - image/webp - WebP images (modern, efficient format)*/
3372 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
3373 pub icons: ::std::vec::Vec<Icon>,
3374 ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
3375 pub name: ::std::string::String,
3376 /**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
3377 even by those unfamiliar with domain-specific terminology.
3378 If not provided, the name should be used for display (except for {@link Tool},
3379 where annotations.title should be given precedence over using name,
3380 if present).*/
3381 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3382 pub title: ::std::option::Option<::std::string::String>,
3383 ///The version of this implementation.
3384 pub version: ::std::string::String,
3385 ///An optional URL of the website for this implementation.
3386 #[serde(rename = "websiteUrl", default, skip_serializing_if = "::std::option::Option::is_none")]
3387 pub website_url: ::std::option::Option<::std::string::String>,
3388}
3389/**A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.
3390The client MAY ignore this request.
3391Default is "none". The values "thisServer" and "allServers" are deprecated (SEP-2596): servers SHOULD
3392omit this field or use "none", and SHOULD only use the deprecated values if the client declares
3393{@link ClientCapabilities.sampling.context}.*/
3394///
3395/// <details><summary>JSON schema</summary>
3396///
3397/// ```json
3398///{
3399/// "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}.",
3400/// "type": "string",
3401/// "enum": [
3402/// "allServers",
3403/// "none",
3404/// "thisServer"
3405/// ]
3406///}
3407/// ```
3408/// </details>
3409#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3410pub enum IncludeContext {
3411 #[serde(rename = "allServers")]
3412 AllServers,
3413 #[serde(rename = "none")]
3414 None,
3415 #[serde(rename = "thisServer")]
3416 ThisServer,
3417}
3418impl ::std::fmt::Display for IncludeContext {
3419 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3420 match *self {
3421 Self::AllServers => write!(f, "allServers"),
3422 Self::None => write!(f, "none"),
3423 Self::ThisServer => write!(f, "thisServer"),
3424 }
3425 }
3426}
3427///InputRequest
3428///
3429/// <details><summary>JSON schema</summary>
3430///
3431/// ```json
3432///{
3433/// "anyOf": [
3434/// {
3435/// "$ref": "#/$defs/CreateMessageRequest"
3436/// },
3437/// {
3438/// "$ref": "#/$defs/ListRootsRequest"
3439/// },
3440/// {
3441/// "$ref": "#/$defs/ElicitRequest"
3442/// }
3443/// ]
3444///}
3445/// ```
3446/// </details>
3447#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3448#[serde(untagged)]
3449pub enum InputRequest {
3450 CreateMessageRequest(CreateMessageRequest),
3451 ListRootsRequest(ListRootsRequest),
3452 ElicitRequest(ElicitRequest),
3453}
3454impl ::std::convert::From<CreateMessageRequest> for InputRequest {
3455 fn from(value: CreateMessageRequest) -> Self {
3456 Self::CreateMessageRequest(value)
3457 }
3458}
3459impl ::std::convert::From<ListRootsRequest> for InputRequest {
3460 fn from(value: ListRootsRequest) -> Self {
3461 Self::ListRootsRequest(value)
3462 }
3463}
3464impl ::std::convert::From<ElicitRequest> for InputRequest {
3465 fn from(value: ElicitRequest) -> Self {
3466 Self::ElicitRequest(value)
3467 }
3468}
3469/**A map of server-initiated requests that the client must fulfill.
3470Keys are server-assigned identifiers; values are the request objects.*/
3471///
3472/// <details><summary>JSON schema</summary>
3473///
3474/// ```json
3475///{
3476/// "description": "A map of server-initiated requests that the client must fulfill.\nKeys are server-assigned identifiers; values are the request objects.",
3477/// "type": "object",
3478/// "additionalProperties": {
3479/// "$ref": "#/$defs/InputRequest"
3480/// }
3481///}
3482/// ```
3483/// </details>
3484#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3485#[serde(transparent)]
3486pub struct InputRequests(pub std::collections::BTreeMap<::std::string::String, InputRequest>);
3487/**An InputRequiredResult sent by the server to indicate that additional input is needed
3488before the request can be completed.
3489At least one of inputRequests or requestState MUST be present.*/
3490///
3491/// <details><summary>JSON schema</summary>
3492///
3493/// ```json
3494///{
3495/// "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.",
3496/// "type": "object",
3497/// "required": [
3498/// "resultType"
3499/// ],
3500/// "properties": {
3501/// "_meta": {
3502/// "$ref": "#/$defs/ResultMetaObject"
3503/// },
3504/// "inputRequests": {
3505/// "$ref": "#/$defs/InputRequests"
3506/// },
3507/// "requestState": {
3508/// "type": "string"
3509/// },
3510/// "resultType": {
3511/// "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\".",
3512/// "type": "string"
3513/// }
3514/// }
3515///}
3516/// ```
3517/// </details>
3518#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3519pub struct InputRequiredResult {
3520 #[serde(rename = "inputRequests", default, skip_serializing_if = "::std::option::Option::is_none")]
3521 pub input_requests: ::std::option::Option<InputRequests>,
3522 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
3523 pub meta: ::std::option::Option<ResultMetaObject>,
3524 #[serde(rename = "requestState", default, skip_serializing_if = "::std::option::Option::is_none")]
3525 pub request_state: ::std::option::Option<::std::string::String>,
3526 /**Indicates the type of the result, which allows the client to determine
3527 how to parse the result object.
3528 Servers implementing this protocol version MUST include this field.
3529 For backward compatibility, when a client receives a result from a
3530 server implementing an earlier protocol version (which does not include
3531 resultType), the client MUST treat the absent field as "complete".*/
3532 #[serde(rename = "resultType")]
3533 pub result_type: ::std::string::String,
3534}
3535///InputResponse
3536///
3537/// <details><summary>JSON schema</summary>
3538///
3539/// ```json
3540///{
3541/// "anyOf": [
3542/// {
3543/// "$ref": "#/$defs/CreateMessageResult"
3544/// },
3545/// {
3546/// "$ref": "#/$defs/ListRootsResult"
3547/// },
3548/// {
3549/// "$ref": "#/$defs/ElicitResult"
3550/// }
3551/// ]
3552///}
3553/// ```
3554/// </details>
3555#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3556#[serde(untagged)]
3557pub enum InputResponse {
3558 CreateMessageResult(CreateMessageResult),
3559 ListRootsResult(ListRootsResult),
3560 ElicitResult(ElicitResult),
3561}
3562impl ::std::convert::From<CreateMessageResult> for InputResponse {
3563 fn from(value: CreateMessageResult) -> Self {
3564 Self::CreateMessageResult(value)
3565 }
3566}
3567impl ::std::convert::From<ListRootsResult> for InputResponse {
3568 fn from(value: ListRootsResult) -> Self {
3569 Self::ListRootsResult(value)
3570 }
3571}
3572impl ::std::convert::From<ElicitResult> for InputResponse {
3573 fn from(value: ElicitResult) -> Self {
3574 Self::ElicitResult(value)
3575 }
3576}
3577///InputResponseRequestParams
3578///
3579/// <details><summary>JSON schema</summary>
3580///
3581/// ```json
3582///{
3583/// "type": "object",
3584/// "required": [
3585/// "_meta"
3586/// ],
3587/// "properties": {
3588/// "_meta": {
3589/// "$ref": "#/$defs/RequestMetaObject"
3590/// },
3591/// "inputResponses": {
3592/// "$ref": "#/$defs/InputResponses"
3593/// },
3594/// "requestState": {
3595/// "type": "string"
3596/// }
3597/// }
3598///}
3599/// ```
3600/// </details>
3601#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3602pub struct InputResponseRequestParams {
3603 #[serde(rename = "inputResponses", default, skip_serializing_if = "::std::option::Option::is_none")]
3604 pub input_responses: ::std::option::Option<InputResponses>,
3605 #[serde(rename = "_meta")]
3606 pub meta: RequestMetaObject,
3607 #[serde(rename = "requestState", default, skip_serializing_if = "::std::option::Option::is_none")]
3608 pub request_state: ::std::option::Option<::std::string::String>,
3609}
3610/**A map of client responses to server-initiated requests.
3611Keys correspond to the keys in the {@link InputRequests} map;
3612values are the client's result for each request.*/
3613///
3614/// <details><summary>JSON schema</summary>
3615///
3616/// ```json
3617///{
3618/// "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.",
3619/// "type": "object",
3620/// "additionalProperties": {
3621/// "$ref": "#/$defs/InputResponse"
3622/// }
3623///}
3624/// ```
3625/// </details>
3626#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3627#[serde(transparent)]
3628pub struct InputResponses(pub std::collections::BTreeMap<::std::string::String, InputResponse>);
3629///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.
3630///
3631/// <details><summary>JSON schema</summary>
3632///
3633/// ```json
3634///{
3635/// "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.",
3636/// "type": "object",
3637/// "required": [
3638/// "code",
3639/// "message"
3640/// ],
3641/// "properties": {
3642/// "code": {
3643/// "description": "The error type that occurred.",
3644/// "type": "integer",
3645/// "const": -32603
3646/// },
3647/// "data": {
3648/// "description": "Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.)."
3649/// },
3650/// "message": {
3651/// "description": "A short description of the error. The message SHOULD be limited to a concise single sentence.",
3652/// "type": "string"
3653/// }
3654/// }
3655///}
3656/// ```
3657/// </details>
3658#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3659pub struct InternalError {
3660 ///The error type that occurred.
3661 pub code: i64,
3662 ///Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
3663 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3664 pub data: ::std::option::Option<::serde_json::Value>,
3665 ///A short description of the error. The message SHOULD be limited to a concise single sentence.
3666 pub message: ::std::string::String,
3667}
3668/**A JSON-RPC error indicating that the method parameters are invalid or malformed.
3669In MCP, this error is returned in various contexts when request parameters fail validation:
3670- **Tools**: Unknown tool name or invalid tool arguments
3671- **Prompts**: Unknown prompt name or missing required arguments
3672- **Pagination**: Invalid or expired cursor values
3673- **Logging**: Invalid log level
3674- **Elicitation**: Server requests an elicitation mode not declared in client capabilities
3675- **Sampling**: Missing tool result or tool results mixed with other content*/
3676///
3677/// <details><summary>JSON schema</summary>
3678///
3679/// ```json
3680///{
3681/// "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",
3682/// "type": "object",
3683/// "required": [
3684/// "code",
3685/// "message"
3686/// ],
3687/// "properties": {
3688/// "code": {
3689/// "description": "The error type that occurred.",
3690/// "type": "integer",
3691/// "const": -32602
3692/// },
3693/// "data": {
3694/// "description": "Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.)."
3695/// },
3696/// "message": {
3697/// "description": "A short description of the error. The message SHOULD be limited to a concise single sentence.",
3698/// "type": "string"
3699/// }
3700/// }
3701///}
3702/// ```
3703/// </details>
3704#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3705pub struct InvalidParamsError {
3706 ///The error type that occurred.
3707 pub code: i64,
3708 ///Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
3709 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3710 pub data: ::std::option::Option<::serde_json::Value>,
3711 ///A short description of the error. The message SHOULD be limited to a concise single sentence.
3712 pub message: ::std::string::String,
3713}
3714///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).
3715///
3716/// <details><summary>JSON schema</summary>
3717///
3718/// ```json
3719///{
3720/// "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).",
3721/// "type": "object",
3722/// "required": [
3723/// "code",
3724/// "message"
3725/// ],
3726/// "properties": {
3727/// "code": {
3728/// "description": "The error type that occurred.",
3729/// "type": "integer",
3730/// "const": -32600
3731/// },
3732/// "data": {
3733/// "description": "Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.)."
3734/// },
3735/// "message": {
3736/// "description": "A short description of the error. The message SHOULD be limited to a concise single sentence.",
3737/// "type": "string"
3738/// }
3739/// }
3740///}
3741/// ```
3742/// </details>
3743#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3744pub struct InvalidRequestError {
3745 ///The error type that occurred.
3746 pub code: i64,
3747 ///Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
3748 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3749 pub data: ::std::option::Option<::serde_json::Value>,
3750 ///A short description of the error. The message SHOULD be limited to a concise single sentence.
3751 pub message: ::std::string::String,
3752}
3753///JsonArray
3754///
3755/// <details><summary>JSON schema</summary>
3756///
3757/// ```json
3758///{
3759/// "type": "array",
3760/// "items": {
3761/// "$ref": "#/$defs/JSONValue"
3762/// }
3763///}
3764/// ```
3765/// </details>
3766#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3767#[serde(transparent)]
3768pub struct JsonArray(pub ::std::vec::Vec<JsonValue>);
3769///JsonObject
3770///
3771/// <details><summary>JSON schema</summary>
3772///
3773/// ```json
3774///{
3775/// "type": "object",
3776/// "additionalProperties": {
3777/// "$ref": "#/$defs/JSONValue"
3778/// }
3779///}
3780/// ```
3781/// </details>
3782#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3783#[serde(transparent)]
3784pub struct JsonObject(pub std::collections::BTreeMap<::std::string::String, JsonValue>);
3785///JsonValue
3786///
3787/// <details><summary>JSON schema</summary>
3788///
3789/// ```json
3790///{
3791/// "anyOf": [
3792/// {
3793/// "$ref": "#/$defs/JSONObject"
3794/// },
3795/// {
3796/// "type": "array",
3797/// "items": {
3798/// "$ref": "#/$defs/JSONValue"
3799/// }
3800/// },
3801/// {
3802/// "type": [
3803/// "string",
3804/// "integer",
3805/// "boolean"
3806/// ]
3807/// }
3808/// ]
3809///}
3810/// ```
3811/// </details>
3812#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3813#[serde(untagged)]
3814pub enum JsonValue {
3815 Variant0(JsonObject),
3816 Variant1(::std::vec::Vec<JsonValue>),
3817 Variant2(JsonValueVariant2),
3818}
3819impl ::std::convert::From<JsonObject> for JsonValue {
3820 fn from(value: JsonObject) -> Self {
3821 Self::Variant0(value)
3822 }
3823}
3824impl ::std::convert::From<::std::vec::Vec<JsonValue>> for JsonValue {
3825 fn from(value: ::std::vec::Vec<JsonValue>) -> Self {
3826 Self::Variant1(value)
3827 }
3828}
3829impl ::std::convert::From<JsonValueVariant2> for JsonValue {
3830 fn from(value: JsonValueVariant2) -> Self {
3831 Self::Variant2(value)
3832 }
3833}
3834///JsonValueVariant2
3835///
3836/// <details><summary>JSON schema</summary>
3837///
3838/// ```json
3839///{
3840/// "type": [
3841/// "string",
3842/// "integer",
3843/// "boolean"
3844/// ]
3845///}
3846/// ```
3847/// </details>
3848#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3849#[serde(untagged)]
3850pub enum JsonValueVariant2 {
3851 Boolean(bool),
3852 String(::std::string::String),
3853 Integer(i64),
3854}
3855impl ::std::convert::From<bool> for JsonValueVariant2 {
3856 fn from(value: bool) -> Self {
3857 Self::Boolean(value)
3858 }
3859}
3860impl ::std::convert::From<i64> for JsonValueVariant2 {
3861 fn from(value: i64) -> Self {
3862 Self::Integer(value)
3863 }
3864}
3865///A response to a request that indicates an error occurred.
3866///
3867/// <details><summary>JSON schema</summary>
3868///
3869/// ```json
3870///{
3871/// "description": "A response to a request that indicates an error occurred.",
3872/// "type": "object",
3873/// "required": [
3874/// "error",
3875/// "jsonrpc"
3876/// ],
3877/// "properties": {
3878/// "error": {
3879/// "$ref": "#/$defs/Error"
3880/// },
3881/// "id": {
3882/// "$ref": "#/$defs/RequestId"
3883/// },
3884/// "jsonrpc": {
3885/// "type": "string",
3886/// "const": "2.0"
3887/// }
3888/// }
3889///}
3890/// ```
3891/// </details>
3892#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3893pub struct JsonrpcErrorResponse {
3894 pub error: RpcError,
3895 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3896 pub id: ::std::option::Option<RequestId>,
3897 #[serde(deserialize_with = "validate::jsonrpc_error_response_jsonrpc")]
3898 jsonrpc: ::std::string::String,
3899}
3900impl JsonrpcErrorResponse {
3901 pub fn new(error: RpcError, id: ::std::option::Option<RequestId>) -> Self {
3902 Self {
3903 error,
3904 id,
3905 jsonrpc: JSONRPC_VERSION.to_string(),
3906 }
3907 }
3908 pub fn jsonrpc(&self) -> &::std::string::String {
3909 &self.jsonrpc
3910 }
3911}
3912///Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.
3913///
3914/// <details><summary>JSON schema</summary>
3915///
3916/// ```json
3917///{
3918/// "description": "Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.",
3919/// "anyOf": [
3920/// {
3921/// "$ref": "#/$defs/JSONRPCRequest"
3922/// },
3923/// {
3924/// "$ref": "#/$defs/JSONRPCNotification"
3925/// },
3926/// {
3927/// "$ref": "#/$defs/JSONRPCResultResponse"
3928/// },
3929/// {
3930/// "$ref": "#/$defs/JSONRPCErrorResponse"
3931/// }
3932/// ]
3933///}
3934/// ```
3935/// </details>
3936#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3937#[serde(untagged)]
3938pub enum JsonrpcMessage {
3939 Request(JsonrpcRequest),
3940 Notification(JsonrpcNotification),
3941 ResultResponse(JsonrpcResultResponse),
3942 ErrorResponse(JsonrpcErrorResponse),
3943}
3944impl ::std::convert::From<JsonrpcRequest> for JsonrpcMessage {
3945 fn from(value: JsonrpcRequest) -> Self {
3946 Self::Request(value)
3947 }
3948}
3949impl ::std::convert::From<JsonrpcNotification> for JsonrpcMessage {
3950 fn from(value: JsonrpcNotification) -> Self {
3951 Self::Notification(value)
3952 }
3953}
3954impl ::std::convert::From<JsonrpcResultResponse> for JsonrpcMessage {
3955 fn from(value: JsonrpcResultResponse) -> Self {
3956 Self::ResultResponse(value)
3957 }
3958}
3959impl ::std::convert::From<JsonrpcErrorResponse> for JsonrpcMessage {
3960 fn from(value: JsonrpcErrorResponse) -> Self {
3961 Self::ErrorResponse(value)
3962 }
3963}
3964///A notification which does not expect a response.
3965///
3966/// <details><summary>JSON schema</summary>
3967///
3968/// ```json
3969///{
3970/// "description": "A notification which does not expect a response.",
3971/// "type": "object",
3972/// "required": [
3973/// "jsonrpc",
3974/// "method"
3975/// ],
3976/// "properties": {
3977/// "jsonrpc": {
3978/// "type": "string",
3979/// "const": "2.0"
3980/// },
3981/// "method": {
3982/// "type": "string"
3983/// },
3984/// "params": {
3985/// "type": "object",
3986/// "additionalProperties": {}
3987/// }
3988/// }
3989///}
3990/// ```
3991/// </details>
3992#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3993pub struct JsonrpcNotification {
3994 #[serde(deserialize_with = "validate::jsonrpc_notification_jsonrpc")]
3995 jsonrpc: ::std::string::String,
3996 pub method: ::std::string::String,
3997 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3998 pub params: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
3999}
4000impl JsonrpcNotification {
4001 pub fn new(
4002 method: ::std::string::String,
4003 params: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
4004 ) -> Self {
4005 Self {
4006 jsonrpc: JSONRPC_VERSION.to_string(),
4007 method,
4008 params,
4009 }
4010 }
4011 pub fn jsonrpc(&self) -> &::std::string::String {
4012 &self.jsonrpc
4013 }
4014}
4015///A request that expects a response.
4016///
4017/// <details><summary>JSON schema</summary>
4018///
4019/// ```json
4020///{
4021/// "description": "A request that expects a response.",
4022/// "type": "object",
4023/// "required": [
4024/// "id",
4025/// "jsonrpc",
4026/// "method"
4027/// ],
4028/// "properties": {
4029/// "id": {
4030/// "$ref": "#/$defs/RequestId"
4031/// },
4032/// "jsonrpc": {
4033/// "type": "string",
4034/// "const": "2.0"
4035/// },
4036/// "method": {
4037/// "type": "string"
4038/// },
4039/// "params": {
4040/// "type": "object",
4041/// "additionalProperties": {}
4042/// }
4043/// }
4044///}
4045/// ```
4046/// </details>
4047#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4048pub struct JsonrpcRequest {
4049 pub id: RequestId,
4050 #[serde(deserialize_with = "validate::jsonrpc_request_jsonrpc")]
4051 jsonrpc: ::std::string::String,
4052 pub method: ::std::string::String,
4053 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4054 pub params: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
4055}
4056impl JsonrpcRequest {
4057 pub fn new(
4058 id: RequestId,
4059 method: ::std::string::String,
4060 params: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
4061 ) -> Self {
4062 Self {
4063 id,
4064 jsonrpc: JSONRPC_VERSION.to_string(),
4065 method,
4066 params,
4067 }
4068 }
4069 pub fn jsonrpc(&self) -> &::std::string::String {
4070 &self.jsonrpc
4071 }
4072}
4073///A response to a request, containing either the result or error.
4074///
4075/// <details><summary>JSON schema</summary>
4076///
4077/// ```json
4078///{
4079/// "description": "A response to a request, containing either the result or error.",
4080/// "anyOf": [
4081/// {
4082/// "$ref": "#/$defs/JSONRPCResultResponse"
4083/// },
4084/// {
4085/// "$ref": "#/$defs/JSONRPCErrorResponse"
4086/// }
4087/// ]
4088///}
4089/// ```
4090/// </details>
4091#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4092#[serde(untagged)]
4093pub enum JsonrpcResponse {
4094 ResultResponse(JsonrpcResultResponse),
4095 ErrorResponse(JsonrpcErrorResponse),
4096}
4097impl ::std::convert::From<JsonrpcResultResponse> for JsonrpcResponse {
4098 fn from(value: JsonrpcResultResponse) -> Self {
4099 Self::ResultResponse(value)
4100 }
4101}
4102impl ::std::convert::From<JsonrpcErrorResponse> for JsonrpcResponse {
4103 fn from(value: JsonrpcErrorResponse) -> Self {
4104 Self::ErrorResponse(value)
4105 }
4106}
4107///A successful (non-error) response to a request.
4108///
4109/// <details><summary>JSON schema</summary>
4110///
4111/// ```json
4112///{
4113/// "description": "A successful (non-error) response to a request.",
4114/// "type": "object",
4115/// "required": [
4116/// "id",
4117/// "jsonrpc",
4118/// "result"
4119/// ],
4120/// "properties": {
4121/// "id": {
4122/// "$ref": "#/$defs/RequestId"
4123/// },
4124/// "jsonrpc": {
4125/// "type": "string",
4126/// "const": "2.0"
4127/// },
4128/// "result": {
4129/// "$ref": "#/$defs/Result"
4130/// }
4131/// }
4132///}
4133/// ```
4134/// </details>
4135#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4136pub struct JsonrpcResultResponse {
4137 pub id: RequestId,
4138 #[serde(deserialize_with = "validate::jsonrpc_result_response_jsonrpc")]
4139 jsonrpc: ::std::string::String,
4140 pub result: Result,
4141}
4142impl JsonrpcResultResponse {
4143 pub fn new(id: RequestId, result: Result) -> Self {
4144 Self {
4145 id,
4146 jsonrpc: JSONRPC_VERSION.to_string(),
4147 result,
4148 }
4149 }
4150 pub fn jsonrpc(&self) -> &::std::string::String {
4151 &self.jsonrpc
4152 }
4153}
4154/**Use {@link TitledSingleSelectEnumSchema} instead.
4155This interface will be removed in a future version.*/
4156///
4157/// <details><summary>JSON schema</summary>
4158///
4159/// ```json
4160///{
4161/// "description": "Use {@link TitledSingleSelectEnumSchema} instead.\nThis interface will be removed in a future version.",
4162/// "type": "object",
4163/// "required": [
4164/// "enum",
4165/// "type"
4166/// ],
4167/// "properties": {
4168/// "default": {
4169/// "type": "string"
4170/// },
4171/// "description": {
4172/// "type": "string"
4173/// },
4174/// "enum": {
4175/// "type": "array",
4176/// "items": {
4177/// "type": "string"
4178/// }
4179/// },
4180/// "enumNames": {
4181/// "description": "(Legacy) Display names for enum values.\nNon-standard according to JSON schema 2020-12.",
4182/// "type": "array",
4183/// "items": {
4184/// "type": "string"
4185/// }
4186/// },
4187/// "title": {
4188/// "type": "string"
4189/// },
4190/// "type": {
4191/// "type": "string",
4192/// "const": "string"
4193/// }
4194/// }
4195///}
4196/// ```
4197/// </details>
4198#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4199pub struct LegacyTitledEnumSchema {
4200 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4201 pub default: ::std::option::Option<::std::string::String>,
4202 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4203 pub description: ::std::option::Option<::std::string::String>,
4204 #[serde(rename = "enum")]
4205 pub enum_: ::std::vec::Vec<::std::string::String>,
4206 /**(Legacy) Display names for enum values.
4207 Non-standard according to JSON schema 2020-12.*/
4208 #[serde(rename = "enumNames", default, skip_serializing_if = "::std::vec::Vec::is_empty")]
4209 pub enum_names: ::std::vec::Vec<::std::string::String>,
4210 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4211 pub title: ::std::option::Option<::std::string::String>,
4212 #[serde(rename = "type", deserialize_with = "validate::legacy_titled_enum_schema_type_")]
4213 type_: ::std::string::String,
4214}
4215impl LegacyTitledEnumSchema {
4216 pub fn new(
4217 enum_: ::std::vec::Vec<::std::string::String>,
4218 enum_names: ::std::vec::Vec<::std::string::String>,
4219 default: ::std::option::Option<::std::string::String>,
4220 description: ::std::option::Option<::std::string::String>,
4221 title: ::std::option::Option<::std::string::String>,
4222 ) -> Self {
4223 Self {
4224 default,
4225 description,
4226 enum_,
4227 enum_names,
4228 title,
4229 type_: "string".to_string(),
4230 }
4231 }
4232 pub fn type_(&self) -> &::std::string::String {
4233 &self.type_
4234 }
4235 /// returns "string"
4236 pub fn type_value() -> &'static str {
4237 "string"
4238 }
4239 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
4240 pub fn type_name() -> &'static str {
4241 "string"
4242 }
4243}
4244///Sent from the client to request a list of prompts and prompt templates the server has.
4245///
4246/// <details><summary>JSON schema</summary>
4247///
4248/// ```json
4249///{
4250/// "description": "Sent from the client to request a list of prompts and prompt templates the server has.",
4251/// "type": "object",
4252/// "required": [
4253/// "id",
4254/// "jsonrpc",
4255/// "method",
4256/// "params"
4257/// ],
4258/// "properties": {
4259/// "id": {
4260/// "$ref": "#/$defs/RequestId"
4261/// },
4262/// "jsonrpc": {
4263/// "type": "string",
4264/// "const": "2.0"
4265/// },
4266/// "method": {
4267/// "type": "string",
4268/// "const": "prompts/list"
4269/// },
4270/// "params": {
4271/// "$ref": "#/$defs/PaginatedRequestParams"
4272/// }
4273/// }
4274///}
4275/// ```
4276/// </details>
4277#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4278pub struct ListPromptsRequest {
4279 pub id: RequestId,
4280 #[serde(deserialize_with = "validate::list_prompts_request_jsonrpc")]
4281 jsonrpc: ::std::string::String,
4282 #[serde(deserialize_with = "validate::list_prompts_request_method")]
4283 method: ::std::string::String,
4284 pub params: PaginatedRequestParams,
4285}
4286impl ListPromptsRequest {
4287 pub fn new(id: RequestId, params: PaginatedRequestParams) -> Self {
4288 Self {
4289 id,
4290 jsonrpc: JSONRPC_VERSION.to_string(),
4291 method: "prompts/list".to_string(),
4292 params,
4293 }
4294 }
4295 pub fn jsonrpc(&self) -> &::std::string::String {
4296 &self.jsonrpc
4297 }
4298 pub fn method(&self) -> &::std::string::String {
4299 &self.method
4300 }
4301 /// returns "prompts/list"
4302 pub fn method_value() -> &'static str {
4303 "prompts/list"
4304 }
4305 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
4306 pub fn method_name() -> &'static str {
4307 "prompts/list"
4308 }
4309}
4310///The result returned by the server for a {@link ListPromptsRequestprompts/list} request.
4311///
4312/// <details><summary>JSON schema</summary>
4313///
4314/// ```json
4315///{
4316/// "description": "The result returned by the server for a {@link ListPromptsRequestprompts/list} request.",
4317/// "type": "object",
4318/// "required": [
4319/// "cacheScope",
4320/// "prompts",
4321/// "resultType",
4322/// "ttlMs"
4323/// ],
4324/// "properties": {
4325/// "_meta": {
4326/// "$ref": "#/$defs/ResultMetaObject"
4327/// },
4328/// "cacheScope": {
4329/// "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).",
4330/// "type": "string",
4331/// "enum": [
4332/// "private",
4333/// "public"
4334/// ]
4335/// },
4336/// "nextCursor": {
4337/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
4338/// "type": "string"
4339/// },
4340/// "prompts": {
4341/// "type": "array",
4342/// "items": {
4343/// "$ref": "#/$defs/Prompt"
4344/// }
4345/// },
4346/// "resultType": {
4347/// "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\".",
4348/// "type": "string"
4349/// },
4350/// "ttlMs": {
4351/// "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.",
4352/// "type": "integer",
4353/// "minimum": 0.0
4354/// }
4355/// }
4356///}
4357/// ```
4358/// </details>
4359#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4360pub struct ListPromptsResult {
4361 /**Indicates the intended scope of the cached response, analogous to HTTP
4362 Cache-Control: public vs Cache-Control: private.
4363 - "public": The response does not contain user-specific data. Any
4364 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
4365 the response and serve it across authorization contexts.
4366 - "private": The response MAY be cached and reused only within the
4367 same authorization context. Caches MUST NOT be shared across
4368 authorization contexts (e.g., a different access token requires a
4369 different cache).*/
4370 #[serde(rename = "cacheScope")]
4371 pub cache_scope: ListPromptsResultCacheScope,
4372 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
4373 pub meta: ::std::option::Option<ResultMetaObject>,
4374 /**An opaque token representing the pagination position after the last returned result.
4375 If present, there may be more results available.*/
4376 #[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
4377 pub next_cursor: ::std::option::Option<::std::string::String>,
4378 pub prompts: ::std::vec::Vec<Prompt>,
4379 /**Indicates the type of the result, which allows the client to determine
4380 how to parse the result object.
4381 Servers implementing this protocol version MUST include this field.
4382 For backward compatibility, when a client receives a result from a
4383 server implementing an earlier protocol version (which does not include
4384 resultType), the client MUST treat the absent field as "complete".*/
4385 #[serde(rename = "resultType")]
4386 pub result_type: ::std::string::String,
4387 /**A hint from the server indicating how long (in milliseconds) the
4388 client MAY cache this response before re-fetching. Semantics are
4389 analogous to HTTP Cache-Control max-age.
4390 - If 0, The response SHOULD be considered immediately stale,
4391 The client MAY re-fetch every time the result is needed.
4392 - If positive, the client SHOULD consider the result fresh for this many
4393 milliseconds after receiving the response.*/
4394 #[serde(rename = "ttlMs")]
4395 pub ttl_ms: u64,
4396}
4397/**Indicates the intended scope of the cached response, analogous to HTTP
4398Cache-Control: public vs Cache-Control: private.
4399- "public": The response does not contain user-specific data. Any
4400 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
4401 the response and serve it across authorization contexts.
4402- "private": The response MAY be cached and reused only within the
4403 same authorization context. Caches MUST NOT be shared across
4404 authorization contexts (e.g., a different access token requires a
4405 different cache).*/
4406///
4407/// <details><summary>JSON schema</summary>
4408///
4409/// ```json
4410///{
4411/// "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).",
4412/// "type": "string",
4413/// "enum": [
4414/// "private",
4415/// "public"
4416/// ]
4417///}
4418/// ```
4419/// </details>
4420#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4421pub enum ListPromptsResultCacheScope {
4422 #[serde(rename = "private")]
4423 Private,
4424 #[serde(rename = "public")]
4425 Public,
4426}
4427impl ::std::fmt::Display for ListPromptsResultCacheScope {
4428 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4429 match *self {
4430 Self::Private => write!(f, "private"),
4431 Self::Public => write!(f, "public"),
4432 }
4433 }
4434}
4435///A successful response from the server for a {@link ListPromptsRequestprompts/list} request.
4436///
4437/// <details><summary>JSON schema</summary>
4438///
4439/// ```json
4440///{
4441/// "description": "A successful response from the server for a {@link ListPromptsRequestprompts/list} request.",
4442/// "type": "object",
4443/// "required": [
4444/// "id",
4445/// "jsonrpc",
4446/// "result"
4447/// ],
4448/// "properties": {
4449/// "id": {
4450/// "$ref": "#/$defs/RequestId"
4451/// },
4452/// "jsonrpc": {
4453/// "type": "string",
4454/// "const": "2.0"
4455/// },
4456/// "result": {
4457/// "$ref": "#/$defs/ListPromptsResult"
4458/// }
4459/// }
4460///}
4461/// ```
4462/// </details>
4463#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4464pub struct ListPromptsResultResponse {
4465 pub id: RequestId,
4466 #[serde(deserialize_with = "validate::list_prompts_result_response_jsonrpc")]
4467 jsonrpc: ::std::string::String,
4468 pub result: ListPromptsResult,
4469}
4470impl ListPromptsResultResponse {
4471 pub fn new(id: RequestId, result: ListPromptsResult) -> Self {
4472 Self {
4473 id,
4474 jsonrpc: JSONRPC_VERSION.to_string(),
4475 result,
4476 }
4477 }
4478 pub fn jsonrpc(&self) -> &::std::string::String {
4479 &self.jsonrpc
4480 }
4481}
4482///Sent from the client to request a list of resource templates the server has.
4483///
4484/// <details><summary>JSON schema</summary>
4485///
4486/// ```json
4487///{
4488/// "description": "Sent from the client to request a list of resource templates the server has.",
4489/// "type": "object",
4490/// "required": [
4491/// "id",
4492/// "jsonrpc",
4493/// "method",
4494/// "params"
4495/// ],
4496/// "properties": {
4497/// "id": {
4498/// "$ref": "#/$defs/RequestId"
4499/// },
4500/// "jsonrpc": {
4501/// "type": "string",
4502/// "const": "2.0"
4503/// },
4504/// "method": {
4505/// "type": "string",
4506/// "const": "resources/templates/list"
4507/// },
4508/// "params": {
4509/// "$ref": "#/$defs/PaginatedRequestParams"
4510/// }
4511/// }
4512///}
4513/// ```
4514/// </details>
4515#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4516pub struct ListResourceTemplatesRequest {
4517 pub id: RequestId,
4518 #[serde(deserialize_with = "validate::list_resource_templates_request_jsonrpc")]
4519 jsonrpc: ::std::string::String,
4520 #[serde(deserialize_with = "validate::list_resource_templates_request_method")]
4521 method: ::std::string::String,
4522 pub params: PaginatedRequestParams,
4523}
4524impl ListResourceTemplatesRequest {
4525 pub fn new(id: RequestId, params: PaginatedRequestParams) -> Self {
4526 Self {
4527 id,
4528 jsonrpc: JSONRPC_VERSION.to_string(),
4529 method: "resources/templates/list".to_string(),
4530 params,
4531 }
4532 }
4533 pub fn jsonrpc(&self) -> &::std::string::String {
4534 &self.jsonrpc
4535 }
4536 pub fn method(&self) -> &::std::string::String {
4537 &self.method
4538 }
4539 /// returns "resources/templates/list"
4540 pub fn method_value() -> &'static str {
4541 "resources/templates/list"
4542 }
4543 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
4544 pub fn method_name() -> &'static str {
4545 "resources/templates/list"
4546 }
4547}
4548///The result returned by the server for a {@link ListResourceTemplatesRequestresources/templates/list} request.
4549///
4550/// <details><summary>JSON schema</summary>
4551///
4552/// ```json
4553///{
4554/// "description": "The result returned by the server for a {@link ListResourceTemplatesRequestresources/templates/list} request.",
4555/// "type": "object",
4556/// "required": [
4557/// "cacheScope",
4558/// "resourceTemplates",
4559/// "resultType",
4560/// "ttlMs"
4561/// ],
4562/// "properties": {
4563/// "_meta": {
4564/// "$ref": "#/$defs/ResultMetaObject"
4565/// },
4566/// "cacheScope": {
4567/// "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).",
4568/// "type": "string",
4569/// "enum": [
4570/// "private",
4571/// "public"
4572/// ]
4573/// },
4574/// "nextCursor": {
4575/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
4576/// "type": "string"
4577/// },
4578/// "resourceTemplates": {
4579/// "type": "array",
4580/// "items": {
4581/// "$ref": "#/$defs/ResourceTemplate"
4582/// }
4583/// },
4584/// "resultType": {
4585/// "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\".",
4586/// "type": "string"
4587/// },
4588/// "ttlMs": {
4589/// "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.",
4590/// "type": "integer",
4591/// "minimum": 0.0
4592/// }
4593/// }
4594///}
4595/// ```
4596/// </details>
4597#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4598pub struct ListResourceTemplatesResult {
4599 /**Indicates the intended scope of the cached response, analogous to HTTP
4600 Cache-Control: public vs Cache-Control: private.
4601 - "public": The response does not contain user-specific data. Any
4602 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
4603 the response and serve it across authorization contexts.
4604 - "private": The response MAY be cached and reused only within the
4605 same authorization context. Caches MUST NOT be shared across
4606 authorization contexts (e.g., a different access token requires a
4607 different cache).*/
4608 #[serde(rename = "cacheScope")]
4609 pub cache_scope: ListResourceTemplatesResultCacheScope,
4610 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
4611 pub meta: ::std::option::Option<ResultMetaObject>,
4612 /**An opaque token representing the pagination position after the last returned result.
4613 If present, there may be more results available.*/
4614 #[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
4615 pub next_cursor: ::std::option::Option<::std::string::String>,
4616 #[serde(rename = "resourceTemplates")]
4617 pub resource_templates: ::std::vec::Vec<ResourceTemplate>,
4618 /**Indicates the type of the result, which allows the client to determine
4619 how to parse the result object.
4620 Servers implementing this protocol version MUST include this field.
4621 For backward compatibility, when a client receives a result from a
4622 server implementing an earlier protocol version (which does not include
4623 resultType), the client MUST treat the absent field as "complete".*/
4624 #[serde(rename = "resultType")]
4625 pub result_type: ::std::string::String,
4626 /**A hint from the server indicating how long (in milliseconds) the
4627 client MAY cache this response before re-fetching. Semantics are
4628 analogous to HTTP Cache-Control max-age.
4629 - If 0, The response SHOULD be considered immediately stale,
4630 The client MAY re-fetch every time the result is needed.
4631 - If positive, the client SHOULD consider the result fresh for this many
4632 milliseconds after receiving the response.*/
4633 #[serde(rename = "ttlMs")]
4634 pub ttl_ms: u64,
4635}
4636/**Indicates the intended scope of the cached response, analogous to HTTP
4637Cache-Control: public vs Cache-Control: private.
4638- "public": The response does not contain user-specific data. Any
4639 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
4640 the response and serve it across authorization contexts.
4641- "private": The response MAY be cached and reused only within the
4642 same authorization context. Caches MUST NOT be shared across
4643 authorization contexts (e.g., a different access token requires a
4644 different cache).*/
4645///
4646/// <details><summary>JSON schema</summary>
4647///
4648/// ```json
4649///{
4650/// "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).",
4651/// "type": "string",
4652/// "enum": [
4653/// "private",
4654/// "public"
4655/// ]
4656///}
4657/// ```
4658/// </details>
4659#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4660pub enum ListResourceTemplatesResultCacheScope {
4661 #[serde(rename = "private")]
4662 Private,
4663 #[serde(rename = "public")]
4664 Public,
4665}
4666impl ::std::fmt::Display for ListResourceTemplatesResultCacheScope {
4667 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4668 match *self {
4669 Self::Private => write!(f, "private"),
4670 Self::Public => write!(f, "public"),
4671 }
4672 }
4673}
4674///A successful response from the server for a {@link ListResourceTemplatesRequestresources/templates/list} request.
4675///
4676/// <details><summary>JSON schema</summary>
4677///
4678/// ```json
4679///{
4680/// "description": "A successful response from the server for a {@link ListResourceTemplatesRequestresources/templates/list} request.",
4681/// "type": "object",
4682/// "required": [
4683/// "id",
4684/// "jsonrpc",
4685/// "result"
4686/// ],
4687/// "properties": {
4688/// "id": {
4689/// "$ref": "#/$defs/RequestId"
4690/// },
4691/// "jsonrpc": {
4692/// "type": "string",
4693/// "const": "2.0"
4694/// },
4695/// "result": {
4696/// "$ref": "#/$defs/ListResourceTemplatesResult"
4697/// }
4698/// }
4699///}
4700/// ```
4701/// </details>
4702#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4703pub struct ListResourceTemplatesResultResponse {
4704 pub id: RequestId,
4705 #[serde(deserialize_with = "validate::list_resource_templates_result_response_jsonrpc")]
4706 jsonrpc: ::std::string::String,
4707 pub result: ListResourceTemplatesResult,
4708}
4709impl ListResourceTemplatesResultResponse {
4710 pub fn new(id: RequestId, result: ListResourceTemplatesResult) -> Self {
4711 Self {
4712 id,
4713 jsonrpc: JSONRPC_VERSION.to_string(),
4714 result,
4715 }
4716 }
4717 pub fn jsonrpc(&self) -> &::std::string::String {
4718 &self.jsonrpc
4719 }
4720}
4721///Sent from the client to request a list of resources the server has.
4722///
4723/// <details><summary>JSON schema</summary>
4724///
4725/// ```json
4726///{
4727/// "description": "Sent from the client to request a list of resources the server has.",
4728/// "type": "object",
4729/// "required": [
4730/// "id",
4731/// "jsonrpc",
4732/// "method",
4733/// "params"
4734/// ],
4735/// "properties": {
4736/// "id": {
4737/// "$ref": "#/$defs/RequestId"
4738/// },
4739/// "jsonrpc": {
4740/// "type": "string",
4741/// "const": "2.0"
4742/// },
4743/// "method": {
4744/// "type": "string",
4745/// "const": "resources/list"
4746/// },
4747/// "params": {
4748/// "$ref": "#/$defs/PaginatedRequestParams"
4749/// }
4750/// }
4751///}
4752/// ```
4753/// </details>
4754#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4755pub struct ListResourcesRequest {
4756 pub id: RequestId,
4757 #[serde(deserialize_with = "validate::list_resources_request_jsonrpc")]
4758 jsonrpc: ::std::string::String,
4759 #[serde(deserialize_with = "validate::list_resources_request_method")]
4760 method: ::std::string::String,
4761 pub params: PaginatedRequestParams,
4762}
4763impl ListResourcesRequest {
4764 pub fn new(id: RequestId, params: PaginatedRequestParams) -> Self {
4765 Self {
4766 id,
4767 jsonrpc: JSONRPC_VERSION.to_string(),
4768 method: "resources/list".to_string(),
4769 params,
4770 }
4771 }
4772 pub fn jsonrpc(&self) -> &::std::string::String {
4773 &self.jsonrpc
4774 }
4775 pub fn method(&self) -> &::std::string::String {
4776 &self.method
4777 }
4778 /// returns "resources/list"
4779 pub fn method_value() -> &'static str {
4780 "resources/list"
4781 }
4782 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
4783 pub fn method_name() -> &'static str {
4784 "resources/list"
4785 }
4786}
4787///The result returned by the server for a {@link ListResourcesRequestresources/list} request.
4788///
4789/// <details><summary>JSON schema</summary>
4790///
4791/// ```json
4792///{
4793/// "description": "The result returned by the server for a {@link ListResourcesRequestresources/list} request.",
4794/// "type": "object",
4795/// "required": [
4796/// "cacheScope",
4797/// "resources",
4798/// "resultType",
4799/// "ttlMs"
4800/// ],
4801/// "properties": {
4802/// "_meta": {
4803/// "$ref": "#/$defs/ResultMetaObject"
4804/// },
4805/// "cacheScope": {
4806/// "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).",
4807/// "type": "string",
4808/// "enum": [
4809/// "private",
4810/// "public"
4811/// ]
4812/// },
4813/// "nextCursor": {
4814/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
4815/// "type": "string"
4816/// },
4817/// "resources": {
4818/// "type": "array",
4819/// "items": {
4820/// "$ref": "#/$defs/Resource"
4821/// }
4822/// },
4823/// "resultType": {
4824/// "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\".",
4825/// "type": "string"
4826/// },
4827/// "ttlMs": {
4828/// "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.",
4829/// "type": "integer",
4830/// "minimum": 0.0
4831/// }
4832/// }
4833///}
4834/// ```
4835/// </details>
4836#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4837pub struct ListResourcesResult {
4838 /**Indicates the intended scope of the cached response, analogous to HTTP
4839 Cache-Control: public vs Cache-Control: private.
4840 - "public": The response does not contain user-specific data. Any
4841 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
4842 the response and serve it across authorization contexts.
4843 - "private": The response MAY be cached and reused only within the
4844 same authorization context. Caches MUST NOT be shared across
4845 authorization contexts (e.g., a different access token requires a
4846 different cache).*/
4847 #[serde(rename = "cacheScope")]
4848 pub cache_scope: ListResourcesResultCacheScope,
4849 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
4850 pub meta: ::std::option::Option<ResultMetaObject>,
4851 /**An opaque token representing the pagination position after the last returned result.
4852 If present, there may be more results available.*/
4853 #[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
4854 pub next_cursor: ::std::option::Option<::std::string::String>,
4855 pub resources: ::std::vec::Vec<Resource>,
4856 /**Indicates the type of the result, which allows the client to determine
4857 how to parse the result object.
4858 Servers implementing this protocol version MUST include this field.
4859 For backward compatibility, when a client receives a result from a
4860 server implementing an earlier protocol version (which does not include
4861 resultType), the client MUST treat the absent field as "complete".*/
4862 #[serde(rename = "resultType")]
4863 pub result_type: ::std::string::String,
4864 /**A hint from the server indicating how long (in milliseconds) the
4865 client MAY cache this response before re-fetching. Semantics are
4866 analogous to HTTP Cache-Control max-age.
4867 - If 0, The response SHOULD be considered immediately stale,
4868 The client MAY re-fetch every time the result is needed.
4869 - If positive, the client SHOULD consider the result fresh for this many
4870 milliseconds after receiving the response.*/
4871 #[serde(rename = "ttlMs")]
4872 pub ttl_ms: u64,
4873}
4874/**Indicates the intended scope of the cached response, analogous to HTTP
4875Cache-Control: public vs Cache-Control: private.
4876- "public": The response does not contain user-specific data. Any
4877 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
4878 the response and serve it across authorization contexts.
4879- "private": The response MAY be cached and reused only within the
4880 same authorization context. Caches MUST NOT be shared across
4881 authorization contexts (e.g., a different access token requires a
4882 different cache).*/
4883///
4884/// <details><summary>JSON schema</summary>
4885///
4886/// ```json
4887///{
4888/// "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).",
4889/// "type": "string",
4890/// "enum": [
4891/// "private",
4892/// "public"
4893/// ]
4894///}
4895/// ```
4896/// </details>
4897#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4898pub enum ListResourcesResultCacheScope {
4899 #[serde(rename = "private")]
4900 Private,
4901 #[serde(rename = "public")]
4902 Public,
4903}
4904impl ::std::fmt::Display for ListResourcesResultCacheScope {
4905 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4906 match *self {
4907 Self::Private => write!(f, "private"),
4908 Self::Public => write!(f, "public"),
4909 }
4910 }
4911}
4912///A successful response from the server for a {@link ListResourcesRequestresources/list} request.
4913///
4914/// <details><summary>JSON schema</summary>
4915///
4916/// ```json
4917///{
4918/// "description": "A successful response from the server for a {@link ListResourcesRequestresources/list} request.",
4919/// "type": "object",
4920/// "required": [
4921/// "id",
4922/// "jsonrpc",
4923/// "result"
4924/// ],
4925/// "properties": {
4926/// "id": {
4927/// "$ref": "#/$defs/RequestId"
4928/// },
4929/// "jsonrpc": {
4930/// "type": "string",
4931/// "const": "2.0"
4932/// },
4933/// "result": {
4934/// "$ref": "#/$defs/ListResourcesResult"
4935/// }
4936/// }
4937///}
4938/// ```
4939/// </details>
4940#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4941pub struct ListResourcesResultResponse {
4942 pub id: RequestId,
4943 #[serde(deserialize_with = "validate::list_resources_result_response_jsonrpc")]
4944 jsonrpc: ::std::string::String,
4945 pub result: ListResourcesResult,
4946}
4947impl ListResourcesResultResponse {
4948 pub fn new(id: RequestId, result: ListResourcesResult) -> Self {
4949 Self {
4950 id,
4951 jsonrpc: JSONRPC_VERSION.to_string(),
4952 result,
4953 }
4954 }
4955 pub fn jsonrpc(&self) -> &::std::string::String {
4956 &self.jsonrpc
4957 }
4958}
4959/**Sent from the server to request a list of root URIs from the client. Roots allow
4960servers to ask for specific directories or files to operate on. A common example
4961for roots is providing a set of repositories or directories a server should operate
4962on.
4963This request is typically used when the server needs to understand the file system
4964structure or access specific locations that the client has permission to read from.*/
4965///
4966/// <details><summary>JSON schema</summary>
4967///
4968/// ```json
4969///{
4970/// "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.",
4971/// "type": "object",
4972/// "required": [
4973/// "method"
4974/// ],
4975/// "properties": {
4976/// "method": {
4977/// "type": "string",
4978/// "const": "roots/list"
4979/// },
4980/// "params": {
4981/// "type": "object",
4982/// "properties": {
4983/// "_meta": {
4984/// "$ref": "#/$defs/MetaObject"
4985/// }
4986/// }
4987/// }
4988/// }
4989///}
4990/// ```
4991/// </details>
4992#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4993pub struct ListRootsRequest {
4994 #[serde(deserialize_with = "validate::list_roots_request_method")]
4995 method: ::std::string::String,
4996 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4997 pub params: ::std::option::Option<ListRootsRequestParams>,
4998}
4999impl ListRootsRequest {
5000 pub fn new(params: ::std::option::Option<ListRootsRequestParams>) -> Self {
5001 Self {
5002 method: "roots/list".to_string(),
5003 params,
5004 }
5005 }
5006 pub fn method(&self) -> &::std::string::String {
5007 &self.method
5008 }
5009 /// returns "roots/list"
5010 pub fn method_value() -> &'static str {
5011 "roots/list"
5012 }
5013 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
5014 pub fn method_name() -> &'static str {
5015 "roots/list"
5016 }
5017}
5018///ListRootsRequestParams
5019///
5020/// <details><summary>JSON schema</summary>
5021///
5022/// ```json
5023///{
5024/// "type": "object",
5025/// "properties": {
5026/// "_meta": {
5027/// "$ref": "#/$defs/MetaObject"
5028/// }
5029/// }
5030///}
5031/// ```
5032/// </details>
5033#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5034pub struct ListRootsRequestParams {
5035 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
5036 pub meta: ::std::option::Option<MetaObject>,
5037}
5038/**The result returned by the client for a {@link ListRootsRequestroots/list} request.
5039This result contains an array of {@link Root} objects, each representing a root directory
5040or file that the server can operate on.*/
5041///
5042/// <details><summary>JSON schema</summary>
5043///
5044/// ```json
5045///{
5046/// "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.",
5047/// "type": "object",
5048/// "required": [
5049/// "roots"
5050/// ],
5051/// "properties": {
5052/// "roots": {
5053/// "type": "array",
5054/// "items": {
5055/// "$ref": "#/$defs/Root"
5056/// }
5057/// }
5058/// }
5059///}
5060/// ```
5061/// </details>
5062#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5063pub struct ListRootsResult {
5064 pub roots: ::std::vec::Vec<Root>,
5065}
5066///Sent from the client to request a list of tools the server has.
5067///
5068/// <details><summary>JSON schema</summary>
5069///
5070/// ```json
5071///{
5072/// "description": "Sent from the client to request a list of tools the server has.",
5073/// "type": "object",
5074/// "required": [
5075/// "id",
5076/// "jsonrpc",
5077/// "method",
5078/// "params"
5079/// ],
5080/// "properties": {
5081/// "id": {
5082/// "$ref": "#/$defs/RequestId"
5083/// },
5084/// "jsonrpc": {
5085/// "type": "string",
5086/// "const": "2.0"
5087/// },
5088/// "method": {
5089/// "type": "string",
5090/// "const": "tools/list"
5091/// },
5092/// "params": {
5093/// "$ref": "#/$defs/PaginatedRequestParams"
5094/// }
5095/// }
5096///}
5097/// ```
5098/// </details>
5099#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5100pub struct ListToolsRequest {
5101 pub id: RequestId,
5102 #[serde(deserialize_with = "validate::list_tools_request_jsonrpc")]
5103 jsonrpc: ::std::string::String,
5104 #[serde(deserialize_with = "validate::list_tools_request_method")]
5105 method: ::std::string::String,
5106 pub params: PaginatedRequestParams,
5107}
5108impl ListToolsRequest {
5109 pub fn new(id: RequestId, params: PaginatedRequestParams) -> Self {
5110 Self {
5111 id,
5112 jsonrpc: JSONRPC_VERSION.to_string(),
5113 method: "tools/list".to_string(),
5114 params,
5115 }
5116 }
5117 pub fn jsonrpc(&self) -> &::std::string::String {
5118 &self.jsonrpc
5119 }
5120 pub fn method(&self) -> &::std::string::String {
5121 &self.method
5122 }
5123 /// returns "tools/list"
5124 pub fn method_value() -> &'static str {
5125 "tools/list"
5126 }
5127 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
5128 pub fn method_name() -> &'static str {
5129 "tools/list"
5130 }
5131}
5132///The result returned by the server for a {@link ListToolsRequesttools/list} request.
5133///
5134/// <details><summary>JSON schema</summary>
5135///
5136/// ```json
5137///{
5138/// "description": "The result returned by the server for a {@link ListToolsRequesttools/list} request.",
5139/// "type": "object",
5140/// "required": [
5141/// "cacheScope",
5142/// "resultType",
5143/// "tools",
5144/// "ttlMs"
5145/// ],
5146/// "properties": {
5147/// "_meta": {
5148/// "$ref": "#/$defs/ResultMetaObject"
5149/// },
5150/// "cacheScope": {
5151/// "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).",
5152/// "type": "string",
5153/// "enum": [
5154/// "private",
5155/// "public"
5156/// ]
5157/// },
5158/// "nextCursor": {
5159/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
5160/// "type": "string"
5161/// },
5162/// "resultType": {
5163/// "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\".",
5164/// "type": "string"
5165/// },
5166/// "tools": {
5167/// "type": "array",
5168/// "items": {
5169/// "$ref": "#/$defs/Tool"
5170/// }
5171/// },
5172/// "ttlMs": {
5173/// "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.",
5174/// "type": "integer",
5175/// "minimum": 0.0
5176/// }
5177/// }
5178///}
5179/// ```
5180/// </details>
5181#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5182pub struct ListToolsResult {
5183 /**Indicates the intended scope of the cached response, analogous to HTTP
5184 Cache-Control: public vs Cache-Control: private.
5185 - "public": The response does not contain user-specific data. Any
5186 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
5187 the response and serve it across authorization contexts.
5188 - "private": The response MAY be cached and reused only within the
5189 same authorization context. Caches MUST NOT be shared across
5190 authorization contexts (e.g., a different access token requires a
5191 different cache).*/
5192 #[serde(rename = "cacheScope")]
5193 pub cache_scope: ListToolsResultCacheScope,
5194 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
5195 pub meta: ::std::option::Option<ResultMetaObject>,
5196 /**An opaque token representing the pagination position after the last returned result.
5197 If present, there may be more results available.*/
5198 #[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
5199 pub next_cursor: ::std::option::Option<::std::string::String>,
5200 /**Indicates the type of the result, which allows the client to determine
5201 how to parse the result object.
5202 Servers implementing this protocol version MUST include this field.
5203 For backward compatibility, when a client receives a result from a
5204 server implementing an earlier protocol version (which does not include
5205 resultType), the client MUST treat the absent field as "complete".*/
5206 #[serde(rename = "resultType")]
5207 pub result_type: ::std::string::String,
5208 pub tools: ::std::vec::Vec<Tool>,
5209 /**A hint from the server indicating how long (in milliseconds) the
5210 client MAY cache this response before re-fetching. Semantics are
5211 analogous to HTTP Cache-Control max-age.
5212 - If 0, The response SHOULD be considered immediately stale,
5213 The client MAY re-fetch every time the result is needed.
5214 - If positive, the client SHOULD consider the result fresh for this many
5215 milliseconds after receiving the response.*/
5216 #[serde(rename = "ttlMs")]
5217 pub ttl_ms: u64,
5218}
5219/**Indicates the intended scope of the cached response, analogous to HTTP
5220Cache-Control: public vs Cache-Control: private.
5221- "public": The response does not contain user-specific data. Any
5222 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
5223 the response and serve it across authorization contexts.
5224- "private": The response MAY be cached and reused only within the
5225 same authorization context. Caches MUST NOT be shared across
5226 authorization contexts (e.g., a different access token requires a
5227 different cache).*/
5228///
5229/// <details><summary>JSON schema</summary>
5230///
5231/// ```json
5232///{
5233/// "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).",
5234/// "type": "string",
5235/// "enum": [
5236/// "private",
5237/// "public"
5238/// ]
5239///}
5240/// ```
5241/// </details>
5242#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5243pub enum ListToolsResultCacheScope {
5244 #[serde(rename = "private")]
5245 Private,
5246 #[serde(rename = "public")]
5247 Public,
5248}
5249impl ::std::fmt::Display for ListToolsResultCacheScope {
5250 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5251 match *self {
5252 Self::Private => write!(f, "private"),
5253 Self::Public => write!(f, "public"),
5254 }
5255 }
5256}
5257///A successful response from the server for a {@link ListToolsRequesttools/list} request.
5258///
5259/// <details><summary>JSON schema</summary>
5260///
5261/// ```json
5262///{
5263/// "description": "A successful response from the server for a {@link ListToolsRequesttools/list} request.",
5264/// "type": "object",
5265/// "required": [
5266/// "id",
5267/// "jsonrpc",
5268/// "result"
5269/// ],
5270/// "properties": {
5271/// "id": {
5272/// "$ref": "#/$defs/RequestId"
5273/// },
5274/// "jsonrpc": {
5275/// "type": "string",
5276/// "const": "2.0"
5277/// },
5278/// "result": {
5279/// "$ref": "#/$defs/ListToolsResult"
5280/// }
5281/// }
5282///}
5283/// ```
5284/// </details>
5285#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5286pub struct ListToolsResultResponse {
5287 pub id: RequestId,
5288 #[serde(deserialize_with = "validate::list_tools_result_response_jsonrpc")]
5289 jsonrpc: ::std::string::String,
5290 pub result: ListToolsResult,
5291}
5292impl ListToolsResultResponse {
5293 pub fn new(id: RequestId, result: ListToolsResult) -> Self {
5294 Self {
5295 id,
5296 jsonrpc: JSONRPC_VERSION.to_string(),
5297 result,
5298 }
5299 }
5300 pub fn jsonrpc(&self) -> &::std::string::String {
5301 &self.jsonrpc
5302 }
5303}
5304/**The severity of a log message.
5305These map to syslog message severities, as specified in RFC-5424:
5306<https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1>*/
5307///
5308/// <details><summary>JSON schema</summary>
5309///
5310/// ```json
5311///{
5312/// "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>",
5313/// "type": "string",
5314/// "enum": [
5315/// "alert",
5316/// "critical",
5317/// "debug",
5318/// "emergency",
5319/// "error",
5320/// "info",
5321/// "notice",
5322/// "warning"
5323/// ]
5324///}
5325/// ```
5326/// </details>
5327#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5328pub enum LoggingLevel {
5329 #[serde(rename = "alert")]
5330 Alert,
5331 #[serde(rename = "critical")]
5332 Critical,
5333 #[serde(rename = "debug")]
5334 Debug,
5335 #[serde(rename = "emergency")]
5336 Emergency,
5337 #[serde(rename = "error")]
5338 Error,
5339 #[serde(rename = "info")]
5340 #[default]
5341 Info,
5342 #[serde(rename = "notice")]
5343 Notice,
5344 #[serde(rename = "warning")]
5345 Warning,
5346}
5347impl ::std::fmt::Display for LoggingLevel {
5348 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5349 match *self {
5350 Self::Alert => write!(f, "alert"),
5351 Self::Critical => write!(f, "critical"),
5352 Self::Debug => write!(f, "debug"),
5353 Self::Emergency => write!(f, "emergency"),
5354 Self::Error => write!(f, "error"),
5355 Self::Info => write!(f, "info"),
5356 Self::Notice => write!(f, "notice"),
5357 Self::Warning => write!(f, "warning"),
5358 }
5359 }
5360}
5361///JSONRPCNotification of a log message passed from server to client. The client opts in by setting "io.modelcontextprotocol/logLevel" in a request's _meta.
5362///
5363/// <details><summary>JSON schema</summary>
5364///
5365/// ```json
5366///{
5367/// "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.",
5368/// "type": "object",
5369/// "required": [
5370/// "jsonrpc",
5371/// "method",
5372/// "params"
5373/// ],
5374/// "properties": {
5375/// "jsonrpc": {
5376/// "type": "string",
5377/// "const": "2.0"
5378/// },
5379/// "method": {
5380/// "type": "string",
5381/// "const": "notifications/message"
5382/// },
5383/// "params": {
5384/// "$ref": "#/$defs/LoggingMessageNotificationParams"
5385/// }
5386/// }
5387///}
5388/// ```
5389/// </details>
5390#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5391pub struct LoggingMessageNotification {
5392 #[serde(deserialize_with = "validate::logging_message_notification_jsonrpc")]
5393 jsonrpc: ::std::string::String,
5394 #[serde(deserialize_with = "validate::logging_message_notification_method")]
5395 method: ::std::string::String,
5396 pub params: LoggingMessageNotificationParams,
5397}
5398impl LoggingMessageNotification {
5399 pub fn new(params: LoggingMessageNotificationParams) -> Self {
5400 Self {
5401 jsonrpc: JSONRPC_VERSION.to_string(),
5402 method: "notifications/message".to_string(),
5403 params,
5404 }
5405 }
5406 pub fn jsonrpc(&self) -> &::std::string::String {
5407 &self.jsonrpc
5408 }
5409 pub fn method(&self) -> &::std::string::String {
5410 &self.method
5411 }
5412 /// returns "notifications/message"
5413 pub fn method_value() -> &'static str {
5414 "notifications/message"
5415 }
5416 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
5417 pub fn method_name() -> &'static str {
5418 "notifications/message"
5419 }
5420}
5421///Parameters for a notifications/message notification.
5422///
5423/// <details><summary>JSON schema</summary>
5424///
5425/// ```json
5426///{
5427/// "description": "Parameters for a notifications/message notification.",
5428/// "type": "object",
5429/// "required": [
5430/// "data",
5431/// "level"
5432/// ],
5433/// "properties": {
5434/// "_meta": {
5435/// "$ref": "#/$defs/NotificationMetaObject"
5436/// },
5437/// "data": {
5438/// "description": "The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here."
5439/// },
5440/// "level": {
5441/// "description": "The severity of this log message.",
5442/// "$ref": "#/$defs/LoggingLevel"
5443/// },
5444/// "logger": {
5445/// "description": "An optional name of the logger issuing this message.",
5446/// "type": "string"
5447/// }
5448/// }
5449///}
5450/// ```
5451/// </details>
5452#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5453pub struct LoggingMessageNotificationParams {
5454 ///The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
5455 pub data: ::serde_json::Value,
5456 ///The severity of this log message.
5457 pub level: LoggingLevel,
5458 ///An optional name of the logger issuing this message.
5459 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5460 pub logger: ::std::option::Option<::std::string::String>,
5461 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
5462 pub meta: ::std::option::Option<NotificationMetaObject>,
5463}
5464/**Represents the contents of a _meta field, which clients and servers use to attach additional metadata to their interactions.
5465Certain 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.
5466Valid keys have two segments:
5467**Prefix:**
5468- Optional — if specified, MUST be a series of _labels_ separated by dots (.), followed by a slash (/).
5469- Labels MUST start with a letter and end with a letter or digit. Interior characters may be letters, digits, or hyphens (-).
5470- Implementations SHOULD use reverse DNS notation (e.g., com.example/ rather than example.com/).
5471- 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.
5472**Name:**
5473- Unless empty, MUST start and end with an alphanumeric character ([a-z0-9A-Z]).
5474- Interior characters may be alphanumeric, hyphens (-), underscores (_), or dots (.).*/
5475///
5476/// <details><summary>JSON schema</summary>
5477///
5478/// ```json
5479///{
5480/// "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 (.).",
5481/// "type": "object",
5482/// "additionalProperties": {}
5483///}
5484/// ```
5485/// </details>
5486#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5487#[serde(transparent)]
5488pub struct MetaObject(pub ::serde_json::Map<::std::string::String, ::serde_json::Value>);
5489/**A JSON-RPC error indicating that the requested method does not exist or is not available.
5490In 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).
5491A request that requires a client capability the client did not declare is signalled instead by {@link MissingRequiredClientCapabilityError} (-32021).*/
5492///
5493/// <details><summary>JSON schema</summary>
5494///
5495/// ```json
5496///{
5497/// "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).",
5498/// "type": "object",
5499/// "required": [
5500/// "code",
5501/// "message"
5502/// ],
5503/// "properties": {
5504/// "code": {
5505/// "description": "The error type that occurred.",
5506/// "type": "integer",
5507/// "const": -32601
5508/// },
5509/// "data": {
5510/// "description": "Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.)."
5511/// },
5512/// "message": {
5513/// "description": "A short description of the error. The message SHOULD be limited to a concise single sentence.",
5514/// "type": "string"
5515/// }
5516/// }
5517///}
5518/// ```
5519/// </details>
5520#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5521pub struct MethodNotFoundError {
5522 ///The error type that occurred.
5523 pub code: i64,
5524 ///Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
5525 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5526 pub data: ::std::option::Option<::serde_json::Value>,
5527 ///A short description of the error. The message SHOULD be limited to a concise single sentence.
5528 pub message: ::std::string::String,
5529}
5530/**Returned when processing a request requires a capability the client did not
5531declare in clientCapabilities. For HTTP, the response status code MUST be
5532400 Bad Request.*/
5533///
5534/// <details><summary>JSON schema</summary>
5535///
5536/// ```json
5537///{
5538/// "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.",
5539/// "type": "object",
5540/// "required": [
5541/// "error",
5542/// "jsonrpc"
5543/// ],
5544/// "properties": {
5545/// "error": {
5546/// "allOf": [
5547/// {
5548/// "$ref": "#/$defs/Error"
5549/// },
5550/// {
5551/// "type": "object",
5552/// "required": [
5553/// "code",
5554/// "data"
5555/// ],
5556/// "properties": {
5557/// "code": {
5558/// "type": "integer"
5559/// },
5560/// "data": {
5561/// "type": "object",
5562/// "required": [
5563/// "requiredCapabilities"
5564/// ],
5565/// "properties": {
5566/// "requiredCapabilities": {
5567/// "description": "The capabilities the server requires from the client to process this request.",
5568/// "$ref": "#/$defs/ClientCapabilities"
5569/// }
5570/// }
5571/// }
5572/// }
5573/// }
5574/// ]
5575/// },
5576/// "id": {
5577/// "$ref": "#/$defs/RequestId"
5578/// },
5579/// "jsonrpc": {
5580/// "type": "string",
5581/// "const": "2.0"
5582/// }
5583/// }
5584///}
5585/// ```
5586/// </details>
5587#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5588pub struct MissingRequiredClientCapabilityError {
5589 pub error: MissingRequiredClientCapabilityErrorError,
5590 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5591 pub id: ::std::option::Option<RequestId>,
5592 #[serde(deserialize_with = "validate::missing_required_client_capability_error_jsonrpc")]
5593 jsonrpc: ::std::string::String,
5594}
5595impl MissingRequiredClientCapabilityError {
5596 pub fn new(error: MissingRequiredClientCapabilityErrorError, id: ::std::option::Option<RequestId>) -> Self {
5597 Self {
5598 error,
5599 id,
5600 jsonrpc: JSONRPC_VERSION.to_string(),
5601 }
5602 }
5603 pub fn jsonrpc(&self) -> &::std::string::String {
5604 &self.jsonrpc
5605 }
5606}
5607///MissingRequiredClientCapabilityErrorError
5608///
5609/// <details><summary>JSON schema</summary>
5610///
5611/// ```json
5612///{
5613/// "allOf": [
5614/// {
5615/// "$ref": "#/$defs/Error"
5616/// },
5617/// {
5618/// "type": "object",
5619/// "required": [
5620/// "code",
5621/// "data"
5622/// ],
5623/// "properties": {
5624/// "code": {
5625/// "type": "integer"
5626/// },
5627/// "data": {
5628/// "type": "object",
5629/// "required": [
5630/// "requiredCapabilities"
5631/// ],
5632/// "properties": {
5633/// "requiredCapabilities": {
5634/// "description": "The capabilities the server requires from the client to process this request.",
5635/// "$ref": "#/$defs/ClientCapabilities"
5636/// }
5637/// }
5638/// }
5639/// }
5640/// }
5641/// ]
5642///}
5643/// ```
5644/// </details>
5645#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5646pub struct MissingRequiredClientCapabilityErrorError {
5647 pub code: i64,
5648 pub data: MissingRequiredClientCapabilityErrorErrorData,
5649 ///A short description of the error. The message SHOULD be limited to a concise single sentence.
5650 pub message: ::std::string::String,
5651}
5652///MissingRequiredClientCapabilityErrorErrorData
5653///
5654/// <details><summary>JSON schema</summary>
5655///
5656/// ```json
5657///{
5658/// "type": "object",
5659/// "required": [
5660/// "requiredCapabilities"
5661/// ],
5662/// "properties": {
5663/// "requiredCapabilities": {
5664/// "description": "The capabilities the server requires from the client to process this request.",
5665/// "$ref": "#/$defs/ClientCapabilities"
5666/// }
5667/// }
5668///}
5669/// ```
5670/// </details>
5671#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5672pub struct MissingRequiredClientCapabilityErrorErrorData {
5673 ///The capabilities the server requires from the client to process this request.
5674 #[serde(rename = "requiredCapabilities")]
5675 pub required_capabilities: ClientCapabilities,
5676}
5677/**Hints to use for model selection.
5678Keys not declared here are currently left unspecified by the spec and are up
5679to the client to interpret.*/
5680///
5681/// <details><summary>JSON schema</summary>
5682///
5683/// ```json
5684///{
5685/// "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.",
5686/// "type": "object",
5687/// "properties": {
5688/// "name": {
5689/// "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",
5690/// "type": "string"
5691/// }
5692/// }
5693///}
5694/// ```
5695/// </details>
5696#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5697pub struct ModelHint {
5698 /**A hint for a model name.
5699 The client SHOULD treat this as a substring of a model name; for example:
5700 - claude-3-5-sonnet should match claude-3-5-sonnet-20241022
5701 - sonnet should match claude-3-5-sonnet-20241022, claude-3-sonnet-20240229, etc.
5702 - claude should match any Claude model
5703 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:
5704 - gemini-1.5-flash could match claude-3-haiku-20240307*/
5705 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5706 pub name: ::std::option::Option<::std::string::String>,
5707}
5708/**The server's preferences for model selection, requested of the client during sampling.
5709Because LLMs can vary along multiple dimensions, choosing the "best" model is
5710rarely straightforward. Different models excel in different areas—some are
5711faster but less capable, others are more capable but more expensive, and so
5712on. This interface allows servers to express their priorities across multiple
5713dimensions to help clients make an appropriate selection for their use case.
5714These preferences are always advisory. The client MAY ignore them. It is also
5715up to the client to decide how to interpret these preferences and how to
5716balance them against other considerations.*/
5717///
5718/// <details><summary>JSON schema</summary>
5719///
5720/// ```json
5721///{
5722/// "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.",
5723/// "type": "object",
5724/// "properties": {
5725/// "costPriority": {
5726/// "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.",
5727/// "type": "number",
5728/// "maximum": 1.0,
5729/// "minimum": 0.0
5730/// },
5731/// "hints": {
5732/// "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.",
5733/// "type": "array",
5734/// "items": {
5735/// "$ref": "#/$defs/ModelHint"
5736/// }
5737/// },
5738/// "intelligencePriority": {
5739/// "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.",
5740/// "type": "number",
5741/// "maximum": 1.0,
5742/// "minimum": 0.0
5743/// },
5744/// "speedPriority": {
5745/// "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.",
5746/// "type": "number",
5747/// "maximum": 1.0,
5748/// "minimum": 0.0
5749/// }
5750/// }
5751///}
5752/// ```
5753/// </details>
5754#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5755pub struct ModelPreferences {
5756 #[serde(rename = "costPriority", default, skip_serializing_if = "::std::option::Option::is_none")]
5757 pub cost_priority: ::std::option::Option<f64>,
5758 /**Optional hints to use for model selection.
5759 If multiple hints are specified, the client MUST evaluate them in order
5760 (such that the first match is taken).
5761 The client SHOULD prioritize these hints over the numeric priorities, but
5762 MAY still use the priorities to select from ambiguous matches.*/
5763 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
5764 pub hints: ::std::vec::Vec<ModelHint>,
5765 #[serde(
5766 rename = "intelligencePriority",
5767 default,
5768 skip_serializing_if = "::std::option::Option::is_none"
5769 )]
5770 pub intelligence_priority: ::std::option::Option<f64>,
5771 #[serde(rename = "speedPriority", default, skip_serializing_if = "::std::option::Option::is_none")]
5772 pub speed_priority: ::std::option::Option<f64>,
5773}
5774///MultiSelectEnumSchema
5775///
5776/// <details><summary>JSON schema</summary>
5777///
5778/// ```json
5779///{
5780/// "anyOf": [
5781/// {
5782/// "$ref": "#/$defs/UntitledMultiSelectEnumSchema"
5783/// },
5784/// {
5785/// "$ref": "#/$defs/TitledMultiSelectEnumSchema"
5786/// }
5787/// ]
5788///}
5789/// ```
5790/// </details>
5791#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5792#[serde(untagged)]
5793pub enum MultiSelectEnumSchema {
5794 UntitledMultiSelectEnumSchema(UntitledMultiSelectEnumSchema),
5795 TitledMultiSelectEnumSchema(TitledMultiSelectEnumSchema),
5796}
5797impl ::std::convert::From<UntitledMultiSelectEnumSchema> for MultiSelectEnumSchema {
5798 fn from(value: UntitledMultiSelectEnumSchema) -> Self {
5799 Self::UntitledMultiSelectEnumSchema(value)
5800 }
5801}
5802impl ::std::convert::From<TitledMultiSelectEnumSchema> for MultiSelectEnumSchema {
5803 fn from(value: TitledMultiSelectEnumSchema) -> Self {
5804 Self::TitledMultiSelectEnumSchema(value)
5805 }
5806}
5807///Notification
5808///
5809/// <details><summary>JSON schema</summary>
5810///
5811/// ```json
5812///{
5813/// "type": "object",
5814/// "required": [
5815/// "method"
5816/// ],
5817/// "properties": {
5818/// "method": {
5819/// "type": "string"
5820/// },
5821/// "params": {
5822/// "type": "object",
5823/// "additionalProperties": {}
5824/// }
5825/// }
5826///}
5827/// ```
5828/// </details>
5829#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5830pub struct Notification {
5831 pub method: ::std::string::String,
5832 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5833 pub params: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
5834}
5835///Extends {@link MetaObject} with additional notification-specific fields. All key naming rules from MetaObject apply.
5836///
5837/// <details><summary>JSON schema</summary>
5838///
5839/// ```json
5840///{
5841/// "description": "Extends {@link MetaObject} with additional notification-specific fields. All key naming rules from MetaObject apply.",
5842/// "type": "object",
5843/// "properties": {
5844/// "io.modelcontextprotocol/subscriptionId": {
5845/// "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.",
5846/// "$ref": "#/$defs/RequestId"
5847/// }
5848/// },
5849/// "additionalProperties": {}
5850///}
5851/// ```
5852/// </details>
5853#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5854pub struct NotificationMetaObject {
5855 /**Identifies the subscription stream a notification was delivered on. The
5856 server MUST include this key on every notification delivered via a
5857 {@link SubscriptionsListenRequestsubscriptions/listen} stream, so the
5858 client can correlate the notification with the originating subscription.
5859 The key is absent on notifications not delivered via a subscription
5860 stream (e.g. progress notifications for an in-flight request), which is
5861 why it is optional here.
5862 The value is the JSON-RPC ID of the subscriptions/listen request that
5863 opened the stream.*/
5864 #[serde(
5865 rename = "io.modelcontextprotocol/subscriptionId",
5866 default,
5867 skip_serializing_if = "::std::option::Option::is_none"
5868 )]
5869 pub io_modelcontextprotocol_subscription_id: ::std::option::Option<RequestId>,
5870 #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
5871 pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
5872}
5873///Common params for any notification.
5874///
5875/// <details><summary>JSON schema</summary>
5876///
5877/// ```json
5878///{
5879/// "description": "Common params for any notification.",
5880/// "type": "object",
5881/// "properties": {
5882/// "_meta": {
5883/// "$ref": "#/$defs/NotificationMetaObject"
5884/// }
5885/// }
5886///}
5887/// ```
5888/// </details>
5889#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5890pub struct NotificationParams {
5891 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
5892 pub meta: ::std::option::Option<NotificationMetaObject>,
5893}
5894///NumberSchema
5895///
5896/// <details><summary>JSON schema</summary>
5897///
5898/// ```json
5899///{
5900/// "type": "object",
5901/// "required": [
5902/// "type"
5903/// ],
5904/// "properties": {
5905/// "default": {
5906/// "type": "number"
5907/// },
5908/// "description": {
5909/// "type": "string"
5910/// },
5911/// "maximum": {
5912/// "type": "number"
5913/// },
5914/// "minimum": {
5915/// "type": "number"
5916/// },
5917/// "title": {
5918/// "type": "string"
5919/// },
5920/// "type": {
5921/// "type": "string",
5922/// "enum": [
5923/// "integer",
5924/// "number"
5925/// ]
5926/// }
5927/// }
5928///}
5929/// ```
5930/// </details>
5931#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5932pub struct NumberSchema {
5933 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5934 pub default: ::std::option::Option<f64>,
5935 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5936 pub description: ::std::option::Option<::std::string::String>,
5937 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5938 pub maximum: ::std::option::Option<f64>,
5939 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5940 pub minimum: ::std::option::Option<f64>,
5941 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
5942 pub title: ::std::option::Option<::std::string::String>,
5943 #[serde(rename = "type")]
5944 pub type_: NumberSchemaType,
5945}
5946///NumberSchemaType
5947///
5948/// <details><summary>JSON schema</summary>
5949///
5950/// ```json
5951///{
5952/// "type": "string",
5953/// "enum": [
5954/// "integer",
5955/// "number"
5956/// ]
5957///}
5958/// ```
5959/// </details>
5960#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5961pub enum NumberSchemaType {
5962 #[serde(rename = "integer")]
5963 Integer,
5964 #[serde(rename = "number")]
5965 Number,
5966}
5967impl ::std::fmt::Display for NumberSchemaType {
5968 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5969 match *self {
5970 Self::Integer => write!(f, "integer"),
5971 Self::Number => write!(f, "number"),
5972 }
5973 }
5974}
5975///PaginatedRequest
5976///
5977/// <details><summary>JSON schema</summary>
5978///
5979/// ```json
5980///{
5981/// "type": "object",
5982/// "required": [
5983/// "id",
5984/// "jsonrpc",
5985/// "method",
5986/// "params"
5987/// ],
5988/// "properties": {
5989/// "id": {
5990/// "$ref": "#/$defs/RequestId"
5991/// },
5992/// "jsonrpc": {
5993/// "type": "string",
5994/// "const": "2.0"
5995/// },
5996/// "method": {
5997/// "type": "string"
5998/// },
5999/// "params": {
6000/// "$ref": "#/$defs/PaginatedRequestParams"
6001/// }
6002/// }
6003///}
6004/// ```
6005/// </details>
6006#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6007pub struct PaginatedRequest {
6008 pub id: RequestId,
6009 #[serde(deserialize_with = "validate::paginated_request_jsonrpc")]
6010 jsonrpc: ::std::string::String,
6011 pub method: ::std::string::String,
6012 pub params: PaginatedRequestParams,
6013}
6014impl PaginatedRequest {
6015 pub fn new(id: RequestId, method: ::std::string::String, params: PaginatedRequestParams) -> Self {
6016 Self {
6017 id,
6018 jsonrpc: JSONRPC_VERSION.to_string(),
6019 method,
6020 params,
6021 }
6022 }
6023 pub fn jsonrpc(&self) -> &::std::string::String {
6024 &self.jsonrpc
6025 }
6026}
6027///Common params for paginated requests.
6028///
6029/// <details><summary>JSON schema</summary>
6030///
6031/// ```json
6032///{
6033/// "description": "Common params for paginated requests.",
6034/// "type": "object",
6035/// "required": [
6036/// "_meta"
6037/// ],
6038/// "properties": {
6039/// "_meta": {
6040/// "$ref": "#/$defs/RequestMetaObject"
6041/// },
6042/// "cursor": {
6043/// "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
6044/// "type": "string"
6045/// }
6046/// }
6047///}
6048/// ```
6049/// </details>
6050#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
6051pub struct PaginatedRequestParams {
6052 /**An opaque token representing the current pagination position.
6053 If provided, the server should return results starting after this cursor.*/
6054 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6055 pub cursor: ::std::option::Option<::std::string::String>,
6056 #[serde(rename = "_meta")]
6057 pub meta: RequestMetaObject,
6058}
6059///PaginatedResult
6060///
6061/// <details><summary>JSON schema</summary>
6062///
6063/// ```json
6064///{
6065/// "type": "object",
6066/// "required": [
6067/// "resultType"
6068/// ],
6069/// "properties": {
6070/// "_meta": {
6071/// "$ref": "#/$defs/ResultMetaObject"
6072/// },
6073/// "nextCursor": {
6074/// "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
6075/// "type": "string"
6076/// },
6077/// "resultType": {
6078/// "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\".",
6079/// "type": "string"
6080/// }
6081/// }
6082///}
6083/// ```
6084/// </details>
6085#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
6086pub struct PaginatedResult {
6087 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
6088 pub meta: ::std::option::Option<ResultMetaObject>,
6089 /**An opaque token representing the pagination position after the last returned result.
6090 If present, there may be more results available.*/
6091 #[serde(rename = "nextCursor", default, skip_serializing_if = "::std::option::Option::is_none")]
6092 pub next_cursor: ::std::option::Option<::std::string::String>,
6093 /**Indicates the type of the result, which allows the client to determine
6094 how to parse the result object.
6095 Servers implementing this protocol version MUST include this field.
6096 For backward compatibility, when a client receives a result from a
6097 server implementing an earlier protocol version (which does not include
6098 resultType), the client MUST treat the absent field as "complete".*/
6099 #[serde(rename = "resultType")]
6100 pub result_type: ::std::string::String,
6101}
6102///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.
6103///
6104/// <details><summary>JSON schema</summary>
6105///
6106/// ```json
6107///{
6108/// "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.",
6109/// "type": "object",
6110/// "required": [
6111/// "code",
6112/// "message"
6113/// ],
6114/// "properties": {
6115/// "code": {
6116/// "description": "The error type that occurred.",
6117/// "type": "integer",
6118/// "const": -32700
6119/// },
6120/// "data": {
6121/// "description": "Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.)."
6122/// },
6123/// "message": {
6124/// "description": "A short description of the error. The message SHOULD be limited to a concise single sentence.",
6125/// "type": "string"
6126/// }
6127/// }
6128///}
6129/// ```
6130/// </details>
6131#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6132pub struct ParseError {
6133 ///The error type that occurred.
6134 pub code: i64,
6135 ///Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
6136 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6137 pub data: ::std::option::Option<::serde_json::Value>,
6138 ///A short description of the error. The message SHOULD be limited to a concise single sentence.
6139 pub message: ::std::string::String,
6140}
6141/**Restricted schema definitions that only allow primitive types
6142without nested objects or arrays.*/
6143///
6144/// <details><summary>JSON schema</summary>
6145///
6146/// ```json
6147///{
6148/// "description": "Restricted schema definitions that only allow primitive types\nwithout nested objects or arrays.",
6149/// "anyOf": [
6150/// {
6151/// "$ref": "#/$defs/StringSchema"
6152/// },
6153/// {
6154/// "$ref": "#/$defs/NumberSchema"
6155/// },
6156/// {
6157/// "$ref": "#/$defs/BooleanSchema"
6158/// },
6159/// {
6160/// "$ref": "#/$defs/UntitledSingleSelectEnumSchema"
6161/// },
6162/// {
6163/// "$ref": "#/$defs/TitledSingleSelectEnumSchema"
6164/// },
6165/// {
6166/// "$ref": "#/$defs/UntitledMultiSelectEnumSchema"
6167/// },
6168/// {
6169/// "$ref": "#/$defs/TitledMultiSelectEnumSchema"
6170/// },
6171/// {
6172/// "$ref": "#/$defs/LegacyTitledEnumSchema"
6173/// }
6174/// ]
6175///}
6176/// ```
6177/// </details>
6178#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6179#[serde(untagged)]
6180pub enum PrimitiveSchemaDefinition {
6181 StringSchema(StringSchema),
6182 NumberSchema(NumberSchema),
6183 BooleanSchema(BooleanSchema),
6184 UntitledSingleSelectEnumSchema(UntitledSingleSelectEnumSchema),
6185 TitledSingleSelectEnumSchema(TitledSingleSelectEnumSchema),
6186 UntitledMultiSelectEnumSchema(UntitledMultiSelectEnumSchema),
6187 TitledMultiSelectEnumSchema(TitledMultiSelectEnumSchema),
6188 LegacyTitledEnumSchema(LegacyTitledEnumSchema),
6189}
6190impl ::std::convert::From<StringSchema> for PrimitiveSchemaDefinition {
6191 fn from(value: StringSchema) -> Self {
6192 Self::StringSchema(value)
6193 }
6194}
6195impl ::std::convert::From<NumberSchema> for PrimitiveSchemaDefinition {
6196 fn from(value: NumberSchema) -> Self {
6197 Self::NumberSchema(value)
6198 }
6199}
6200impl ::std::convert::From<BooleanSchema> for PrimitiveSchemaDefinition {
6201 fn from(value: BooleanSchema) -> Self {
6202 Self::BooleanSchema(value)
6203 }
6204}
6205impl ::std::convert::From<UntitledSingleSelectEnumSchema> for PrimitiveSchemaDefinition {
6206 fn from(value: UntitledSingleSelectEnumSchema) -> Self {
6207 Self::UntitledSingleSelectEnumSchema(value)
6208 }
6209}
6210impl ::std::convert::From<TitledSingleSelectEnumSchema> for PrimitiveSchemaDefinition {
6211 fn from(value: TitledSingleSelectEnumSchema) -> Self {
6212 Self::TitledSingleSelectEnumSchema(value)
6213 }
6214}
6215impl ::std::convert::From<UntitledMultiSelectEnumSchema> for PrimitiveSchemaDefinition {
6216 fn from(value: UntitledMultiSelectEnumSchema) -> Self {
6217 Self::UntitledMultiSelectEnumSchema(value)
6218 }
6219}
6220impl ::std::convert::From<TitledMultiSelectEnumSchema> for PrimitiveSchemaDefinition {
6221 fn from(value: TitledMultiSelectEnumSchema) -> Self {
6222 Self::TitledMultiSelectEnumSchema(value)
6223 }
6224}
6225impl ::std::convert::From<LegacyTitledEnumSchema> for PrimitiveSchemaDefinition {
6226 fn from(value: LegacyTitledEnumSchema) -> Self {
6227 Self::LegacyTitledEnumSchema(value)
6228 }
6229}
6230///An out-of-band notification used to inform the receiver of a progress update for a long-running request.
6231///
6232/// <details><summary>JSON schema</summary>
6233///
6234/// ```json
6235///{
6236/// "description": "An out-of-band notification used to inform the receiver of a progress update for a long-running request.",
6237/// "type": "object",
6238/// "required": [
6239/// "jsonrpc",
6240/// "method",
6241/// "params"
6242/// ],
6243/// "properties": {
6244/// "jsonrpc": {
6245/// "type": "string",
6246/// "const": "2.0"
6247/// },
6248/// "method": {
6249/// "type": "string",
6250/// "const": "notifications/progress"
6251/// },
6252/// "params": {
6253/// "$ref": "#/$defs/ProgressNotificationParams"
6254/// }
6255/// }
6256///}
6257/// ```
6258/// </details>
6259#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6260pub struct ProgressNotification {
6261 #[serde(deserialize_with = "validate::progress_notification_jsonrpc")]
6262 jsonrpc: ::std::string::String,
6263 #[serde(deserialize_with = "validate::progress_notification_method")]
6264 method: ::std::string::String,
6265 pub params: ProgressNotificationParams,
6266}
6267impl ProgressNotification {
6268 pub fn new(params: ProgressNotificationParams) -> Self {
6269 Self {
6270 jsonrpc: JSONRPC_VERSION.to_string(),
6271 method: "notifications/progress".to_string(),
6272 params,
6273 }
6274 }
6275 pub fn jsonrpc(&self) -> &::std::string::String {
6276 &self.jsonrpc
6277 }
6278 pub fn method(&self) -> &::std::string::String {
6279 &self.method
6280 }
6281 /// returns "notifications/progress"
6282 pub fn method_value() -> &'static str {
6283 "notifications/progress"
6284 }
6285 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
6286 pub fn method_name() -> &'static str {
6287 "notifications/progress"
6288 }
6289}
6290///Parameters for a {@link ProgressNotificationnotifications/progress} notification.
6291///
6292/// <details><summary>JSON schema</summary>
6293///
6294/// ```json
6295///{
6296/// "description": "Parameters for a {@link ProgressNotificationnotifications/progress} notification.",
6297/// "type": "object",
6298/// "required": [
6299/// "progress",
6300/// "progressToken"
6301/// ],
6302/// "properties": {
6303/// "_meta": {
6304/// "$ref": "#/$defs/NotificationMetaObject"
6305/// },
6306/// "message": {
6307/// "description": "An optional message describing the current progress.",
6308/// "type": "string"
6309/// },
6310/// "progress": {
6311/// "description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
6312/// "type": "number"
6313/// },
6314/// "progressToken": {
6315/// "description": "The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.",
6316/// "$ref": "#/$defs/ProgressToken"
6317/// },
6318/// "total": {
6319/// "description": "Total number of items to process (or total progress required), if known.",
6320/// "type": "number"
6321/// }
6322/// }
6323///}
6324/// ```
6325/// </details>
6326#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
6327pub struct ProgressNotificationParams {
6328 ///An optional message describing the current progress.
6329 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6330 pub message: ::std::option::Option<::std::string::String>,
6331 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
6332 pub meta: ::std::option::Option<NotificationMetaObject>,
6333 pub progress: f64,
6334 ///The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
6335 #[serde(rename = "progressToken")]
6336 pub progress_token: ProgressToken,
6337 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6338 pub total: ::std::option::Option<f64>,
6339}
6340///A progress token, used to associate progress notifications with the original request.
6341///
6342/// <details><summary>JSON schema</summary>
6343///
6344/// ```json
6345///{
6346/// "description": "A progress token, used to associate progress notifications with the original request.",
6347/// "type": [
6348/// "string",
6349/// "integer"
6350/// ]
6351///}
6352/// ```
6353/// </details>
6354#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6355#[serde(untagged)]
6356pub enum ProgressToken {
6357 String(::std::string::String),
6358 Integer(i64),
6359}
6360impl ::std::convert::From<i64> for ProgressToken {
6361 fn from(value: i64) -> Self {
6362 Self::Integer(value)
6363 }
6364}
6365///A prompt or prompt template that the server offers.
6366///
6367/// <details><summary>JSON schema</summary>
6368///
6369/// ```json
6370///{
6371/// "description": "A prompt or prompt template that the server offers.",
6372/// "type": "object",
6373/// "required": [
6374/// "name"
6375/// ],
6376/// "properties": {
6377/// "_meta": {
6378/// "$ref": "#/$defs/MetaObject"
6379/// },
6380/// "arguments": {
6381/// "description": "A list of arguments to use for templating the prompt.",
6382/// "type": "array",
6383/// "items": {
6384/// "$ref": "#/$defs/PromptArgument"
6385/// }
6386/// },
6387/// "description": {
6388/// "description": "An optional description of what this prompt provides",
6389/// "type": "string"
6390/// },
6391/// "icons": {
6392/// "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)",
6393/// "type": "array",
6394/// "items": {
6395/// "$ref": "#/$defs/Icon"
6396/// }
6397/// },
6398/// "name": {
6399/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
6400/// "type": "string"
6401/// },
6402/// "title": {
6403/// "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).",
6404/// "type": "string"
6405/// }
6406/// }
6407///}
6408/// ```
6409/// </details>
6410#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6411pub struct Prompt {
6412 ///A list of arguments to use for templating the prompt.
6413 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
6414 pub arguments: ::std::vec::Vec<PromptArgument>,
6415 ///An optional description of what this prompt provides
6416 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6417 pub description: ::std::option::Option<::std::string::String>,
6418 /**Optional set of sized icons that the client can display in a user interface.
6419 Clients that support rendering icons MUST support at least the following MIME types:
6420 - image/png - PNG images (safe, universal compatibility)
6421 - image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
6422 Clients that support rendering icons SHOULD also support:
6423 - image/svg+xml - SVG images (scalable but requires security precautions)
6424 - image/webp - WebP images (modern, efficient format)*/
6425 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
6426 pub icons: ::std::vec::Vec<Icon>,
6427 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
6428 pub meta: ::std::option::Option<MetaObject>,
6429 ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
6430 pub name: ::std::string::String,
6431 /**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
6432 even by those unfamiliar with domain-specific terminology.
6433 If not provided, the name should be used for display (except for {@link Tool},
6434 where annotations.title should be given precedence over using name,
6435 if present).*/
6436 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6437 pub title: ::std::option::Option<::std::string::String>,
6438}
6439///Describes an argument that a prompt can accept.
6440///
6441/// <details><summary>JSON schema</summary>
6442///
6443/// ```json
6444///{
6445/// "description": "Describes an argument that a prompt can accept.",
6446/// "type": "object",
6447/// "required": [
6448/// "name"
6449/// ],
6450/// "properties": {
6451/// "description": {
6452/// "description": "A human-readable description of the argument.",
6453/// "type": "string"
6454/// },
6455/// "name": {
6456/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
6457/// "type": "string"
6458/// },
6459/// "required": {
6460/// "description": "Whether this argument must be provided.",
6461/// "type": "boolean"
6462/// },
6463/// "title": {
6464/// "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).",
6465/// "type": "string"
6466/// }
6467/// }
6468///}
6469/// ```
6470/// </details>
6471#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6472pub struct PromptArgument {
6473 ///A human-readable description of the argument.
6474 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6475 pub description: ::std::option::Option<::std::string::String>,
6476 ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
6477 pub name: ::std::string::String,
6478 ///Whether this argument must be provided.
6479 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6480 pub required: ::std::option::Option<bool>,
6481 /**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
6482 even by those unfamiliar with domain-specific terminology.
6483 If not provided, the name should be used for display (except for {@link Tool},
6484 where annotations.title should be given precedence over using name,
6485 if present).*/
6486 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6487 pub title: ::std::option::Option<::std::string::String>,
6488}
6489///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.
6490///
6491/// <details><summary>JSON schema</summary>
6492///
6493/// ```json
6494///{
6495/// "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.",
6496/// "type": "object",
6497/// "required": [
6498/// "jsonrpc",
6499/// "method"
6500/// ],
6501/// "properties": {
6502/// "jsonrpc": {
6503/// "type": "string",
6504/// "const": "2.0"
6505/// },
6506/// "method": {
6507/// "type": "string",
6508/// "const": "notifications/prompts/list_changed"
6509/// },
6510/// "params": {
6511/// "$ref": "#/$defs/NotificationParams"
6512/// }
6513/// }
6514///}
6515/// ```
6516/// </details>
6517#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6518pub struct PromptListChangedNotification {
6519 #[serde(deserialize_with = "validate::prompt_list_changed_notification_jsonrpc")]
6520 jsonrpc: ::std::string::String,
6521 #[serde(deserialize_with = "validate::prompt_list_changed_notification_method")]
6522 method: ::std::string::String,
6523 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6524 pub params: ::std::option::Option<NotificationParams>,
6525}
6526impl PromptListChangedNotification {
6527 pub fn new(params: ::std::option::Option<NotificationParams>) -> Self {
6528 Self {
6529 jsonrpc: JSONRPC_VERSION.to_string(),
6530 method: "notifications/prompts/list_changed".to_string(),
6531 params,
6532 }
6533 }
6534 pub fn jsonrpc(&self) -> &::std::string::String {
6535 &self.jsonrpc
6536 }
6537 pub fn method(&self) -> &::std::string::String {
6538 &self.method
6539 }
6540 /// returns "notifications/prompts/list_changed"
6541 pub fn method_value() -> &'static str {
6542 "notifications/prompts/list_changed"
6543 }
6544 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
6545 pub fn method_name() -> &'static str {
6546 "notifications/prompts/list_changed"
6547 }
6548}
6549/**Describes a message returned as part of a prompt.
6550This is similar to {@link SamplingMessage}, but also supports the embedding of
6551resources from the MCP server.*/
6552///
6553/// <details><summary>JSON schema</summary>
6554///
6555/// ```json
6556///{
6557/// "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.",
6558/// "type": "object",
6559/// "required": [
6560/// "content",
6561/// "role"
6562/// ],
6563/// "properties": {
6564/// "content": {
6565/// "$ref": "#/$defs/ContentBlock"
6566/// },
6567/// "role": {
6568/// "$ref": "#/$defs/Role"
6569/// }
6570/// }
6571///}
6572/// ```
6573/// </details>
6574#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6575pub struct PromptMessage {
6576 pub content: ContentBlock,
6577 pub role: Role,
6578}
6579///Identifies a prompt.
6580///
6581/// <details><summary>JSON schema</summary>
6582///
6583/// ```json
6584///{
6585/// "description": "Identifies a prompt.",
6586/// "type": "object",
6587/// "required": [
6588/// "name",
6589/// "type"
6590/// ],
6591/// "properties": {
6592/// "name": {
6593/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
6594/// "type": "string"
6595/// },
6596/// "title": {
6597/// "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).",
6598/// "type": "string"
6599/// },
6600/// "type": {
6601/// "type": "string",
6602/// "const": "ref/prompt"
6603/// }
6604/// }
6605///}
6606/// ```
6607/// </details>
6608#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6609pub struct PromptReference {
6610 ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
6611 pub name: ::std::string::String,
6612 /**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
6613 even by those unfamiliar with domain-specific terminology.
6614 If not provided, the name should be used for display (except for {@link Tool},
6615 where annotations.title should be given precedence over using name,
6616 if present).*/
6617 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
6618 pub title: ::std::option::Option<::std::string::String>,
6619 #[serde(rename = "type", deserialize_with = "validate::prompt_reference_type_")]
6620 type_: ::std::string::String,
6621}
6622impl PromptReference {
6623 pub fn new(name: ::std::string::String, title: ::std::option::Option<::std::string::String>) -> Self {
6624 Self {
6625 name,
6626 title,
6627 type_: "ref/prompt".to_string(),
6628 }
6629 }
6630 pub fn type_(&self) -> &::std::string::String {
6631 &self.type_
6632 }
6633 /// returns "ref/prompt"
6634 pub fn type_value() -> &'static str {
6635 "ref/prompt"
6636 }
6637 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
6638 pub fn type_name() -> &'static str {
6639 "ref/prompt"
6640 }
6641}
6642///ReadResourceContent
6643///
6644/// <details><summary>JSON schema</summary>
6645///
6646/// ```json
6647///{
6648/// "anyOf": [
6649/// {
6650/// "$ref": "#/$defs/TextResourceContents"
6651/// },
6652/// {
6653/// "$ref": "#/$defs/BlobResourceContents"
6654/// }
6655/// ]
6656///}
6657/// ```
6658/// </details>
6659#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6660#[serde(untagged)]
6661pub enum ReadResourceContent {
6662 TextResourceContents(TextResourceContents),
6663 BlobResourceContents(BlobResourceContents),
6664}
6665impl ::std::convert::From<TextResourceContents> for ReadResourceContent {
6666 fn from(value: TextResourceContents) -> Self {
6667 Self::TextResourceContents(value)
6668 }
6669}
6670impl ::std::convert::From<BlobResourceContents> for ReadResourceContent {
6671 fn from(value: BlobResourceContents) -> Self {
6672 Self::BlobResourceContents(value)
6673 }
6674}
6675///Sent from the client to the server, to read a specific resource URI.
6676///
6677/// <details><summary>JSON schema</summary>
6678///
6679/// ```json
6680///{
6681/// "description": "Sent from the client to the server, to read a specific resource URI.",
6682/// "type": "object",
6683/// "required": [
6684/// "id",
6685/// "jsonrpc",
6686/// "method",
6687/// "params"
6688/// ],
6689/// "properties": {
6690/// "id": {
6691/// "$ref": "#/$defs/RequestId"
6692/// },
6693/// "jsonrpc": {
6694/// "type": "string",
6695/// "const": "2.0"
6696/// },
6697/// "method": {
6698/// "type": "string",
6699/// "const": "resources/read"
6700/// },
6701/// "params": {
6702/// "$ref": "#/$defs/ReadResourceRequestParams"
6703/// }
6704/// }
6705///}
6706/// ```
6707/// </details>
6708#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6709pub struct ReadResourceRequest {
6710 pub id: RequestId,
6711 #[serde(deserialize_with = "validate::read_resource_request_jsonrpc")]
6712 jsonrpc: ::std::string::String,
6713 #[serde(deserialize_with = "validate::read_resource_request_method")]
6714 method: ::std::string::String,
6715 pub params: ReadResourceRequestParams,
6716}
6717impl ReadResourceRequest {
6718 pub fn new(id: RequestId, params: ReadResourceRequestParams) -> Self {
6719 Self {
6720 id,
6721 jsonrpc: JSONRPC_VERSION.to_string(),
6722 method: "resources/read".to_string(),
6723 params,
6724 }
6725 }
6726 pub fn jsonrpc(&self) -> &::std::string::String {
6727 &self.jsonrpc
6728 }
6729 pub fn method(&self) -> &::std::string::String {
6730 &self.method
6731 }
6732 /// returns "resources/read"
6733 pub fn method_value() -> &'static str {
6734 "resources/read"
6735 }
6736 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
6737 pub fn method_name() -> &'static str {
6738 "resources/read"
6739 }
6740}
6741///Parameters for a resources/read request.
6742///
6743/// <details><summary>JSON schema</summary>
6744///
6745/// ```json
6746///{
6747/// "description": "Parameters for a resources/read request.",
6748/// "type": "object",
6749/// "required": [
6750/// "_meta",
6751/// "uri"
6752/// ],
6753/// "properties": {
6754/// "_meta": {
6755/// "$ref": "#/$defs/RequestMetaObject"
6756/// },
6757/// "inputResponses": {
6758/// "$ref": "#/$defs/InputResponses"
6759/// },
6760/// "requestState": {
6761/// "type": "string"
6762/// },
6763/// "uri": {
6764/// "description": "The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.",
6765/// "type": "string",
6766/// "format": "uri"
6767/// }
6768/// }
6769///}
6770/// ```
6771/// </details>
6772#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6773pub struct ReadResourceRequestParams {
6774 #[serde(rename = "inputResponses", default, skip_serializing_if = "::std::option::Option::is_none")]
6775 pub input_responses: ::std::option::Option<InputResponses>,
6776 #[serde(rename = "_meta")]
6777 pub meta: RequestMetaObject,
6778 #[serde(rename = "requestState", default, skip_serializing_if = "::std::option::Option::is_none")]
6779 pub request_state: ::std::option::Option<::std::string::String>,
6780 ///The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.
6781 pub uri: ::std::string::String,
6782}
6783///The result returned by the server for a {@link ReadResourceRequestresources/read} request.
6784///
6785/// <details><summary>JSON schema</summary>
6786///
6787/// ```json
6788///{
6789/// "description": "The result returned by the server for a {@link ReadResourceRequestresources/read} request.",
6790/// "type": "object",
6791/// "required": [
6792/// "cacheScope",
6793/// "contents",
6794/// "resultType",
6795/// "ttlMs"
6796/// ],
6797/// "properties": {
6798/// "_meta": {
6799/// "$ref": "#/$defs/ResultMetaObject"
6800/// },
6801/// "cacheScope": {
6802/// "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).",
6803/// "type": "string",
6804/// "enum": [
6805/// "private",
6806/// "public"
6807/// ]
6808/// },
6809/// "contents": {
6810/// "type": "array",
6811/// "items": {
6812/// "anyOf": [
6813/// {
6814/// "$ref": "#/$defs/TextResourceContents"
6815/// },
6816/// {
6817/// "$ref": "#/$defs/BlobResourceContents"
6818/// }
6819/// ]
6820/// }
6821/// },
6822/// "resultType": {
6823/// "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\".",
6824/// "type": "string"
6825/// },
6826/// "ttlMs": {
6827/// "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.",
6828/// "type": "integer",
6829/// "minimum": 0.0
6830/// }
6831/// }
6832///}
6833/// ```
6834/// </details>
6835#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6836pub struct ReadResourceResult {
6837 /**Indicates the intended scope of the cached response, analogous to HTTP
6838 Cache-Control: public vs Cache-Control: private.
6839 - "public": The response does not contain user-specific data. Any
6840 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
6841 the response and serve it across authorization contexts.
6842 - "private": The response MAY be cached and reused only within the
6843 same authorization context. Caches MUST NOT be shared across
6844 authorization contexts (e.g., a different access token requires a
6845 different cache).*/
6846 #[serde(rename = "cacheScope")]
6847 pub cache_scope: ReadResourceResultCacheScope,
6848 pub contents: ::std::vec::Vec<ReadResourceContent>,
6849 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
6850 pub meta: ::std::option::Option<ResultMetaObject>,
6851 /**Indicates the type of the result, which allows the client to determine
6852 how to parse the result object.
6853 Servers implementing this protocol version MUST include this field.
6854 For backward compatibility, when a client receives a result from a
6855 server implementing an earlier protocol version (which does not include
6856 resultType), the client MUST treat the absent field as "complete".*/
6857 #[serde(rename = "resultType")]
6858 pub result_type: ::std::string::String,
6859 /**A hint from the server indicating how long (in milliseconds) the
6860 client MAY cache this response before re-fetching. Semantics are
6861 analogous to HTTP Cache-Control max-age.
6862 - If 0, The response SHOULD be considered immediately stale,
6863 The client MAY re-fetch every time the result is needed.
6864 - If positive, the client SHOULD consider the result fresh for this many
6865 milliseconds after receiving the response.*/
6866 #[serde(rename = "ttlMs")]
6867 pub ttl_ms: u64,
6868}
6869/**Indicates the intended scope of the cached response, analogous to HTTP
6870Cache-Control: public vs Cache-Control: private.
6871- "public": The response does not contain user-specific data. Any
6872 client or intermediary (e.g., shared gateway, caching proxy) MAY cache
6873 the response and serve it across authorization contexts.
6874- "private": The response MAY be cached and reused only within the
6875 same authorization context. Caches MUST NOT be shared across
6876 authorization contexts (e.g., a different access token requires a
6877 different cache).*/
6878///
6879/// <details><summary>JSON schema</summary>
6880///
6881/// ```json
6882///{
6883/// "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).",
6884/// "type": "string",
6885/// "enum": [
6886/// "private",
6887/// "public"
6888/// ]
6889///}
6890/// ```
6891/// </details>
6892#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
6893pub enum ReadResourceResultCacheScope {
6894 #[serde(rename = "private")]
6895 Private,
6896 #[serde(rename = "public")]
6897 Public,
6898}
6899impl ::std::fmt::Display for ReadResourceResultCacheScope {
6900 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6901 match *self {
6902 Self::Private => write!(f, "private"),
6903 Self::Public => write!(f, "public"),
6904 }
6905 }
6906}
6907///A successful response from the server for a {@link ReadResourceRequestresources/read} request.
6908///
6909/// <details><summary>JSON schema</summary>
6910///
6911/// ```json
6912///{
6913/// "description": "A successful response from the server for a {@link ReadResourceRequestresources/read} request.",
6914/// "type": "object",
6915/// "required": [
6916/// "id",
6917/// "jsonrpc",
6918/// "result"
6919/// ],
6920/// "properties": {
6921/// "id": {
6922/// "$ref": "#/$defs/RequestId"
6923/// },
6924/// "jsonrpc": {
6925/// "type": "string",
6926/// "const": "2.0"
6927/// },
6928/// "result": {
6929/// "anyOf": [
6930/// {
6931/// "$ref": "#/$defs/InputRequiredResult"
6932/// },
6933/// {
6934/// "$ref": "#/$defs/ReadResourceResult"
6935/// }
6936/// ]
6937/// }
6938/// }
6939///}
6940/// ```
6941/// </details>
6942#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6943pub struct ReadResourceResultResponse {
6944 pub id: RequestId,
6945 #[serde(deserialize_with = "validate::read_resource_result_response_jsonrpc")]
6946 jsonrpc: ::std::string::String,
6947 pub result: ReadResourceResultResponseResult,
6948}
6949impl ReadResourceResultResponse {
6950 pub fn new(id: RequestId, result: ReadResourceResultResponseResult) -> Self {
6951 Self {
6952 id,
6953 jsonrpc: JSONRPC_VERSION.to_string(),
6954 result,
6955 }
6956 }
6957 pub fn jsonrpc(&self) -> &::std::string::String {
6958 &self.jsonrpc
6959 }
6960}
6961///ReadResourceResultResponseResult
6962///
6963/// <details><summary>JSON schema</summary>
6964///
6965/// ```json
6966///{
6967/// "anyOf": [
6968/// {
6969/// "$ref": "#/$defs/InputRequiredResult"
6970/// },
6971/// {
6972/// "$ref": "#/$defs/ReadResourceResult"
6973/// }
6974/// ]
6975///}
6976/// ```
6977/// </details>
6978#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6979#[serde(untagged)]
6980pub enum ReadResourceResultResponseResult {
6981 InputRequiredResult(InputRequiredResult),
6982 ReadResourceResult(ReadResourceResult),
6983}
6984impl ::std::convert::From<InputRequiredResult> for ReadResourceResultResponseResult {
6985 fn from(value: InputRequiredResult) -> Self {
6986 Self::InputRequiredResult(value)
6987 }
6988}
6989impl ::std::convert::From<ReadResourceResult> for ReadResourceResultResponseResult {
6990 fn from(value: ReadResourceResult) -> Self {
6991 Self::ReadResourceResult(value)
6992 }
6993}
6994///Request
6995///
6996/// <details><summary>JSON schema</summary>
6997///
6998/// ```json
6999///{
7000/// "type": "object",
7001/// "required": [
7002/// "method"
7003/// ],
7004/// "properties": {
7005/// "method": {
7006/// "type": "string"
7007/// },
7008/// "params": {
7009/// "type": "object",
7010/// "additionalProperties": {}
7011/// }
7012/// }
7013///}
7014/// ```
7015/// </details>
7016#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7017pub struct Request {
7018 pub method: ::std::string::String,
7019 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7020 pub params: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
7021}
7022///A uniquely identifying ID for a request in JSON-RPC.
7023///
7024/// <details><summary>JSON schema</summary>
7025///
7026/// ```json
7027///{
7028/// "description": "A uniquely identifying ID for a request in JSON-RPC.",
7029/// "type": [
7030/// "string",
7031/// "integer"
7032/// ]
7033///}
7034/// ```
7035/// </details>
7036#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7037#[serde(untagged)]
7038pub enum RequestId {
7039 String(::std::string::String),
7040 Integer(i64),
7041}
7042impl ::std::convert::From<i64> for RequestId {
7043 fn from(value: i64) -> Self {
7044 Self::Integer(value)
7045 }
7046}
7047///Extends {@link MetaObject} with additional request-specific fields. All key naming rules from MetaObject apply.
7048///
7049/// <details><summary>JSON schema</summary>
7050///
7051/// ```json
7052///{
7053/// "description": "Extends {@link MetaObject} with additional request-specific fields. All key naming rules from MetaObject apply.",
7054/// "type": "object",
7055/// "required": [
7056/// "io.modelcontextprotocol/clientCapabilities",
7057/// "io.modelcontextprotocol/protocolVersion"
7058/// ],
7059/// "properties": {
7060/// "io.modelcontextprotocol/clientCapabilities": {
7061/// "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.",
7062/// "$ref": "#/$defs/ClientCapabilities"
7063/// },
7064/// "io.modelcontextprotocol/clientInfo": {
7065/// "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.",
7066/// "$ref": "#/$defs/Implementation"
7067/// },
7068/// "io.modelcontextprotocol/logLevel": {
7069/// "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.",
7070/// "$ref": "#/$defs/LoggingLevel"
7071/// },
7072/// "io.modelcontextprotocol/protocolVersion": {
7073/// "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}.",
7074/// "type": "string"
7075/// },
7076/// "progressToken": {
7077/// "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.",
7078/// "$ref": "#/$defs/ProgressToken"
7079/// }
7080/// },
7081/// "additionalProperties": {}
7082///}
7083/// ```
7084/// </details>
7085#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
7086pub struct RequestMetaObject {
7087 /**The client's capabilities for this specific request. Required.
7088 Capabilities are declared per-request rather than once at initialization;
7089 an empty object means the client supports no optional capabilities.
7090 Servers MUST NOT infer capabilities from prior requests.*/
7091 #[serde(rename = "io.modelcontextprotocol/clientCapabilities")]
7092 pub client_capabilities: ClientCapabilities,
7093 /**Identifies the client software making the request. Clients SHOULD
7094 include this field on every request unless specifically configured not
7095 to do so.
7096 The {@link Implementation} schema requires name and version; other
7097 fields are optional.
7098 The value is self-reported by the client and is not verified by the
7099 protocol. It is intended for display, logging, and debugging. Servers
7100 SHOULD NOT use it to change their behavior, and SHOULD NOT rely on it for
7101 security decisions.*/
7102 #[serde(
7103 rename = "io.modelcontextprotocol/clientInfo",
7104 default,
7105 skip_serializing_if = "::std::option::Option::is_none"
7106 )]
7107 pub client_info: ::std::option::Option<Implementation>,
7108 /**The desired log level for this request. Optional.
7109 If absent, the server MUST NOT send any {@link LoggingMessageNotificationnotifications/message}
7110 notifications for this request. The client opts in to log messages by
7111 explicitly setting a level. Replaces the former logging/setLevel RPC.*/
7112 #[serde(
7113 rename = "io.modelcontextprotocol/logLevel",
7114 default,
7115 skip_serializing_if = "::std::option::Option::is_none"
7116 )]
7117 pub log_level: ::std::option::Option<LoggingLevel>,
7118 /**The MCP Protocol Version being used for this request. Required.
7119 For the HTTP transport, this value MUST match the MCP-Protocol-Version
7120 header; otherwise the server MUST return a 400 Bad Request. If the
7121 server does not support the requested version, it MUST return an
7122 {@link UnsupportedProtocolVersionError}.*/
7123 #[serde(rename = "io.modelcontextprotocol/protocolVersion")]
7124 pub protocol_version: ::std::string::String,
7125 ///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.
7126 #[serde(rename = "progressToken", default, skip_serializing_if = "::std::option::Option::is_none")]
7127 pub progress_token: ::std::option::Option<ProgressToken>,
7128 #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
7129 pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
7130}
7131///Common params for any request.
7132///
7133/// <details><summary>JSON schema</summary>
7134///
7135/// ```json
7136///{
7137/// "description": "Common params for any request.",
7138/// "type": "object",
7139/// "required": [
7140/// "_meta"
7141/// ],
7142/// "properties": {
7143/// "_meta": {
7144/// "$ref": "#/$defs/RequestMetaObject"
7145/// }
7146/// }
7147///}
7148/// ```
7149/// </details>
7150#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
7151pub struct RequestParams {
7152 #[serde(rename = "_meta")]
7153 pub meta: RequestMetaObject,
7154}
7155///A known resource that the server is capable of reading.
7156///
7157/// <details><summary>JSON schema</summary>
7158///
7159/// ```json
7160///{
7161/// "description": "A known resource that the server is capable of reading.",
7162/// "type": "object",
7163/// "required": [
7164/// "name",
7165/// "uri"
7166/// ],
7167/// "properties": {
7168/// "_meta": {
7169/// "$ref": "#/$defs/MetaObject"
7170/// },
7171/// "annotations": {
7172/// "description": "Optional annotations for the client.",
7173/// "$ref": "#/$defs/Annotations"
7174/// },
7175/// "description": {
7176/// "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.",
7177/// "type": "string"
7178/// },
7179/// "icons": {
7180/// "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)",
7181/// "type": "array",
7182/// "items": {
7183/// "$ref": "#/$defs/Icon"
7184/// }
7185/// },
7186/// "mimeType": {
7187/// "description": "The MIME type of this resource, if known.",
7188/// "type": "string"
7189/// },
7190/// "name": {
7191/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
7192/// "type": "string"
7193/// },
7194/// "size": {
7195/// "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.",
7196/// "type": "integer"
7197/// },
7198/// "title": {
7199/// "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).",
7200/// "type": "string"
7201/// },
7202/// "uri": {
7203/// "description": "The URI of this resource.",
7204/// "type": "string",
7205/// "format": "uri"
7206/// }
7207/// }
7208///}
7209/// ```
7210/// </details>
7211#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7212pub struct Resource {
7213 ///Optional annotations for the client.
7214 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7215 pub annotations: ::std::option::Option<Annotations>,
7216 /**A description of what this resource represents.
7217 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.*/
7218 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7219 pub description: ::std::option::Option<::std::string::String>,
7220 /**Optional set of sized icons that the client can display in a user interface.
7221 Clients that support rendering icons MUST support at least the following MIME types:
7222 - image/png - PNG images (safe, universal compatibility)
7223 - image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
7224 Clients that support rendering icons SHOULD also support:
7225 - image/svg+xml - SVG images (scalable but requires security precautions)
7226 - image/webp - WebP images (modern, efficient format)*/
7227 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
7228 pub icons: ::std::vec::Vec<Icon>,
7229 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
7230 pub meta: ::std::option::Option<MetaObject>,
7231 ///The MIME type of this resource, if known.
7232 #[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
7233 pub mime_type: ::std::option::Option<::std::string::String>,
7234 ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
7235 pub name: ::std::string::String,
7236 /**The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
7237 This can be used by Hosts to display file sizes and estimate context window usage.*/
7238 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7239 pub size: ::std::option::Option<i64>,
7240 /**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
7241 even by those unfamiliar with domain-specific terminology.
7242 If not provided, the name should be used for display (except for {@link Tool},
7243 where annotations.title should be given precedence over using name,
7244 if present).*/
7245 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7246 pub title: ::std::option::Option<::std::string::String>,
7247 ///The URI of this resource.
7248 pub uri: ::std::string::String,
7249}
7250///The contents of a specific resource or sub-resource.
7251///
7252/// <details><summary>JSON schema</summary>
7253///
7254/// ```json
7255///{
7256/// "description": "The contents of a specific resource or sub-resource.",
7257/// "type": "object",
7258/// "required": [
7259/// "uri"
7260/// ],
7261/// "properties": {
7262/// "_meta": {
7263/// "$ref": "#/$defs/MetaObject"
7264/// },
7265/// "mimeType": {
7266/// "description": "The MIME type of this resource, if known.",
7267/// "type": "string"
7268/// },
7269/// "uri": {
7270/// "description": "The URI of this resource.",
7271/// "type": "string",
7272/// "format": "uri"
7273/// }
7274/// }
7275///}
7276/// ```
7277/// </details>
7278#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7279pub struct ResourceContents {
7280 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
7281 pub meta: ::std::option::Option<MetaObject>,
7282 ///The MIME type of this resource, if known.
7283 #[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
7284 pub mime_type: ::std::option::Option<::std::string::String>,
7285 ///The URI of this resource.
7286 pub uri: ::std::string::String,
7287}
7288/**A resource that the server is capable of reading, included in a prompt or tool call result.
7289Note: resource links returned by tools are not guaranteed to appear in the results of {@link ListResourcesRequestresources/list} requests.*/
7290///
7291/// <details><summary>JSON schema</summary>
7292///
7293/// ```json
7294///{
7295/// "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.",
7296/// "type": "object",
7297/// "required": [
7298/// "name",
7299/// "type",
7300/// "uri"
7301/// ],
7302/// "properties": {
7303/// "_meta": {
7304/// "$ref": "#/$defs/MetaObject"
7305/// },
7306/// "annotations": {
7307/// "description": "Optional annotations for the client.",
7308/// "$ref": "#/$defs/Annotations"
7309/// },
7310/// "description": {
7311/// "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.",
7312/// "type": "string"
7313/// },
7314/// "icons": {
7315/// "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)",
7316/// "type": "array",
7317/// "items": {
7318/// "$ref": "#/$defs/Icon"
7319/// }
7320/// },
7321/// "mimeType": {
7322/// "description": "The MIME type of this resource, if known.",
7323/// "type": "string"
7324/// },
7325/// "name": {
7326/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
7327/// "type": "string"
7328/// },
7329/// "size": {
7330/// "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.",
7331/// "type": "integer"
7332/// },
7333/// "title": {
7334/// "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).",
7335/// "type": "string"
7336/// },
7337/// "type": {
7338/// "type": "string",
7339/// "const": "resource_link"
7340/// },
7341/// "uri": {
7342/// "description": "The URI of this resource.",
7343/// "type": "string",
7344/// "format": "uri"
7345/// }
7346/// }
7347///}
7348/// ```
7349/// </details>
7350#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7351pub struct ResourceLink {
7352 ///Optional annotations for the client.
7353 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7354 pub annotations: ::std::option::Option<Annotations>,
7355 /**A description of what this resource represents.
7356 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.*/
7357 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7358 pub description: ::std::option::Option<::std::string::String>,
7359 /**Optional set of sized icons that the client can display in a user interface.
7360 Clients that support rendering icons MUST support at least the following MIME types:
7361 - image/png - PNG images (safe, universal compatibility)
7362 - image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
7363 Clients that support rendering icons SHOULD also support:
7364 - image/svg+xml - SVG images (scalable but requires security precautions)
7365 - image/webp - WebP images (modern, efficient format)*/
7366 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
7367 pub icons: ::std::vec::Vec<Icon>,
7368 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
7369 pub meta: ::std::option::Option<MetaObject>,
7370 ///The MIME type of this resource, if known.
7371 #[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
7372 pub mime_type: ::std::option::Option<::std::string::String>,
7373 ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
7374 pub name: ::std::string::String,
7375 /**The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
7376 This can be used by Hosts to display file sizes and estimate context window usage.*/
7377 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7378 pub size: ::std::option::Option<i64>,
7379 /**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
7380 even by those unfamiliar with domain-specific terminology.
7381 If not provided, the name should be used for display (except for {@link Tool},
7382 where annotations.title should be given precedence over using name,
7383 if present).*/
7384 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7385 pub title: ::std::option::Option<::std::string::String>,
7386 #[serde(rename = "type", deserialize_with = "validate::resource_link_type_")]
7387 type_: ::std::string::String,
7388 ///The URI of this resource.
7389 pub uri: ::std::string::String,
7390}
7391impl ResourceLink {
7392 #[allow(clippy::too_many_arguments)]
7393 pub fn new(
7394 icons: ::std::vec::Vec<Icon>,
7395 name: ::std::string::String,
7396 uri: ::std::string::String,
7397 annotations: ::std::option::Option<Annotations>,
7398 description: ::std::option::Option<::std::string::String>,
7399 meta: ::std::option::Option<MetaObject>,
7400 mime_type: ::std::option::Option<::std::string::String>,
7401 size: ::std::option::Option<i64>,
7402 title: ::std::option::Option<::std::string::String>,
7403 ) -> Self {
7404 Self {
7405 annotations,
7406 description,
7407 icons,
7408 meta,
7409 mime_type,
7410 name,
7411 size,
7412 title,
7413 type_: "resource_link".to_string(),
7414 uri,
7415 }
7416 }
7417 pub fn type_(&self) -> &::std::string::String {
7418 &self.type_
7419 }
7420 /// returns "resource_link"
7421 pub fn type_value() -> &'static str {
7422 "resource_link"
7423 }
7424 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
7425 pub fn type_name() -> &'static str {
7426 "resource_link"
7427 }
7428}
7429///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.
7430///
7431/// <details><summary>JSON schema</summary>
7432///
7433/// ```json
7434///{
7435/// "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.",
7436/// "type": "object",
7437/// "required": [
7438/// "jsonrpc",
7439/// "method"
7440/// ],
7441/// "properties": {
7442/// "jsonrpc": {
7443/// "type": "string",
7444/// "const": "2.0"
7445/// },
7446/// "method": {
7447/// "type": "string",
7448/// "const": "notifications/resources/list_changed"
7449/// },
7450/// "params": {
7451/// "$ref": "#/$defs/NotificationParams"
7452/// }
7453/// }
7454///}
7455/// ```
7456/// </details>
7457#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7458pub struct ResourceListChangedNotification {
7459 #[serde(deserialize_with = "validate::resource_list_changed_notification_jsonrpc")]
7460 jsonrpc: ::std::string::String,
7461 #[serde(deserialize_with = "validate::resource_list_changed_notification_method")]
7462 method: ::std::string::String,
7463 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7464 pub params: ::std::option::Option<NotificationParams>,
7465}
7466impl ResourceListChangedNotification {
7467 pub fn new(params: ::std::option::Option<NotificationParams>) -> Self {
7468 Self {
7469 jsonrpc: JSONRPC_VERSION.to_string(),
7470 method: "notifications/resources/list_changed".to_string(),
7471 params,
7472 }
7473 }
7474 pub fn jsonrpc(&self) -> &::std::string::String {
7475 &self.jsonrpc
7476 }
7477 pub fn method(&self) -> &::std::string::String {
7478 &self.method
7479 }
7480 /// returns "notifications/resources/list_changed"
7481 pub fn method_value() -> &'static str {
7482 "notifications/resources/list_changed"
7483 }
7484 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
7485 pub fn method_name() -> &'static str {
7486 "notifications/resources/list_changed"
7487 }
7488}
7489///Common params for resource-related requests.
7490///
7491/// <details><summary>JSON schema</summary>
7492///
7493/// ```json
7494///{
7495/// "description": "Common params for resource-related requests.",
7496/// "type": "object",
7497/// "required": [
7498/// "_meta",
7499/// "uri"
7500/// ],
7501/// "properties": {
7502/// "_meta": {
7503/// "$ref": "#/$defs/RequestMetaObject"
7504/// },
7505/// "uri": {
7506/// "description": "The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.",
7507/// "type": "string",
7508/// "format": "uri"
7509/// }
7510/// }
7511///}
7512/// ```
7513/// </details>
7514#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7515pub struct ResourceRequestParams {
7516 #[serde(rename = "_meta")]
7517 pub meta: RequestMetaObject,
7518 ///The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.
7519 pub uri: ::std::string::String,
7520}
7521///A template description for resources available on the server.
7522///
7523/// <details><summary>JSON schema</summary>
7524///
7525/// ```json
7526///{
7527/// "description": "A template description for resources available on the server.",
7528/// "type": "object",
7529/// "required": [
7530/// "name",
7531/// "uriTemplate"
7532/// ],
7533/// "properties": {
7534/// "_meta": {
7535/// "$ref": "#/$defs/MetaObject"
7536/// },
7537/// "annotations": {
7538/// "description": "Optional annotations for the client.",
7539/// "$ref": "#/$defs/Annotations"
7540/// },
7541/// "description": {
7542/// "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.",
7543/// "type": "string"
7544/// },
7545/// "icons": {
7546/// "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)",
7547/// "type": "array",
7548/// "items": {
7549/// "$ref": "#/$defs/Icon"
7550/// }
7551/// },
7552/// "mimeType": {
7553/// "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.",
7554/// "type": "string"
7555/// },
7556/// "name": {
7557/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
7558/// "type": "string"
7559/// },
7560/// "title": {
7561/// "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).",
7562/// "type": "string"
7563/// },
7564/// "uriTemplate": {
7565/// "description": "A URI template (according to RFC 6570) that can be used to construct resource URIs.",
7566/// "type": "string",
7567/// "format": "uri-template"
7568/// }
7569/// }
7570///}
7571/// ```
7572/// </details>
7573#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7574pub struct ResourceTemplate {
7575 ///Optional annotations for the client.
7576 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7577 pub annotations: ::std::option::Option<Annotations>,
7578 /**A description of what this template is for.
7579 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.*/
7580 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7581 pub description: ::std::option::Option<::std::string::String>,
7582 /**Optional set of sized icons that the client can display in a user interface.
7583 Clients that support rendering icons MUST support at least the following MIME types:
7584 - image/png - PNG images (safe, universal compatibility)
7585 - image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
7586 Clients that support rendering icons SHOULD also support:
7587 - image/svg+xml - SVG images (scalable but requires security precautions)
7588 - image/webp - WebP images (modern, efficient format)*/
7589 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
7590 pub icons: ::std::vec::Vec<Icon>,
7591 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
7592 pub meta: ::std::option::Option<MetaObject>,
7593 ///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.
7594 #[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
7595 pub mime_type: ::std::option::Option<::std::string::String>,
7596 ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
7597 pub name: ::std::string::String,
7598 /**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
7599 even by those unfamiliar with domain-specific terminology.
7600 If not provided, the name should be used for display (except for {@link Tool},
7601 where annotations.title should be given precedence over using name,
7602 if present).*/
7603 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7604 pub title: ::std::option::Option<::std::string::String>,
7605 ///A URI template (according to RFC 6570) that can be used to construct resource URIs.
7606 #[serde(rename = "uriTemplate")]
7607 pub uri_template: ::std::string::String,
7608}
7609///A reference to a resource or resource template definition.
7610///
7611/// <details><summary>JSON schema</summary>
7612///
7613/// ```json
7614///{
7615/// "description": "A reference to a resource or resource template definition.",
7616/// "type": "object",
7617/// "required": [
7618/// "type",
7619/// "uri"
7620/// ],
7621/// "properties": {
7622/// "type": {
7623/// "type": "string",
7624/// "const": "ref/resource"
7625/// },
7626/// "uri": {
7627/// "description": "The URI or URI template of the resource.",
7628/// "type": "string",
7629/// "format": "uri-template"
7630/// }
7631/// }
7632///}
7633/// ```
7634/// </details>
7635#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7636pub struct ResourceTemplateReference {
7637 #[serde(rename = "type", deserialize_with = "validate::resource_template_reference_type_")]
7638 type_: ::std::string::String,
7639 ///The URI or URI template of the resource.
7640 pub uri: ::std::string::String,
7641}
7642impl ResourceTemplateReference {
7643 pub fn new(uri: ::std::string::String) -> Self {
7644 Self {
7645 type_: "ref/resource".to_string(),
7646 uri,
7647 }
7648 }
7649 pub fn type_(&self) -> &::std::string::String {
7650 &self.type_
7651 }
7652 /// returns "ref/resource"
7653 pub fn type_value() -> &'static str {
7654 "ref/resource"
7655 }
7656 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
7657 pub fn type_name() -> &'static str {
7658 "ref/resource"
7659 }
7660}
7661///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.
7662///
7663/// <details><summary>JSON schema</summary>
7664///
7665/// ```json
7666///{
7667/// "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.",
7668/// "type": "object",
7669/// "required": [
7670/// "jsonrpc",
7671/// "method",
7672/// "params"
7673/// ],
7674/// "properties": {
7675/// "jsonrpc": {
7676/// "type": "string",
7677/// "const": "2.0"
7678/// },
7679/// "method": {
7680/// "type": "string",
7681/// "const": "notifications/resources/updated"
7682/// },
7683/// "params": {
7684/// "$ref": "#/$defs/ResourceUpdatedNotificationParams"
7685/// }
7686/// }
7687///}
7688/// ```
7689/// </details>
7690#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7691pub struct ResourceUpdatedNotification {
7692 #[serde(deserialize_with = "validate::resource_updated_notification_jsonrpc")]
7693 jsonrpc: ::std::string::String,
7694 #[serde(deserialize_with = "validate::resource_updated_notification_method")]
7695 method: ::std::string::String,
7696 pub params: ResourceUpdatedNotificationParams,
7697}
7698impl ResourceUpdatedNotification {
7699 pub fn new(params: ResourceUpdatedNotificationParams) -> Self {
7700 Self {
7701 jsonrpc: JSONRPC_VERSION.to_string(),
7702 method: "notifications/resources/updated".to_string(),
7703 params,
7704 }
7705 }
7706 pub fn jsonrpc(&self) -> &::std::string::String {
7707 &self.jsonrpc
7708 }
7709 pub fn method(&self) -> &::std::string::String {
7710 &self.method
7711 }
7712 /// returns "notifications/resources/updated"
7713 pub fn method_value() -> &'static str {
7714 "notifications/resources/updated"
7715 }
7716 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
7717 pub fn method_name() -> &'static str {
7718 "notifications/resources/updated"
7719 }
7720}
7721///Parameters for a notifications/resources/updated notification.
7722///
7723/// <details><summary>JSON schema</summary>
7724///
7725/// ```json
7726///{
7727/// "description": "Parameters for a notifications/resources/updated notification.",
7728/// "type": "object",
7729/// "required": [
7730/// "uri"
7731/// ],
7732/// "properties": {
7733/// "_meta": {
7734/// "$ref": "#/$defs/NotificationMetaObject"
7735/// },
7736/// "uri": {
7737/// "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.",
7738/// "type": "string",
7739/// "format": "uri"
7740/// }
7741/// }
7742///}
7743/// ```
7744/// </details>
7745#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
7746pub struct ResourceUpdatedNotificationParams {
7747 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
7748 pub meta: ::std::option::Option<NotificationMetaObject>,
7749 ///The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
7750 pub uri: ::std::string::String,
7751}
7752///Common result fields.
7753///
7754/// <details><summary>JSON schema</summary>
7755///
7756/// ```json
7757///{
7758/// "description": "Common result fields.",
7759/// "type": "object",
7760/// "required": [
7761/// "resultType"
7762/// ],
7763/// "properties": {
7764/// "_meta": {
7765/// "$ref": "#/$defs/ResultMetaObject"
7766/// },
7767/// "resultType": {
7768/// "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\".",
7769/// "type": "string"
7770/// }
7771/// },
7772/// "additionalProperties": {}
7773///}
7774/// ```
7775/// </details>
7776#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
7777pub struct Result {
7778 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
7779 pub meta: ::std::option::Option<ResultMetaObject>,
7780 /**Indicates the type of the result, which allows the client to determine
7781 how to parse the result object.
7782 Servers implementing this protocol version MUST include this field.
7783 For backward compatibility, when a client receives a result from a
7784 server implementing an earlier protocol version (which does not include
7785 resultType), the client MUST treat the absent field as "complete".*/
7786 #[serde(rename = "resultType")]
7787 pub result_type: ::std::string::String,
7788 #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
7789 pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
7790}
7791///Extends {@link MetaObject} with additional result-specific fields. All key naming rules from MetaObject apply.
7792///
7793/// <details><summary>JSON schema</summary>
7794///
7795/// ```json
7796///{
7797/// "description": "Extends {@link MetaObject} with additional result-specific fields. All key naming rules from MetaObject apply.",
7798/// "type": "object",
7799/// "properties": {
7800/// "io.modelcontextprotocol/serverInfo": {
7801/// "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.",
7802/// "$ref": "#/$defs/Implementation"
7803/// }
7804/// },
7805/// "additionalProperties": {}
7806///}
7807/// ```
7808/// </details>
7809#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
7810pub struct ResultMetaObject {
7811 /**Identifies the server software producing the response. Servers SHOULD
7812 include this field on every response unless specifically configured not
7813 to do so.
7814 The {@link Implementation} schema requires name and version; other
7815 fields are optional.
7816 The value is self-reported by the server and is not verified by the
7817 protocol. It is intended for display, logging, and debugging. Clients
7818 SHOULD NOT use it to change their behavior, and SHOULD NOT rely on it for
7819 security decisions.*/
7820 #[serde(
7821 rename = "io.modelcontextprotocol/serverInfo",
7822 default,
7823 skip_serializing_if = "::std::option::Option::is_none"
7824 )]
7825 pub io_modelcontextprotocol_server_info: ::std::option::Option<Implementation>,
7826 #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
7827 pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
7828}
7829/**Indicates the type of a {@link Result} object, allowing the client to
7830determine how to parse the response.
7831complete - the request completed successfully and the result contains the final content.
7832input_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.*/
7833///
7834/// <details><summary>JSON schema</summary>
7835///
7836/// ```json
7837///{
7838/// "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.",
7839/// "type": "string"
7840///}
7841/// ```
7842/// </details>
7843#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
7844#[serde(transparent)]
7845pub struct ResultType(pub ::std::string::String);
7846///The sender or recipient of messages and data in a conversation.
7847///
7848/// <details><summary>JSON schema</summary>
7849///
7850/// ```json
7851///{
7852/// "description": "The sender or recipient of messages and data in a conversation.",
7853/// "type": "string",
7854/// "enum": [
7855/// "assistant",
7856/// "user"
7857/// ]
7858///}
7859/// ```
7860/// </details>
7861#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
7862pub enum Role {
7863 #[serde(rename = "assistant")]
7864 Assistant,
7865 #[serde(rename = "user")]
7866 User,
7867}
7868impl ::std::fmt::Display for Role {
7869 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
7870 match *self {
7871 Self::Assistant => write!(f, "assistant"),
7872 Self::User => write!(f, "user"),
7873 }
7874 }
7875}
7876///Represents a root directory or file that the server can operate on.
7877///
7878/// <details><summary>JSON schema</summary>
7879///
7880/// ```json
7881///{
7882/// "description": "Represents a root directory or file that the server can operate on.",
7883/// "type": "object",
7884/// "required": [
7885/// "uri"
7886/// ],
7887/// "properties": {
7888/// "_meta": {
7889/// "$ref": "#/$defs/MetaObject"
7890/// },
7891/// "name": {
7892/// "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.",
7893/// "type": "string"
7894/// },
7895/// "uri": {
7896/// "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.",
7897/// "type": "string",
7898/// "format": "uri"
7899/// }
7900/// }
7901///}
7902/// ```
7903/// </details>
7904#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7905pub struct Root {
7906 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
7907 pub meta: ::std::option::Option<MetaObject>,
7908 /**An optional name for the root. This can be used to provide a human-readable
7909 identifier for the root, which may be useful for display purposes or for
7910 referencing the root in other parts of the application.*/
7911 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7912 pub name: ::std::option::Option<::std::string::String>,
7913 /**The URI identifying the root. This *must* start with file:// for now.
7914 This restriction may be relaxed in future versions of the protocol to allow
7915 other URI schemes.*/
7916 pub uri: ::std::string::String,
7917}
7918///RpcError
7919///
7920/// <details><summary>JSON schema</summary>
7921///
7922/// ```json
7923///{
7924/// "type": "object",
7925/// "required": [
7926/// "code",
7927/// "message"
7928/// ],
7929/// "properties": {
7930/// "code": {
7931/// "description": "The error type that occurred.",
7932/// "type": "integer"
7933/// },
7934/// "data": {
7935/// "description": "Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.)."
7936/// },
7937/// "message": {
7938/// "description": "A short description of the error. The message SHOULD be limited to a concise single sentence.",
7939/// "type": "string"
7940/// }
7941/// }
7942///}
7943/// ```
7944/// </details>
7945#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7946pub struct RpcError {
7947 ///The error type that occurred.
7948 pub code: i64,
7949 ///Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
7950 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
7951 pub data: ::std::option::Option<::serde_json::Value>,
7952 ///A short description of the error. The message SHOULD be limited to a concise single sentence.
7953 pub message: ::std::string::String,
7954}
7955///Describes a message issued to or received from an LLM API.
7956///
7957/// <details><summary>JSON schema</summary>
7958///
7959/// ```json
7960///{
7961/// "description": "Describes a message issued to or received from an LLM API.",
7962/// "type": "object",
7963/// "required": [
7964/// "content",
7965/// "role"
7966/// ],
7967/// "properties": {
7968/// "_meta": {
7969/// "$ref": "#/$defs/MetaObject"
7970/// },
7971/// "content": {
7972/// "anyOf": [
7973/// {
7974/// "$ref": "#/$defs/TextContent"
7975/// },
7976/// {
7977/// "$ref": "#/$defs/ImageContent"
7978/// },
7979/// {
7980/// "$ref": "#/$defs/AudioContent"
7981/// },
7982/// {
7983/// "$ref": "#/$defs/ToolUseContent"
7984/// },
7985/// {
7986/// "$ref": "#/$defs/ToolResultContent"
7987/// },
7988/// {
7989/// "type": "array",
7990/// "items": {
7991/// "$ref": "#/$defs/SamplingMessageContentBlock"
7992/// }
7993/// }
7994/// ]
7995/// },
7996/// "role": {
7997/// "$ref": "#/$defs/Role"
7998/// }
7999/// }
8000///}
8001/// ```
8002/// </details>
8003#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8004pub struct SamplingMessage {
8005 pub content: SamplingMessageContent,
8006 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
8007 pub meta: ::std::option::Option<MetaObject>,
8008 pub role: Role,
8009}
8010///SamplingMessageContent
8011///
8012/// <details><summary>JSON schema</summary>
8013///
8014/// ```json
8015///{
8016/// "anyOf": [
8017/// {
8018/// "$ref": "#/$defs/TextContent"
8019/// },
8020/// {
8021/// "$ref": "#/$defs/ImageContent"
8022/// },
8023/// {
8024/// "$ref": "#/$defs/AudioContent"
8025/// },
8026/// {
8027/// "$ref": "#/$defs/ToolUseContent"
8028/// },
8029/// {
8030/// "$ref": "#/$defs/ToolResultContent"
8031/// },
8032/// {
8033/// "type": "array",
8034/// "items": {
8035/// "$ref": "#/$defs/SamplingMessageContentBlock"
8036/// }
8037/// }
8038/// ]
8039///}
8040/// ```
8041/// </details>
8042#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8043#[serde(untagged)]
8044pub enum SamplingMessageContent {
8045 TextContent(TextContent),
8046 ImageContent(ImageContent),
8047 AudioContent(AudioContent),
8048 ToolUseContent(ToolUseContent),
8049 ToolResultContent(ToolResultContent),
8050 SamplingMessageContentBlock(::std::vec::Vec<SamplingMessageContentBlock>),
8051}
8052impl ::std::convert::From<TextContent> for SamplingMessageContent {
8053 fn from(value: TextContent) -> Self {
8054 Self::TextContent(value)
8055 }
8056}
8057impl ::std::convert::From<ImageContent> for SamplingMessageContent {
8058 fn from(value: ImageContent) -> Self {
8059 Self::ImageContent(value)
8060 }
8061}
8062impl ::std::convert::From<AudioContent> for SamplingMessageContent {
8063 fn from(value: AudioContent) -> Self {
8064 Self::AudioContent(value)
8065 }
8066}
8067impl ::std::convert::From<ToolUseContent> for SamplingMessageContent {
8068 fn from(value: ToolUseContent) -> Self {
8069 Self::ToolUseContent(value)
8070 }
8071}
8072impl ::std::convert::From<ToolResultContent> for SamplingMessageContent {
8073 fn from(value: ToolResultContent) -> Self {
8074 Self::ToolResultContent(value)
8075 }
8076}
8077impl ::std::convert::From<::std::vec::Vec<SamplingMessageContentBlock>> for SamplingMessageContent {
8078 fn from(value: ::std::vec::Vec<SamplingMessageContentBlock>) -> Self {
8079 Self::SamplingMessageContentBlock(value)
8080 }
8081}
8082///SamplingMessageContentBlock
8083///
8084/// <details><summary>JSON schema</summary>
8085///
8086/// ```json
8087///{
8088/// "anyOf": [
8089/// {
8090/// "$ref": "#/$defs/TextContent"
8091/// },
8092/// {
8093/// "$ref": "#/$defs/ImageContent"
8094/// },
8095/// {
8096/// "$ref": "#/$defs/AudioContent"
8097/// },
8098/// {
8099/// "$ref": "#/$defs/ToolUseContent"
8100/// },
8101/// {
8102/// "$ref": "#/$defs/ToolResultContent"
8103/// }
8104/// ]
8105///}
8106/// ```
8107/// </details>
8108#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8109#[serde(untagged)]
8110pub enum SamplingMessageContentBlock {
8111 TextContent(TextContent),
8112 ImageContent(ImageContent),
8113 AudioContent(AudioContent),
8114 ToolUseContent(ToolUseContent),
8115 ToolResultContent(ToolResultContent),
8116}
8117impl ::std::convert::From<TextContent> for SamplingMessageContentBlock {
8118 fn from(value: TextContent) -> Self {
8119 Self::TextContent(value)
8120 }
8121}
8122impl ::std::convert::From<ImageContent> for SamplingMessageContentBlock {
8123 fn from(value: ImageContent) -> Self {
8124 Self::ImageContent(value)
8125 }
8126}
8127impl ::std::convert::From<AudioContent> for SamplingMessageContentBlock {
8128 fn from(value: AudioContent) -> Self {
8129 Self::AudioContent(value)
8130 }
8131}
8132impl ::std::convert::From<ToolUseContent> for SamplingMessageContentBlock {
8133 fn from(value: ToolUseContent) -> Self {
8134 Self::ToolUseContent(value)
8135 }
8136}
8137impl ::std::convert::From<ToolResultContent> for SamplingMessageContentBlock {
8138 fn from(value: ToolResultContent) -> Self {
8139 Self::ToolResultContent(value)
8140 }
8141}
8142///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.
8143///
8144/// <details><summary>JSON schema</summary>
8145///
8146/// ```json
8147///{
8148/// "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.",
8149/// "type": "object",
8150/// "properties": {
8151/// "completions": {
8152/// "description": "Present if the server supports argument autocompletion suggestions.",
8153/// "$ref": "#/$defs/JSONObject"
8154/// },
8155/// "experimental": {
8156/// "description": "Experimental, non-standard capabilities that the server supports.",
8157/// "type": "object",
8158/// "additionalProperties": {
8159/// "$ref": "#/$defs/JSONObject"
8160/// }
8161/// },
8162/// "extensions": {
8163/// "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.",
8164/// "type": "object",
8165/// "additionalProperties": {
8166/// "$ref": "#/$defs/JSONObject"
8167/// }
8168/// },
8169/// "logging": {
8170/// "description": "Present if the server supports sending log messages to the client.",
8171/// "$ref": "#/$defs/JSONObject"
8172/// },
8173/// "prompts": {
8174/// "description": "Present if the server offers any prompt templates.",
8175/// "type": "object",
8176/// "properties": {
8177/// "listChanged": {
8178/// "description": "Whether this server supports notifications for changes to the prompt list.",
8179/// "type": "boolean"
8180/// }
8181/// }
8182/// },
8183/// "resources": {
8184/// "description": "Present if the server offers any resources to read.",
8185/// "type": "object",
8186/// "properties": {
8187/// "listChanged": {
8188/// "description": "Whether this server supports notifications for changes to the resource list.",
8189/// "type": "boolean"
8190/// },
8191/// "subscribe": {
8192/// "description": "Whether this server supports subscribing to resource updates.",
8193/// "type": "boolean"
8194/// }
8195/// }
8196/// },
8197/// "tools": {
8198/// "description": "Present if the server offers any tools to call.",
8199/// "type": "object",
8200/// "properties": {
8201/// "listChanged": {
8202/// "description": "Whether this server supports notifications for changes to the tool list.",
8203/// "type": "boolean"
8204/// }
8205/// }
8206/// }
8207/// }
8208///}
8209/// ```
8210/// </details>
8211#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
8212pub struct ServerCapabilities {
8213 ///Present if the server supports argument autocompletion suggestions.
8214 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8215 pub completions: ::std::option::Option<JsonObject>,
8216 ///Experimental, non-standard capabilities that the server supports.
8217 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8218 pub experimental: ::std::option::Option<std::collections::BTreeMap<::std::string::String, JsonObject>>,
8219 /**Optional MCP extensions that the server supports. Keys are extension identifiers
8220 (e.g., "io.modelcontextprotocol/tasks"), and values are per-extension settings
8221 objects. An empty object indicates support with no settings.
8222 Keys MUST follow the {@link MetaObject_meta key naming rules}, with a
8223 mandatory prefix.*/
8224 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8225 pub extensions: ::std::option::Option<std::collections::BTreeMap<::std::string::String, JsonObject>>,
8226 ///Present if the server supports sending log messages to the client.
8227 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8228 pub logging: ::std::option::Option<JsonObject>,
8229 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8230 pub prompts: ::std::option::Option<ServerCapabilitiesPrompts>,
8231 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8232 pub resources: ::std::option::Option<ServerCapabilitiesResources>,
8233 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8234 pub tools: ::std::option::Option<ServerCapabilitiesTools>,
8235}
8236///Present if the server offers any prompt templates.
8237///
8238/// <details><summary>JSON schema</summary>
8239///
8240/// ```json
8241///{
8242/// "description": "Present if the server offers any prompt templates.",
8243/// "type": "object",
8244/// "properties": {
8245/// "listChanged": {
8246/// "description": "Whether this server supports notifications for changes to the prompt list.",
8247/// "type": "boolean"
8248/// }
8249/// }
8250///}
8251/// ```
8252/// </details>
8253#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
8254pub struct ServerCapabilitiesPrompts {
8255 ///Whether this server supports notifications for changes to the prompt list.
8256 #[serde(rename = "listChanged", default, skip_serializing_if = "::std::option::Option::is_none")]
8257 pub list_changed: ::std::option::Option<bool>,
8258}
8259///Present if the server offers any resources to read.
8260///
8261/// <details><summary>JSON schema</summary>
8262///
8263/// ```json
8264///{
8265/// "description": "Present if the server offers any resources to read.",
8266/// "type": "object",
8267/// "properties": {
8268/// "listChanged": {
8269/// "description": "Whether this server supports notifications for changes to the resource list.",
8270/// "type": "boolean"
8271/// },
8272/// "subscribe": {
8273/// "description": "Whether this server supports subscribing to resource updates.",
8274/// "type": "boolean"
8275/// }
8276/// }
8277///}
8278/// ```
8279/// </details>
8280#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
8281pub struct ServerCapabilitiesResources {
8282 ///Whether this server supports notifications for changes to the resource list.
8283 #[serde(rename = "listChanged", default, skip_serializing_if = "::std::option::Option::is_none")]
8284 pub list_changed: ::std::option::Option<bool>,
8285 ///Whether this server supports subscribing to resource updates.
8286 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8287 pub subscribe: ::std::option::Option<bool>,
8288}
8289///Present if the server offers any tools to call.
8290///
8291/// <details><summary>JSON schema</summary>
8292///
8293/// ```json
8294///{
8295/// "description": "Present if the server offers any tools to call.",
8296/// "type": "object",
8297/// "properties": {
8298/// "listChanged": {
8299/// "description": "Whether this server supports notifications for changes to the tool list.",
8300/// "type": "boolean"
8301/// }
8302/// }
8303///}
8304/// ```
8305/// </details>
8306#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
8307pub struct ServerCapabilitiesTools {
8308 ///Whether this server supports notifications for changes to the tool list.
8309 #[serde(rename = "listChanged", default, skip_serializing_if = "::std::option::Option::is_none")]
8310 pub list_changed: ::std::option::Option<bool>,
8311}
8312///ServerNotification
8313///
8314/// <details><summary>JSON schema</summary>
8315///
8316/// ```json
8317///{
8318/// "anyOf": [
8319/// {
8320/// "$ref": "#/$defs/CancelledNotification"
8321/// },
8322/// {
8323/// "$ref": "#/$defs/ProgressNotification"
8324/// },
8325/// {
8326/// "$ref": "#/$defs/ResourceListChangedNotification"
8327/// },
8328/// {
8329/// "$ref": "#/$defs/SubscriptionsAcknowledgedNotification"
8330/// },
8331/// {
8332/// "$ref": "#/$defs/ResourceUpdatedNotification"
8333/// },
8334/// {
8335/// "$ref": "#/$defs/PromptListChangedNotification"
8336/// },
8337/// {
8338/// "$ref": "#/$defs/ToolListChangedNotification"
8339/// },
8340/// {
8341/// "$ref": "#/$defs/LoggingMessageNotification"
8342/// }
8343/// ]
8344///}
8345/// ```
8346/// </details>
8347#[derive(::serde::Serialize, Clone, Debug)]
8348#[serde(untagged)]
8349pub enum ServerNotification {
8350 CancelledNotification(CancelledNotification),
8351 ProgressNotification(ProgressNotification),
8352 ResourceListChangedNotification(ResourceListChangedNotification),
8353 SubscriptionsAcknowledgedNotification(SubscriptionsAcknowledgedNotification),
8354 ResourceUpdatedNotification(ResourceUpdatedNotification),
8355 PromptListChangedNotification(PromptListChangedNotification),
8356 ToolListChangedNotification(ToolListChangedNotification),
8357 LoggingMessageNotification(LoggingMessageNotification),
8358}
8359impl ::std::convert::From<CancelledNotification> for ServerNotification {
8360 fn from(value: CancelledNotification) -> Self {
8361 Self::CancelledNotification(value)
8362 }
8363}
8364impl ::std::convert::From<ProgressNotification> for ServerNotification {
8365 fn from(value: ProgressNotification) -> Self {
8366 Self::ProgressNotification(value)
8367 }
8368}
8369impl ::std::convert::From<ResourceListChangedNotification> for ServerNotification {
8370 fn from(value: ResourceListChangedNotification) -> Self {
8371 Self::ResourceListChangedNotification(value)
8372 }
8373}
8374impl ::std::convert::From<SubscriptionsAcknowledgedNotification> for ServerNotification {
8375 fn from(value: SubscriptionsAcknowledgedNotification) -> Self {
8376 Self::SubscriptionsAcknowledgedNotification(value)
8377 }
8378}
8379impl ::std::convert::From<ResourceUpdatedNotification> for ServerNotification {
8380 fn from(value: ResourceUpdatedNotification) -> Self {
8381 Self::ResourceUpdatedNotification(value)
8382 }
8383}
8384impl ::std::convert::From<PromptListChangedNotification> for ServerNotification {
8385 fn from(value: PromptListChangedNotification) -> Self {
8386 Self::PromptListChangedNotification(value)
8387 }
8388}
8389impl ::std::convert::From<ToolListChangedNotification> for ServerNotification {
8390 fn from(value: ToolListChangedNotification) -> Self {
8391 Self::ToolListChangedNotification(value)
8392 }
8393}
8394impl ::std::convert::From<LoggingMessageNotification> for ServerNotification {
8395 fn from(value: LoggingMessageNotification) -> Self {
8396 Self::LoggingMessageNotification(value)
8397 }
8398}
8399///ServerResult
8400///
8401/// <details><summary>JSON schema</summary>
8402///
8403/// ```json
8404///{
8405/// "anyOf": [
8406/// {
8407/// "$ref": "#/$defs/Result"
8408/// },
8409/// {
8410/// "$ref": "#/$defs/InputRequiredResult"
8411/// },
8412/// {
8413/// "$ref": "#/$defs/DiscoverResult"
8414/// },
8415/// {
8416/// "$ref": "#/$defs/ListResourcesResult"
8417/// },
8418/// {
8419/// "$ref": "#/$defs/ListResourceTemplatesResult"
8420/// },
8421/// {
8422/// "$ref": "#/$defs/ReadResourceResult"
8423/// },
8424/// {
8425/// "$ref": "#/$defs/SubscriptionsListenResult"
8426/// },
8427/// {
8428/// "$ref": "#/$defs/ListPromptsResult"
8429/// },
8430/// {
8431/// "$ref": "#/$defs/GetPromptResult"
8432/// },
8433/// {
8434/// "$ref": "#/$defs/ListToolsResult"
8435/// },
8436/// {
8437/// "$ref": "#/$defs/CallToolResult"
8438/// },
8439/// {
8440/// "$ref": "#/$defs/CompleteResult"
8441/// }
8442/// ]
8443///}
8444/// ```
8445/// </details>
8446#[derive(::serde::Serialize, Clone, Debug)]
8447#[serde(untagged)]
8448#[allow(clippy::large_enum_variant)]
8449pub enum ServerResult {
8450 InputRequiredResult(InputRequiredResult),
8451 DiscoverResult(DiscoverResult),
8452 ListResourcesResult(ListResourcesResult),
8453 ListResourceTemplatesResult(ListResourceTemplatesResult),
8454 ReadResourceResult(ReadResourceResult),
8455 SubscriptionsListenResult(SubscriptionsListenResult),
8456 ListPromptsResult(ListPromptsResult),
8457 GetPromptResult(GetPromptResult),
8458 ListToolsResult(ListToolsResult),
8459 CallToolResult(CallToolResult),
8460 CompleteResult(CompleteResult),
8461 Result(Result),
8462}
8463impl ::std::convert::From<InputRequiredResult> for ServerResult {
8464 fn from(value: InputRequiredResult) -> Self {
8465 Self::InputRequiredResult(value)
8466 }
8467}
8468impl ::std::convert::From<DiscoverResult> for ServerResult {
8469 fn from(value: DiscoverResult) -> Self {
8470 Self::DiscoverResult(value)
8471 }
8472}
8473impl ::std::convert::From<ListResourcesResult> for ServerResult {
8474 fn from(value: ListResourcesResult) -> Self {
8475 Self::ListResourcesResult(value)
8476 }
8477}
8478impl ::std::convert::From<ListResourceTemplatesResult> for ServerResult {
8479 fn from(value: ListResourceTemplatesResult) -> Self {
8480 Self::ListResourceTemplatesResult(value)
8481 }
8482}
8483impl ::std::convert::From<ReadResourceResult> for ServerResult {
8484 fn from(value: ReadResourceResult) -> Self {
8485 Self::ReadResourceResult(value)
8486 }
8487}
8488impl ::std::convert::From<SubscriptionsListenResult> for ServerResult {
8489 fn from(value: SubscriptionsListenResult) -> Self {
8490 Self::SubscriptionsListenResult(value)
8491 }
8492}
8493impl ::std::convert::From<ListPromptsResult> for ServerResult {
8494 fn from(value: ListPromptsResult) -> Self {
8495 Self::ListPromptsResult(value)
8496 }
8497}
8498impl ::std::convert::From<GetPromptResult> for ServerResult {
8499 fn from(value: GetPromptResult) -> Self {
8500 Self::GetPromptResult(value)
8501 }
8502}
8503impl ::std::convert::From<ListToolsResult> for ServerResult {
8504 fn from(value: ListToolsResult) -> Self {
8505 Self::ListToolsResult(value)
8506 }
8507}
8508impl ::std::convert::From<CallToolResult> for ServerResult {
8509 fn from(value: CallToolResult) -> Self {
8510 Self::CallToolResult(value)
8511 }
8512}
8513impl ::std::convert::From<CompleteResult> for ServerResult {
8514 fn from(value: CompleteResult) -> Self {
8515 Self::CompleteResult(value)
8516 }
8517}
8518impl ::std::convert::From<Result> for ServerResult {
8519 fn from(value: Result) -> Self {
8520 Self::Result(value)
8521 }
8522}
8523///SingleSelectEnumSchema
8524///
8525/// <details><summary>JSON schema</summary>
8526///
8527/// ```json
8528///{
8529/// "anyOf": [
8530/// {
8531/// "$ref": "#/$defs/UntitledSingleSelectEnumSchema"
8532/// },
8533/// {
8534/// "$ref": "#/$defs/TitledSingleSelectEnumSchema"
8535/// }
8536/// ]
8537///}
8538/// ```
8539/// </details>
8540#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8541#[serde(untagged)]
8542pub enum SingleSelectEnumSchema {
8543 UntitledSingleSelectEnumSchema(UntitledSingleSelectEnumSchema),
8544 TitledSingleSelectEnumSchema(TitledSingleSelectEnumSchema),
8545}
8546impl ::std::convert::From<UntitledSingleSelectEnumSchema> for SingleSelectEnumSchema {
8547 fn from(value: UntitledSingleSelectEnumSchema) -> Self {
8548 Self::UntitledSingleSelectEnumSchema(value)
8549 }
8550}
8551impl ::std::convert::From<TitledSingleSelectEnumSchema> for SingleSelectEnumSchema {
8552 fn from(value: TitledSingleSelectEnumSchema) -> Self {
8553 Self::TitledSingleSelectEnumSchema(value)
8554 }
8555}
8556///StringSchema
8557///
8558/// <details><summary>JSON schema</summary>
8559///
8560/// ```json
8561///{
8562/// "type": "object",
8563/// "required": [
8564/// "type"
8565/// ],
8566/// "properties": {
8567/// "default": {
8568/// "type": "string"
8569/// },
8570/// "description": {
8571/// "type": "string"
8572/// },
8573/// "format": {
8574/// "type": "string",
8575/// "enum": [
8576/// "date",
8577/// "date-time",
8578/// "email",
8579/// "uri"
8580/// ]
8581/// },
8582/// "maxLength": {
8583/// "type": "integer"
8584/// },
8585/// "minLength": {
8586/// "type": "integer"
8587/// },
8588/// "title": {
8589/// "type": "string"
8590/// },
8591/// "type": {
8592/// "type": "string",
8593/// "const": "string"
8594/// }
8595/// }
8596///}
8597/// ```
8598/// </details>
8599#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8600pub struct StringSchema {
8601 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8602 pub default: ::std::option::Option<::std::string::String>,
8603 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8604 pub description: ::std::option::Option<::std::string::String>,
8605 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8606 pub format: ::std::option::Option<StringSchemaFormat>,
8607 #[serde(rename = "maxLength", default, skip_serializing_if = "::std::option::Option::is_none")]
8608 pub max_length: ::std::option::Option<i64>,
8609 #[serde(rename = "minLength", default, skip_serializing_if = "::std::option::Option::is_none")]
8610 pub min_length: ::std::option::Option<i64>,
8611 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
8612 pub title: ::std::option::Option<::std::string::String>,
8613 #[serde(rename = "type", deserialize_with = "validate::string_schema_type_")]
8614 type_: ::std::string::String,
8615}
8616impl StringSchema {
8617 pub fn new(
8618 default: ::std::option::Option<::std::string::String>,
8619 description: ::std::option::Option<::std::string::String>,
8620 format: ::std::option::Option<StringSchemaFormat>,
8621 max_length: ::std::option::Option<i64>,
8622 min_length: ::std::option::Option<i64>,
8623 title: ::std::option::Option<::std::string::String>,
8624 ) -> Self {
8625 Self {
8626 default,
8627 description,
8628 format,
8629 max_length,
8630 min_length,
8631 title,
8632 type_: "string".to_string(),
8633 }
8634 }
8635 pub fn type_(&self) -> &::std::string::String {
8636 &self.type_
8637 }
8638 /// returns "string"
8639 pub fn type_value() -> &'static str {
8640 "string"
8641 }
8642 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
8643 pub fn type_name() -> &'static str {
8644 "string"
8645 }
8646}
8647///StringSchemaFormat
8648///
8649/// <details><summary>JSON schema</summary>
8650///
8651/// ```json
8652///{
8653/// "type": "string",
8654/// "enum": [
8655/// "date",
8656/// "date-time",
8657/// "email",
8658/// "uri"
8659/// ]
8660///}
8661/// ```
8662/// </details>
8663#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
8664pub enum StringSchemaFormat {
8665 #[serde(rename = "date")]
8666 Date,
8667 #[serde(rename = "date-time")]
8668 DateTime,
8669 #[serde(rename = "email")]
8670 Email,
8671 #[serde(rename = "uri")]
8672 Uri,
8673}
8674impl ::std::fmt::Display for StringSchemaFormat {
8675 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
8676 match *self {
8677 Self::Date => write!(f, "date"),
8678 Self::DateTime => write!(f, "date-time"),
8679 Self::Email => write!(f, "email"),
8680 Self::Uri => write!(f, "uri"),
8681 }
8682 }
8683}
8684/**The set of notification types a client may opt in to on a
8685{@link SubscriptionsListenRequestsubscriptions/listen} request.
8686Each notification type is **opt-in**; the server **MUST NOT** send
8687notification types the client has not explicitly requested here.*/
8688///
8689/// <details><summary>JSON schema</summary>
8690///
8691/// ```json
8692///{
8693/// "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.",
8694/// "type": "object",
8695/// "properties": {
8696/// "promptsListChanged": {
8697/// "description": "If true, receive {@link PromptListChangedNotificationnotifications/prompts/list_changed}.",
8698/// "type": "boolean"
8699/// },
8700/// "resourceSubscriptions": {
8701/// "description": "Subscribe to {@link ResourceUpdatedNotificationnotifications/resources/updated} for these resource URIs.\nReplaces the former resources/subscribe RPC.",
8702/// "type": "array",
8703/// "items": {
8704/// "type": "string"
8705/// }
8706/// },
8707/// "resourcesListChanged": {
8708/// "description": "If true, receive {@link ResourceListChangedNotificationnotifications/resources/list_changed}.",
8709/// "type": "boolean"
8710/// },
8711/// "toolsListChanged": {
8712/// "description": "If true, receive {@link ToolListChangedNotificationnotifications/tools/list_changed}.",
8713/// "type": "boolean"
8714/// }
8715/// }
8716///}
8717/// ```
8718/// </details>
8719#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
8720pub struct SubscriptionFilter {
8721 ///If true, receive {@link PromptListChangedNotificationnotifications/prompts/list_changed}.
8722 #[serde(
8723 rename = "promptsListChanged",
8724 default,
8725 skip_serializing_if = "::std::option::Option::is_none"
8726 )]
8727 pub prompts_list_changed: ::std::option::Option<bool>,
8728 /**Subscribe to {@link ResourceUpdatedNotificationnotifications/resources/updated} for these resource URIs.
8729 Replaces the former resources/subscribe RPC.*/
8730 #[serde(
8731 rename = "resourceSubscriptions",
8732 default,
8733 skip_serializing_if = "::std::vec::Vec::is_empty"
8734 )]
8735 pub resource_subscriptions: ::std::vec::Vec<::std::string::String>,
8736 ///If true, receive {@link ResourceListChangedNotificationnotifications/resources/list_changed}.
8737 #[serde(
8738 rename = "resourcesListChanged",
8739 default,
8740 skip_serializing_if = "::std::option::Option::is_none"
8741 )]
8742 pub resources_list_changed: ::std::option::Option<bool>,
8743 ///If true, receive {@link ToolListChangedNotificationnotifications/tools/list_changed}.
8744 #[serde(
8745 rename = "toolsListChanged",
8746 default,
8747 skip_serializing_if = "::std::option::Option::is_none"
8748 )]
8749 pub tools_list_changed: ::std::option::Option<bool>,
8750}
8751/**Sent by the server to acknowledge that a
8752{@link SubscriptionsListenRequestsubscriptions/listen} subscription has been
8753established and to report which notification types it agreed to honor.
8754This notification MUST be the first message the server sends carrying the
8755subscription's ID in io.modelcontextprotocol/subscriptionId. The server MUST
8756NOT send any notification on the subscription before acknowledging it. On
8757stdio, where every subscription shares one channel, this ordering is defined
8758per subscription ID and not per channel: messages belonging to other
8759subscriptions MAY be interleaved before it.*/
8760///
8761/// <details><summary>JSON schema</summary>
8762///
8763/// ```json
8764///{
8765/// "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.",
8766/// "type": "object",
8767/// "required": [
8768/// "jsonrpc",
8769/// "method",
8770/// "params"
8771/// ],
8772/// "properties": {
8773/// "jsonrpc": {
8774/// "type": "string",
8775/// "const": "2.0"
8776/// },
8777/// "method": {
8778/// "type": "string",
8779/// "const": "notifications/subscriptions/acknowledged"
8780/// },
8781/// "params": {
8782/// "$ref": "#/$defs/SubscriptionsAcknowledgedNotificationParams"
8783/// }
8784/// }
8785///}
8786/// ```
8787/// </details>
8788#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8789pub struct SubscriptionsAcknowledgedNotification {
8790 #[serde(deserialize_with = "validate::subscriptions_acknowledged_notification_jsonrpc")]
8791 jsonrpc: ::std::string::String,
8792 #[serde(deserialize_with = "validate::subscriptions_acknowledged_notification_method")]
8793 method: ::std::string::String,
8794 pub params: SubscriptionsAcknowledgedNotificationParams,
8795}
8796impl SubscriptionsAcknowledgedNotification {
8797 pub fn new(params: SubscriptionsAcknowledgedNotificationParams) -> Self {
8798 Self {
8799 jsonrpc: JSONRPC_VERSION.to_string(),
8800 method: "notifications/subscriptions/acknowledged".to_string(),
8801 params,
8802 }
8803 }
8804 pub fn jsonrpc(&self) -> &::std::string::String {
8805 &self.jsonrpc
8806 }
8807 pub fn method(&self) -> &::std::string::String {
8808 &self.method
8809 }
8810 /// returns "notifications/subscriptions/acknowledged"
8811 pub fn method_value() -> &'static str {
8812 "notifications/subscriptions/acknowledged"
8813 }
8814 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
8815 pub fn method_name() -> &'static str {
8816 "notifications/subscriptions/acknowledged"
8817 }
8818}
8819///Parameters for a {@link SubscriptionsAcknowledgedNotificationnotifications/subscriptions/acknowledged} notification.
8820///
8821/// <details><summary>JSON schema</summary>
8822///
8823/// ```json
8824///{
8825/// "description": "Parameters for a {@link SubscriptionsAcknowledgedNotificationnotifications/subscriptions/acknowledged} notification.",
8826/// "type": "object",
8827/// "required": [
8828/// "notifications"
8829/// ],
8830/// "properties": {
8831/// "_meta": {
8832/// "$ref": "#/$defs/NotificationMetaObject"
8833/// },
8834/// "notifications": {
8835/// "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.",
8836/// "$ref": "#/$defs/SubscriptionFilter"
8837/// }
8838/// }
8839///}
8840/// ```
8841/// </details>
8842#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
8843pub struct SubscriptionsAcknowledgedNotificationParams {
8844 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
8845 pub meta: ::std::option::Option<NotificationMetaObject>,
8846 /**The subset of requested notification types the server agreed to honor.
8847 Only includes notification types the server actually supports; if the
8848 client requested an unsupported type (e.g., promptsListChanged when
8849 the server has no prompts), it is omitted from this set.*/
8850 pub notifications: SubscriptionFilter,
8851}
8852/**Sent from the client to open a long-lived channel for receiving notifications
8853outside the context of a specific request. Replaces the previous HTTP GET
8854endpoint and ensures consistent behavior between HTTP and STDIO.*/
8855///
8856/// <details><summary>JSON schema</summary>
8857///
8858/// ```json
8859///{
8860/// "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.",
8861/// "type": "object",
8862/// "required": [
8863/// "id",
8864/// "jsonrpc",
8865/// "method",
8866/// "params"
8867/// ],
8868/// "properties": {
8869/// "id": {
8870/// "$ref": "#/$defs/RequestId"
8871/// },
8872/// "jsonrpc": {
8873/// "type": "string",
8874/// "const": "2.0"
8875/// },
8876/// "method": {
8877/// "type": "string",
8878/// "const": "subscriptions/listen"
8879/// },
8880/// "params": {
8881/// "$ref": "#/$defs/SubscriptionsListenRequestParams"
8882/// }
8883/// }
8884///}
8885/// ```
8886/// </details>
8887#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8888pub struct SubscriptionsListenRequest {
8889 pub id: RequestId,
8890 #[serde(deserialize_with = "validate::subscriptions_listen_request_jsonrpc")]
8891 jsonrpc: ::std::string::String,
8892 #[serde(deserialize_with = "validate::subscriptions_listen_request_method")]
8893 method: ::std::string::String,
8894 pub params: SubscriptionsListenRequestParams,
8895}
8896impl SubscriptionsListenRequest {
8897 pub fn new(id: RequestId, params: SubscriptionsListenRequestParams) -> Self {
8898 Self {
8899 id,
8900 jsonrpc: JSONRPC_VERSION.to_string(),
8901 method: "subscriptions/listen".to_string(),
8902 params,
8903 }
8904 }
8905 pub fn jsonrpc(&self) -> &::std::string::String {
8906 &self.jsonrpc
8907 }
8908 pub fn method(&self) -> &::std::string::String {
8909 &self.method
8910 }
8911 /// returns "subscriptions/listen"
8912 pub fn method_value() -> &'static str {
8913 "subscriptions/listen"
8914 }
8915 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
8916 pub fn method_name() -> &'static str {
8917 "subscriptions/listen"
8918 }
8919}
8920///Parameters for a {@link SubscriptionsListenRequestsubscriptions/listen} request.
8921///
8922/// <details><summary>JSON schema</summary>
8923///
8924/// ```json
8925///{
8926/// "description": "Parameters for a {@link SubscriptionsListenRequestsubscriptions/listen} request.",
8927/// "type": "object",
8928/// "required": [
8929/// "_meta",
8930/// "notifications"
8931/// ],
8932/// "properties": {
8933/// "_meta": {
8934/// "$ref": "#/$defs/RequestMetaObject"
8935/// },
8936/// "notifications": {
8937/// "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.",
8938/// "$ref": "#/$defs/SubscriptionFilter"
8939/// }
8940/// }
8941///}
8942/// ```
8943/// </details>
8944#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8945pub struct SubscriptionsListenRequestParams {
8946 #[serde(rename = "_meta")]
8947 pub meta: RequestMetaObject,
8948 /**The notifications the client opts in to on this stream. The server
8949 **MUST NOT** send notification types the client has not explicitly
8950 requested.*/
8951 pub notifications: SubscriptionFilter,
8952}
8953/**The response to a {@link SubscriptionsListenRequestsubscriptions/listen}
8954request, signalling that the subscription has ended gracefully (for example,
8955during server shutdown). Because the listen stream is long-lived, this result
8956is sent only when the server tears the subscription down; an abrupt transport
8957close carries no response. The result body is otherwise empty.*/
8958///
8959/// <details><summary>JSON schema</summary>
8960///
8961/// ```json
8962///{
8963/// "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.",
8964/// "type": "object",
8965/// "required": [
8966/// "_meta",
8967/// "resultType"
8968/// ],
8969/// "properties": {
8970/// "_meta": {
8971/// "$ref": "#/$defs/SubscriptionsListenResultMetaObject"
8972/// },
8973/// "resultType": {
8974/// "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\".",
8975/// "type": "string"
8976/// }
8977/// }
8978///}
8979/// ```
8980/// </details>
8981#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8982pub struct SubscriptionsListenResult {
8983 #[serde(rename = "_meta")]
8984 pub meta: SubscriptionsListenResultMetaObject,
8985 /**Indicates the type of the result, which allows the client to determine
8986 how to parse the result object.
8987 Servers implementing this protocol version MUST include this field.
8988 For backward compatibility, when a client receives a result from a
8989 server implementing an earlier protocol version (which does not include
8990 resultType), the client MUST treat the absent field as "complete".*/
8991 #[serde(rename = "resultType")]
8992 pub result_type: ::std::string::String,
8993}
8994/**Extends {@link ResultMetaObject} with the subscription-stream identifier carried by a
8995{@link SubscriptionsListenResult}. All key naming rules from MetaObject apply.*/
8996///
8997/// <details><summary>JSON schema</summary>
8998///
8999/// ```json
9000///{
9001/// "description": "Extends {@link ResultMetaObject} with the subscription-stream identifier carried by a\n{@link SubscriptionsListenResult}. All key naming rules from MetaObject apply.",
9002/// "type": "object",
9003/// "required": [
9004/// "io.modelcontextprotocol/subscriptionId"
9005/// ],
9006/// "properties": {
9007/// "io.modelcontextprotocol/serverInfo": {
9008/// "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.",
9009/// "$ref": "#/$defs/Implementation"
9010/// },
9011/// "io.modelcontextprotocol/subscriptionId": {
9012/// "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).",
9013/// "$ref": "#/$defs/RequestId"
9014/// }
9015/// },
9016/// "additionalProperties": {}
9017///}
9018/// ```
9019/// </details>
9020#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9021pub struct SubscriptionsListenResultMetaObject {
9022 /**Identifies the server software producing the response. Servers SHOULD
9023 include this field on every response unless specifically configured not
9024 to do so.
9025 The {@link Implementation} schema requires name and version; other
9026 fields are optional.
9027 The value is self-reported by the server and is not verified by the
9028 protocol. It is intended for display, logging, and debugging. Clients
9029 SHOULD NOT use it to change their behavior, and SHOULD NOT rely on it for
9030 security decisions.*/
9031 #[serde(
9032 rename = "io.modelcontextprotocol/serverInfo",
9033 default,
9034 skip_serializing_if = "::std::option::Option::is_none"
9035 )]
9036 pub io_modelcontextprotocol_server_info: ::std::option::Option<Implementation>,
9037 /**Identifies the subscription stream this response closes, so the client can
9038 correlate it with the originating subscription — mirroring the same key on
9039 the stream's notifications. The value is the JSON-RPC ID of the
9040 subscriptions/listen request that opened the stream (and equals this
9041 response's id).*/
9042 #[serde(rename = "io.modelcontextprotocol/subscriptionId")]
9043 pub io_modelcontextprotocol_subscription_id: RequestId,
9044 #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
9045 pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
9046}
9047/**A successful response from the server for a {@link SubscriptionsListenRequestsubscriptions/listen}
9048request, sent when the server tears the subscription down gracefully.*/
9049///
9050/// <details><summary>JSON schema</summary>
9051///
9052/// ```json
9053///{
9054/// "description": "A successful response from the server for a {@link SubscriptionsListenRequestsubscriptions/listen}\nrequest, sent when the server tears the subscription down gracefully.",
9055/// "type": "object",
9056/// "required": [
9057/// "id",
9058/// "jsonrpc",
9059/// "result"
9060/// ],
9061/// "properties": {
9062/// "id": {
9063/// "$ref": "#/$defs/RequestId"
9064/// },
9065/// "jsonrpc": {
9066/// "type": "string",
9067/// "const": "2.0"
9068/// },
9069/// "result": {
9070/// "$ref": "#/$defs/SubscriptionsListenResult"
9071/// }
9072/// }
9073///}
9074/// ```
9075/// </details>
9076#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9077pub struct SubscriptionsListenResultResponse {
9078 pub id: RequestId,
9079 #[serde(deserialize_with = "validate::subscriptions_listen_result_response_jsonrpc")]
9080 jsonrpc: ::std::string::String,
9081 pub result: SubscriptionsListenResult,
9082}
9083impl SubscriptionsListenResultResponse {
9084 pub fn new(id: RequestId, result: SubscriptionsListenResult) -> Self {
9085 Self {
9086 id,
9087 jsonrpc: JSONRPC_VERSION.to_string(),
9088 result,
9089 }
9090 }
9091 pub fn jsonrpc(&self) -> &::std::string::String {
9092 &self.jsonrpc
9093 }
9094}
9095///Text provided to or from an LLM.
9096///
9097/// <details><summary>JSON schema</summary>
9098///
9099/// ```json
9100///{
9101/// "description": "Text provided to or from an LLM.",
9102/// "type": "object",
9103/// "required": [
9104/// "text",
9105/// "type"
9106/// ],
9107/// "properties": {
9108/// "_meta": {
9109/// "$ref": "#/$defs/MetaObject"
9110/// },
9111/// "annotations": {
9112/// "description": "Optional annotations for the client.",
9113/// "$ref": "#/$defs/Annotations"
9114/// },
9115/// "text": {
9116/// "description": "The text content of the message.",
9117/// "type": "string"
9118/// },
9119/// "type": {
9120/// "type": "string",
9121/// "const": "text"
9122/// }
9123/// }
9124///}
9125/// ```
9126/// </details>
9127#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9128pub struct TextContent {
9129 ///Optional annotations for the client.
9130 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9131 pub annotations: ::std::option::Option<Annotations>,
9132 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
9133 pub meta: ::std::option::Option<MetaObject>,
9134 ///The text content of the message.
9135 pub text: ::std::string::String,
9136 #[serde(rename = "type", deserialize_with = "validate::text_content_type_")]
9137 type_: ::std::string::String,
9138}
9139impl TextContent {
9140 pub fn new(
9141 text: ::std::string::String,
9142 annotations: ::std::option::Option<Annotations>,
9143 meta: ::std::option::Option<MetaObject>,
9144 ) -> Self {
9145 Self {
9146 annotations,
9147 meta,
9148 text,
9149 type_: "text".to_string(),
9150 }
9151 }
9152 pub fn type_(&self) -> &::std::string::String {
9153 &self.type_
9154 }
9155 /// returns "text"
9156 pub fn type_value() -> &'static str {
9157 "text"
9158 }
9159 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
9160 pub fn type_name() -> &'static str {
9161 "text"
9162 }
9163}
9164///TextResourceContents
9165///
9166/// <details><summary>JSON schema</summary>
9167///
9168/// ```json
9169///{
9170/// "type": "object",
9171/// "required": [
9172/// "text",
9173/// "uri"
9174/// ],
9175/// "properties": {
9176/// "_meta": {
9177/// "$ref": "#/$defs/MetaObject"
9178/// },
9179/// "mimeType": {
9180/// "description": "The MIME type of this resource, if known.",
9181/// "type": "string"
9182/// },
9183/// "text": {
9184/// "description": "The text of the item. This must only be set if the item can actually be represented as text (not binary data).",
9185/// "type": "string"
9186/// },
9187/// "uri": {
9188/// "description": "The URI of this resource.",
9189/// "type": "string",
9190/// "format": "uri"
9191/// }
9192/// }
9193///}
9194/// ```
9195/// </details>
9196#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9197pub struct TextResourceContents {
9198 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
9199 pub meta: ::std::option::Option<MetaObject>,
9200 ///The MIME type of this resource, if known.
9201 #[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
9202 pub mime_type: ::std::option::Option<::std::string::String>,
9203 ///The text of the item. This must only be set if the item can actually be represented as text (not binary data).
9204 pub text: ::std::string::String,
9205 ///The URI of this resource.
9206 pub uri: ::std::string::String,
9207}
9208///Schema for multiple-selection enumeration with display titles for each option.
9209///
9210/// <details><summary>JSON schema</summary>
9211///
9212/// ```json
9213///{
9214/// "description": "Schema for multiple-selection enumeration with display titles for each option.",
9215/// "type": "object",
9216/// "required": [
9217/// "items",
9218/// "type"
9219/// ],
9220/// "properties": {
9221/// "default": {
9222/// "description": "Optional default value.",
9223/// "type": "array",
9224/// "items": {
9225/// "type": "string"
9226/// }
9227/// },
9228/// "description": {
9229/// "description": "Optional description for the enum field.",
9230/// "type": "string"
9231/// },
9232/// "items": {
9233/// "description": "Schema for array items with enum options and display labels.",
9234/// "type": "object",
9235/// "required": [
9236/// "anyOf"
9237/// ],
9238/// "properties": {
9239/// "anyOf": {
9240/// "description": "Array of enum options with values and display labels.",
9241/// "type": "array",
9242/// "items": {
9243/// "type": "object",
9244/// "required": [
9245/// "const",
9246/// "title"
9247/// ],
9248/// "properties": {
9249/// "const": {
9250/// "description": "The constant enum value.",
9251/// "type": "string"
9252/// },
9253/// "title": {
9254/// "description": "Display title for this option.",
9255/// "type": "string"
9256/// }
9257/// }
9258/// }
9259/// }
9260/// }
9261/// },
9262/// "maxItems": {
9263/// "description": "Maximum number of items to select.",
9264/// "type": "integer"
9265/// },
9266/// "minItems": {
9267/// "description": "Minimum number of items to select.",
9268/// "type": "integer"
9269/// },
9270/// "title": {
9271/// "description": "Optional title for the enum field.",
9272/// "type": "string"
9273/// },
9274/// "type": {
9275/// "type": "string",
9276/// "const": "array"
9277/// }
9278/// }
9279///}
9280/// ```
9281/// </details>
9282#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9283pub struct TitledMultiSelectEnumSchema {
9284 ///Optional default value.
9285 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
9286 pub default: ::std::vec::Vec<::std::string::String>,
9287 ///Optional description for the enum field.
9288 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9289 pub description: ::std::option::Option<::std::string::String>,
9290 pub items: TitledMultiSelectEnumSchemaItems,
9291 ///Maximum number of items to select.
9292 #[serde(rename = "maxItems", default, skip_serializing_if = "::std::option::Option::is_none")]
9293 pub max_items: ::std::option::Option<i64>,
9294 ///Minimum number of items to select.
9295 #[serde(rename = "minItems", default, skip_serializing_if = "::std::option::Option::is_none")]
9296 pub min_items: ::std::option::Option<i64>,
9297 ///Optional title for the enum field.
9298 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9299 pub title: ::std::option::Option<::std::string::String>,
9300 #[serde(rename = "type", deserialize_with = "validate::titled_multi_select_enum_schema_type_")]
9301 type_: ::std::string::String,
9302}
9303impl TitledMultiSelectEnumSchema {
9304 pub fn new(
9305 default: ::std::vec::Vec<::std::string::String>,
9306 items: TitledMultiSelectEnumSchemaItems,
9307 description: ::std::option::Option<::std::string::String>,
9308 max_items: ::std::option::Option<i64>,
9309 min_items: ::std::option::Option<i64>,
9310 title: ::std::option::Option<::std::string::String>,
9311 ) -> Self {
9312 Self {
9313 default,
9314 description,
9315 items,
9316 max_items,
9317 min_items,
9318 title,
9319 type_: "array".to_string(),
9320 }
9321 }
9322 pub fn type_(&self) -> &::std::string::String {
9323 &self.type_
9324 }
9325 /// returns "array"
9326 pub fn type_value() -> &'static str {
9327 "array"
9328 }
9329 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
9330 pub fn type_name() -> &'static str {
9331 "array"
9332 }
9333}
9334///Schema for array items with enum options and display labels.
9335///
9336/// <details><summary>JSON schema</summary>
9337///
9338/// ```json
9339///{
9340/// "description": "Schema for array items with enum options and display labels.",
9341/// "type": "object",
9342/// "required": [
9343/// "anyOf"
9344/// ],
9345/// "properties": {
9346/// "anyOf": {
9347/// "description": "Array of enum options with values and display labels.",
9348/// "type": "array",
9349/// "items": {
9350/// "type": "object",
9351/// "required": [
9352/// "const",
9353/// "title"
9354/// ],
9355/// "properties": {
9356/// "const": {
9357/// "description": "The constant enum value.",
9358/// "type": "string"
9359/// },
9360/// "title": {
9361/// "description": "Display title for this option.",
9362/// "type": "string"
9363/// }
9364/// }
9365/// }
9366/// }
9367/// }
9368///}
9369/// ```
9370/// </details>
9371#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9372pub struct TitledMultiSelectEnumSchemaItems {
9373 ///Array of enum options with values and display labels.
9374 #[serde(rename = "anyOf")]
9375 pub any_of: ::std::vec::Vec<TitledMultiSelectEnumSchemaItemsAnyOfItem>,
9376}
9377///TitledMultiSelectEnumSchemaItemsAnyOfItem
9378///
9379/// <details><summary>JSON schema</summary>
9380///
9381/// ```json
9382///{
9383/// "type": "object",
9384/// "required": [
9385/// "const",
9386/// "title"
9387/// ],
9388/// "properties": {
9389/// "const": {
9390/// "description": "The constant enum value.",
9391/// "type": "string"
9392/// },
9393/// "title": {
9394/// "description": "Display title for this option.",
9395/// "type": "string"
9396/// }
9397/// }
9398///}
9399/// ```
9400/// </details>
9401#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9402pub struct TitledMultiSelectEnumSchemaItemsAnyOfItem {
9403 ///The constant enum value.
9404 #[serde(rename = "const")]
9405 pub const_: ::std::string::String,
9406 ///Display title for this option.
9407 pub title: ::std::string::String,
9408}
9409///Schema for single-selection enumeration with display titles for each option.
9410///
9411/// <details><summary>JSON schema</summary>
9412///
9413/// ```json
9414///{
9415/// "description": "Schema for single-selection enumeration with display titles for each option.",
9416/// "type": "object",
9417/// "required": [
9418/// "oneOf",
9419/// "type"
9420/// ],
9421/// "properties": {
9422/// "default": {
9423/// "description": "Optional default value.",
9424/// "type": "string"
9425/// },
9426/// "description": {
9427/// "description": "Optional description for the enum field.",
9428/// "type": "string"
9429/// },
9430/// "oneOf": {
9431/// "description": "Array of enum options with values and display labels.",
9432/// "type": "array",
9433/// "items": {
9434/// "type": "object",
9435/// "required": [
9436/// "const",
9437/// "title"
9438/// ],
9439/// "properties": {
9440/// "const": {
9441/// "description": "The enum value.",
9442/// "type": "string"
9443/// },
9444/// "title": {
9445/// "description": "Display label for this option.",
9446/// "type": "string"
9447/// }
9448/// }
9449/// }
9450/// },
9451/// "title": {
9452/// "description": "Optional title for the enum field.",
9453/// "type": "string"
9454/// },
9455/// "type": {
9456/// "type": "string",
9457/// "const": "string"
9458/// }
9459/// }
9460///}
9461/// ```
9462/// </details>
9463#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9464pub struct TitledSingleSelectEnumSchema {
9465 ///Optional default value.
9466 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9467 pub default: ::std::option::Option<::std::string::String>,
9468 ///Optional description for the enum field.
9469 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9470 pub description: ::std::option::Option<::std::string::String>,
9471 ///Array of enum options with values and display labels.
9472 #[serde(rename = "oneOf")]
9473 pub one_of: ::std::vec::Vec<TitledSingleSelectEnumSchemaOneOfItem>,
9474 ///Optional title for the enum field.
9475 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9476 pub title: ::std::option::Option<::std::string::String>,
9477 #[serde(rename = "type", deserialize_with = "validate::titled_single_select_enum_schema_type_")]
9478 type_: ::std::string::String,
9479}
9480impl TitledSingleSelectEnumSchema {
9481 pub fn new(
9482 one_of: ::std::vec::Vec<TitledSingleSelectEnumSchemaOneOfItem>,
9483 default: ::std::option::Option<::std::string::String>,
9484 description: ::std::option::Option<::std::string::String>,
9485 title: ::std::option::Option<::std::string::String>,
9486 ) -> Self {
9487 Self {
9488 default,
9489 description,
9490 one_of,
9491 title,
9492 type_: "string".to_string(),
9493 }
9494 }
9495 pub fn type_(&self) -> &::std::string::String {
9496 &self.type_
9497 }
9498 /// returns "string"
9499 pub fn type_value() -> &'static str {
9500 "string"
9501 }
9502 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
9503 pub fn type_name() -> &'static str {
9504 "string"
9505 }
9506}
9507///TitledSingleSelectEnumSchemaOneOfItem
9508///
9509/// <details><summary>JSON schema</summary>
9510///
9511/// ```json
9512///{
9513/// "type": "object",
9514/// "required": [
9515/// "const",
9516/// "title"
9517/// ],
9518/// "properties": {
9519/// "const": {
9520/// "description": "The enum value.",
9521/// "type": "string"
9522/// },
9523/// "title": {
9524/// "description": "Display label for this option.",
9525/// "type": "string"
9526/// }
9527/// }
9528///}
9529/// ```
9530/// </details>
9531#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9532pub struct TitledSingleSelectEnumSchemaOneOfItem {
9533 ///The enum value.
9534 #[serde(rename = "const")]
9535 pub const_: ::std::string::String,
9536 ///Display label for this option.
9537 pub title: ::std::string::String,
9538}
9539///Definition for a tool the client can call.
9540///
9541/// <details><summary>JSON schema</summary>
9542///
9543/// ```json
9544///{
9545/// "description": "Definition for a tool the client can call.",
9546/// "type": "object",
9547/// "required": [
9548/// "inputSchema",
9549/// "name"
9550/// ],
9551/// "properties": {
9552/// "_meta": {
9553/// "$ref": "#/$defs/MetaObject"
9554/// },
9555/// "annotations": {
9556/// "description": "Optional additional tool information.\n\nDisplay name precedence order is: title, annotations.title, then name.",
9557/// "$ref": "#/$defs/ToolAnnotations"
9558/// },
9559/// "description": {
9560/// "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.",
9561/// "type": "string"
9562/// },
9563/// "icons": {
9564/// "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)",
9565/// "type": "array",
9566/// "items": {
9567/// "$ref": "#/$defs/Icon"
9568/// }
9569/// },
9570/// "inputSchema": {
9571/// "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.",
9572/// "type": "object",
9573/// "required": [
9574/// "type"
9575/// ],
9576/// "properties": {
9577/// "$schema": {
9578/// "type": "string"
9579/// },
9580/// "type": {
9581/// "type": "string",
9582/// "const": "object"
9583/// }
9584/// },
9585/// "additionalProperties": {}
9586/// },
9587/// "name": {
9588/// "description": "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).",
9589/// "type": "string"
9590/// },
9591/// "outputSchema": {
9592/// "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.",
9593/// "type": "object",
9594/// "properties": {
9595/// "$schema": {
9596/// "type": "string"
9597/// }
9598/// },
9599/// "additionalProperties": {}
9600/// },
9601/// "title": {
9602/// "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).",
9603/// "type": "string"
9604/// }
9605/// }
9606///}
9607/// ```
9608/// </details>
9609#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9610pub struct Tool {
9611 /**Optional additional tool information.
9612 Display name precedence order is: title, annotations.title, then name.*/
9613 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9614 pub annotations: ::std::option::Option<ToolAnnotations>,
9615 /**A human-readable description of the tool.
9616 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.*/
9617 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9618 pub description: ::std::option::Option<::std::string::String>,
9619 /**Optional set of sized icons that the client can display in a user interface.
9620 Clients that support rendering icons MUST support at least the following MIME types:
9621 - image/png - PNG images (safe, universal compatibility)
9622 - image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
9623 Clients that support rendering icons SHOULD also support:
9624 - image/svg+xml - SVG images (scalable but requires security precautions)
9625 - image/webp - WebP images (modern, efficient format)*/
9626 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
9627 pub icons: ::std::vec::Vec<Icon>,
9628 #[serde(rename = "inputSchema")]
9629 pub input_schema: ToolInputSchema,
9630 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
9631 pub meta: ::std::option::Option<MetaObject>,
9632 ///Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
9633 pub name: ::std::string::String,
9634 #[serde(rename = "outputSchema", default, skip_serializing_if = "::std::option::Option::is_none")]
9635 pub output_schema: ::std::option::Option<ToolOutputSchema>,
9636 /**Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
9637 even by those unfamiliar with domain-specific terminology.
9638 If not provided, the name should be used for display (except for {@link Tool},
9639 where annotations.title should be given precedence over using name,
9640 if present).*/
9641 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9642 pub title: ::std::option::Option<::std::string::String>,
9643}
9644/**Additional properties describing a {@link Tool} to clients.
9645NOTE: all properties in ToolAnnotations are **hints**.
9646They are not guaranteed to provide a faithful description of
9647tool behavior (including descriptive properties like title).
9648Clients should never make tool use decisions based on ToolAnnotations
9649received from untrusted servers.*/
9650///
9651/// <details><summary>JSON schema</summary>
9652///
9653/// ```json
9654///{
9655/// "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.",
9656/// "type": "object",
9657/// "properties": {
9658/// "destructiveHint": {
9659/// "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",
9660/// "type": "boolean"
9661/// },
9662/// "idempotentHint": {
9663/// "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",
9664/// "type": "boolean"
9665/// },
9666/// "openWorldHint": {
9667/// "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",
9668/// "type": "boolean"
9669/// },
9670/// "readOnlyHint": {
9671/// "description": "If true, the tool does not modify its environment.\n\nDefault: false",
9672/// "type": "boolean"
9673/// },
9674/// "title": {
9675/// "description": "A human-readable title for the tool.",
9676/// "type": "string"
9677/// }
9678/// }
9679///}
9680/// ```
9681/// </details>
9682#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
9683pub struct ToolAnnotations {
9684 /**If true, the tool may perform destructive updates to its environment.
9685 If false, the tool performs only additive updates.
9686 (This property is meaningful only when readOnlyHint == false)
9687 Default: true*/
9688 #[serde(rename = "destructiveHint", default, skip_serializing_if = "::std::option::Option::is_none")]
9689 pub destructive_hint: ::std::option::Option<bool>,
9690 /**If true, calling the tool repeatedly with the same arguments
9691 will have no additional effect on its environment.
9692 (This property is meaningful only when readOnlyHint == false)
9693 Default: false*/
9694 #[serde(rename = "idempotentHint", default, skip_serializing_if = "::std::option::Option::is_none")]
9695 pub idempotent_hint: ::std::option::Option<bool>,
9696 /**If true, this tool may interact with an "open world" of external
9697 entities. If false, the tool's domain of interaction is closed.
9698 For example, the world of a web search tool is open, whereas that
9699 of a memory tool is not.
9700 Default: true*/
9701 #[serde(rename = "openWorldHint", default, skip_serializing_if = "::std::option::Option::is_none")]
9702 pub open_world_hint: ::std::option::Option<bool>,
9703 /**If true, the tool does not modify its environment.
9704 Default: false*/
9705 #[serde(rename = "readOnlyHint", default, skip_serializing_if = "::std::option::Option::is_none")]
9706 pub read_only_hint: ::std::option::Option<bool>,
9707 ///A human-readable title for the tool.
9708 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9709 pub title: ::std::option::Option<::std::string::String>,
9710}
9711///Controls tool selection behavior for sampling requests.
9712///
9713/// <details><summary>JSON schema</summary>
9714///
9715/// ```json
9716///{
9717/// "description": "Controls tool selection behavior for sampling requests.",
9718/// "type": "object",
9719/// "properties": {
9720/// "mode": {
9721/// "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",
9722/// "type": "string",
9723/// "enum": [
9724/// "auto",
9725/// "none",
9726/// "required"
9727/// ]
9728/// }
9729/// }
9730///}
9731/// ```
9732/// </details>
9733#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
9734pub struct ToolChoice {
9735 /**Controls the tool use ability of the model:
9736 - "auto": Model decides whether to use tools (default)
9737 - "required": Model MUST use at least one tool before completing
9738 - "none": Model MUST NOT use any tools*/
9739 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9740 pub mode: ::std::option::Option<ToolChoiceMode>,
9741}
9742/**Controls the tool use ability of the model:
9743- "auto": Model decides whether to use tools (default)
9744- "required": Model MUST use at least one tool before completing
9745- "none": Model MUST NOT use any tools*/
9746///
9747/// <details><summary>JSON schema</summary>
9748///
9749/// ```json
9750///{
9751/// "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",
9752/// "type": "string",
9753/// "enum": [
9754/// "auto",
9755/// "none",
9756/// "required"
9757/// ]
9758///}
9759/// ```
9760/// </details>
9761#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
9762pub enum ToolChoiceMode {
9763 #[serde(rename = "auto")]
9764 Auto,
9765 #[serde(rename = "none")]
9766 None,
9767 #[serde(rename = "required")]
9768 Required,
9769}
9770impl ::std::fmt::Display for ToolChoiceMode {
9771 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9772 match *self {
9773 Self::Auto => write!(f, "auto"),
9774 Self::None => write!(f, "none"),
9775 Self::Required => write!(f, "required"),
9776 }
9777 }
9778}
9779/**A JSON Schema object defining the expected parameters for the tool.
9780Tool arguments are always JSON objects, so type: "object" is required at the root.
9781Beyond that, any JSON Schema 2020-12 keyword may appear alongside type — including
9782composition keywords (oneOf, anyOf, allOf, not), conditional keywords
9783(if/then/else), reference keywords ($ref, $defs, $anchor), and any other
9784standard validation or annotation keywords.
9785Property schemas may carry an x-mcp-header annotation to mirror the
9786argument value into an HTTP header on the Streamable HTTP transport. See
9787the Streamable HTTP transport specification for the validity and
9788extraction rules.
9789Defaults to JSON Schema 2020-12 when no explicit $schema is provided.*/
9790///
9791/// <details><summary>JSON schema</summary>
9792///
9793/// ```json
9794///{
9795/// "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.",
9796/// "type": "object",
9797/// "required": [
9798/// "type"
9799/// ],
9800/// "properties": {
9801/// "$schema": {
9802/// "type": "string"
9803/// },
9804/// "type": {
9805/// "type": "string",
9806/// "const": "object"
9807/// }
9808/// },
9809/// "additionalProperties": {}
9810///}
9811/// ```
9812/// </details>
9813#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9814pub struct ToolInputSchema {
9815 #[serde(rename = "$schema", default, skip_serializing_if = "::std::option::Option::is_none")]
9816 pub schema: ::std::option::Option<::std::string::String>,
9817 #[serde(rename = "type", deserialize_with = "validate::tool_input_schema_type_")]
9818 type_: ::std::string::String,
9819 #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
9820 pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
9821}
9822impl ToolInputSchema {
9823 pub fn new(
9824 schema: ::std::option::Option<::std::string::String>,
9825 extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
9826 ) -> Self {
9827 Self {
9828 schema,
9829 type_: "object".to_string(),
9830 extra,
9831 }
9832 }
9833 pub fn type_(&self) -> &::std::string::String {
9834 &self.type_
9835 }
9836 /// returns "object"
9837 pub fn type_value() -> &'static str {
9838 "object"
9839 }
9840 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
9841 pub fn type_name() -> &'static str {
9842 "object"
9843 }
9844}
9845///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.
9846///
9847/// <details><summary>JSON schema</summary>
9848///
9849/// ```json
9850///{
9851/// "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.",
9852/// "type": "object",
9853/// "required": [
9854/// "jsonrpc",
9855/// "method"
9856/// ],
9857/// "properties": {
9858/// "jsonrpc": {
9859/// "type": "string",
9860/// "const": "2.0"
9861/// },
9862/// "method": {
9863/// "type": "string",
9864/// "const": "notifications/tools/list_changed"
9865/// },
9866/// "params": {
9867/// "$ref": "#/$defs/NotificationParams"
9868/// }
9869/// }
9870///}
9871/// ```
9872/// </details>
9873#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9874pub struct ToolListChangedNotification {
9875 #[serde(deserialize_with = "validate::tool_list_changed_notification_jsonrpc")]
9876 jsonrpc: ::std::string::String,
9877 #[serde(deserialize_with = "validate::tool_list_changed_notification_method")]
9878 method: ::std::string::String,
9879 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
9880 pub params: ::std::option::Option<NotificationParams>,
9881}
9882impl ToolListChangedNotification {
9883 pub fn new(params: ::std::option::Option<NotificationParams>) -> Self {
9884 Self {
9885 jsonrpc: JSONRPC_VERSION.to_string(),
9886 method: "notifications/tools/list_changed".to_string(),
9887 params,
9888 }
9889 }
9890 pub fn jsonrpc(&self) -> &::std::string::String {
9891 &self.jsonrpc
9892 }
9893 pub fn method(&self) -> &::std::string::String {
9894 &self.method
9895 }
9896 /// returns "notifications/tools/list_changed"
9897 pub fn method_value() -> &'static str {
9898 "notifications/tools/list_changed"
9899 }
9900 #[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
9901 pub fn method_name() -> &'static str {
9902 "notifications/tools/list_changed"
9903 }
9904}
9905/**An optional JSON Schema object defining the structure of the tool's output returned in
9906the structuredContent field of a {@link CallToolResult}. This can be any valid JSON Schema 2020-12.
9907Defaults to JSON Schema 2020-12 when no explicit $schema is provided.*/
9908///
9909/// <details><summary>JSON schema</summary>
9910///
9911/// ```json
9912///{
9913/// "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.",
9914/// "type": "object",
9915/// "properties": {
9916/// "$schema": {
9917/// "type": "string"
9918/// }
9919/// },
9920/// "additionalProperties": {}
9921///}
9922/// ```
9923/// </details>
9924#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
9925pub struct ToolOutputSchema {
9926 #[serde(rename = "$schema", default, skip_serializing_if = "::std::option::Option::is_none")]
9927 pub schema: ::std::option::Option<::std::string::String>,
9928 #[serde(flatten, default, skip_serializing_if = "::std::option::Option::is_none")]
9929 pub extra: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
9930}
9931///The result of a tool use, provided by the user back to the assistant.
9932///
9933/// <details><summary>JSON schema</summary>
9934///
9935/// ```json
9936///{
9937/// "description": "The result of a tool use, provided by the user back to the assistant.",
9938/// "type": "object",
9939/// "required": [
9940/// "content",
9941/// "toolUseId",
9942/// "type"
9943/// ],
9944/// "properties": {
9945/// "_meta": {
9946/// "description": "Optional metadata about the tool result. Clients SHOULD preserve this field when\nincluding tool results in subsequent sampling requests to enable caching optimizations.",
9947/// "$ref": "#/$defs/MetaObject"
9948/// },
9949/// "content": {
9950/// "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.",
9951/// "type": "array",
9952/// "items": {
9953/// "$ref": "#/$defs/ContentBlock"
9954/// }
9955/// },
9956/// "isError": {
9957/// "description": "Whether the tool use resulted in an error.\n\nIf true, the content typically describes the error that occurred.\nDefault: false",
9958/// "type": "boolean"
9959/// },
9960/// "structuredContent": {
9961/// "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."
9962/// },
9963/// "toolUseId": {
9964/// "description": "The ID of the tool use this result corresponds to.\n\nThis MUST match the ID from a previous {@link ToolUseContent}.",
9965/// "type": "string"
9966/// },
9967/// "type": {
9968/// "type": "string",
9969/// "const": "tool_result"
9970/// }
9971/// }
9972///}
9973/// ```
9974/// </details>
9975#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9976pub struct ToolResultContent {
9977 /**The unstructured result content of the tool use.
9978 This has the same format as {@link CallToolResult.content} and can include text, images,
9979 audio, resource links, and embedded resources.*/
9980 pub content: ::std::vec::Vec<ContentBlock>,
9981 /**Whether the tool use resulted in an error.
9982 If true, the content typically describes the error that occurred.
9983 Default: false*/
9984 #[serde(rename = "isError", default, skip_serializing_if = "::std::option::Option::is_none")]
9985 pub is_error: ::std::option::Option<bool>,
9986 /**Optional metadata about the tool result. Clients SHOULD preserve this field when
9987 including tool results in subsequent sampling requests to enable caching optimizations.*/
9988 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
9989 pub meta: ::std::option::Option<MetaObject>,
9990 /**An optional structured result value.
9991 This can be any JSON value (object, array, string, number, boolean, or null).
9992 If the tool defined an {@link Tool.outputSchema}, this SHOULD conform to that schema.*/
9993 #[serde(
9994 rename = "structuredContent",
9995 default,
9996 skip_serializing_if = "::std::option::Option::is_none"
9997 )]
9998 pub structured_content: ::std::option::Option<::serde_json::Value>,
9999 /**The ID of the tool use this result corresponds to.
10000 This MUST match the ID from a previous {@link ToolUseContent}.*/
10001 #[serde(rename = "toolUseId")]
10002 pub tool_use_id: ::std::string::String,
10003 #[serde(rename = "type", deserialize_with = "validate::tool_result_content_type_")]
10004 type_: ::std::string::String,
10005}
10006impl ToolResultContent {
10007 pub fn new(
10008 content: ::std::vec::Vec<ContentBlock>,
10009 tool_use_id: ::std::string::String,
10010 is_error: ::std::option::Option<bool>,
10011 meta: ::std::option::Option<MetaObject>,
10012 structured_content: ::std::option::Option<::serde_json::Value>,
10013 ) -> Self {
10014 Self {
10015 content,
10016 is_error,
10017 meta,
10018 structured_content,
10019 tool_use_id,
10020 type_: "tool_result".to_string(),
10021 }
10022 }
10023 pub fn type_(&self) -> &::std::string::String {
10024 &self.type_
10025 }
10026 /// returns "tool_result"
10027 pub fn type_value() -> &'static str {
10028 "tool_result"
10029 }
10030 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
10031 pub fn type_name() -> &'static str {
10032 "tool_result"
10033 }
10034}
10035///A request from the assistant to call a tool.
10036///
10037/// <details><summary>JSON schema</summary>
10038///
10039/// ```json
10040///{
10041/// "description": "A request from the assistant to call a tool.",
10042/// "type": "object",
10043/// "required": [
10044/// "id",
10045/// "input",
10046/// "name",
10047/// "type"
10048/// ],
10049/// "properties": {
10050/// "_meta": {
10051/// "description": "Optional metadata about the tool use. Clients SHOULD preserve this field when\nincluding tool uses in subsequent sampling requests to enable caching optimizations.",
10052/// "$ref": "#/$defs/MetaObject"
10053/// },
10054/// "id": {
10055/// "description": "A unique identifier for this tool use.\n\nThis ID is used to match tool results to their corresponding tool uses.",
10056/// "type": "string"
10057/// },
10058/// "input": {
10059/// "description": "The arguments to pass to the tool, conforming to the tool's input schema.",
10060/// "type": "object",
10061/// "additionalProperties": {}
10062/// },
10063/// "name": {
10064/// "description": "The name of the tool to call.",
10065/// "type": "string"
10066/// },
10067/// "type": {
10068/// "type": "string",
10069/// "const": "tool_use"
10070/// }
10071/// }
10072///}
10073/// ```
10074/// </details>
10075#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10076pub struct ToolUseContent {
10077 /**A unique identifier for this tool use.
10078 This ID is used to match tool results to their corresponding tool uses.*/
10079 pub id: ::std::string::String,
10080 ///The arguments to pass to the tool, conforming to the tool's input schema.
10081 pub input: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
10082 /**Optional metadata about the tool use. Clients SHOULD preserve this field when
10083 including tool uses in subsequent sampling requests to enable caching optimizations.*/
10084 #[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
10085 pub meta: ::std::option::Option<MetaObject>,
10086 ///The name of the tool to call.
10087 pub name: ::std::string::String,
10088 #[serde(rename = "type", deserialize_with = "validate::tool_use_content_type_")]
10089 type_: ::std::string::String,
10090}
10091impl ToolUseContent {
10092 pub fn new(
10093 id: ::std::string::String,
10094 input: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
10095 name: ::std::string::String,
10096 meta: ::std::option::Option<MetaObject>,
10097 ) -> Self {
10098 Self {
10099 id,
10100 input,
10101 meta,
10102 name,
10103 type_: "tool_use".to_string(),
10104 }
10105 }
10106 pub fn type_(&self) -> &::std::string::String {
10107 &self.type_
10108 }
10109 /// returns "tool_use"
10110 pub fn type_value() -> &'static str {
10111 "tool_use"
10112 }
10113 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
10114 pub fn type_name() -> &'static str {
10115 "tool_use"
10116 }
10117}
10118/**Returned when the request's protocol version is unknown to the server or
10119unsupported (e.g., a known experimental or draft version the server has
10120chosen not to implement). For HTTP, the response status code MUST be
10121400 Bad Request.*/
10122///
10123/// <details><summary>JSON schema</summary>
10124///
10125/// ```json
10126///{
10127/// "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.",
10128/// "type": "object",
10129/// "required": [
10130/// "error",
10131/// "jsonrpc"
10132/// ],
10133/// "properties": {
10134/// "error": {
10135/// "allOf": [
10136/// {
10137/// "$ref": "#/$defs/Error"
10138/// },
10139/// {
10140/// "type": "object",
10141/// "required": [
10142/// "code",
10143/// "data"
10144/// ],
10145/// "properties": {
10146/// "code": {
10147/// "type": "integer"
10148/// },
10149/// "data": {
10150/// "type": "object",
10151/// "required": [
10152/// "requested",
10153/// "supported"
10154/// ],
10155/// "properties": {
10156/// "requested": {
10157/// "description": "The protocol version that was requested by the client.",
10158/// "type": "string"
10159/// },
10160/// "supported": {
10161/// "description": "Protocol versions the server supports. The client should choose a\nmutually supported version from this list and retry.",
10162/// "type": "array",
10163/// "items": {
10164/// "type": "string"
10165/// }
10166/// }
10167/// }
10168/// }
10169/// }
10170/// }
10171/// ]
10172/// },
10173/// "id": {
10174/// "$ref": "#/$defs/RequestId"
10175/// },
10176/// "jsonrpc": {
10177/// "type": "string",
10178/// "const": "2.0"
10179/// }
10180/// }
10181///}
10182/// ```
10183/// </details>
10184#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10185pub struct UnsupportedProtocolVersionError {
10186 pub error: UnsupportedProtocolVersionErrorError,
10187 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10188 pub id: ::std::option::Option<RequestId>,
10189 #[serde(deserialize_with = "validate::unsupported_protocol_version_error_jsonrpc")]
10190 jsonrpc: ::std::string::String,
10191}
10192impl UnsupportedProtocolVersionError {
10193 pub fn new(error: UnsupportedProtocolVersionErrorError, id: ::std::option::Option<RequestId>) -> Self {
10194 Self {
10195 error,
10196 id,
10197 jsonrpc: JSONRPC_VERSION.to_string(),
10198 }
10199 }
10200 pub fn jsonrpc(&self) -> &::std::string::String {
10201 &self.jsonrpc
10202 }
10203}
10204///UnsupportedProtocolVersionErrorError
10205///
10206/// <details><summary>JSON schema</summary>
10207///
10208/// ```json
10209///{
10210/// "allOf": [
10211/// {
10212/// "$ref": "#/$defs/Error"
10213/// },
10214/// {
10215/// "type": "object",
10216/// "required": [
10217/// "code",
10218/// "data"
10219/// ],
10220/// "properties": {
10221/// "code": {
10222/// "type": "integer"
10223/// },
10224/// "data": {
10225/// "type": "object",
10226/// "required": [
10227/// "requested",
10228/// "supported"
10229/// ],
10230/// "properties": {
10231/// "requested": {
10232/// "description": "The protocol version that was requested by the client.",
10233/// "type": "string"
10234/// },
10235/// "supported": {
10236/// "description": "Protocol versions the server supports. The client should choose a\nmutually supported version from this list and retry.",
10237/// "type": "array",
10238/// "items": {
10239/// "type": "string"
10240/// }
10241/// }
10242/// }
10243/// }
10244/// }
10245/// }
10246/// ]
10247///}
10248/// ```
10249/// </details>
10250#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10251pub struct UnsupportedProtocolVersionErrorError {
10252 pub code: i64,
10253 pub data: UnsupportedProtocolVersionErrorErrorData,
10254 ///A short description of the error. The message SHOULD be limited to a concise single sentence.
10255 pub message: ::std::string::String,
10256}
10257///UnsupportedProtocolVersionErrorErrorData
10258///
10259/// <details><summary>JSON schema</summary>
10260///
10261/// ```json
10262///{
10263/// "type": "object",
10264/// "required": [
10265/// "requested",
10266/// "supported"
10267/// ],
10268/// "properties": {
10269/// "requested": {
10270/// "description": "The protocol version that was requested by the client.",
10271/// "type": "string"
10272/// },
10273/// "supported": {
10274/// "description": "Protocol versions the server supports. The client should choose a\nmutually supported version from this list and retry.",
10275/// "type": "array",
10276/// "items": {
10277/// "type": "string"
10278/// }
10279/// }
10280/// }
10281///}
10282/// ```
10283/// </details>
10284#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10285pub struct UnsupportedProtocolVersionErrorErrorData {
10286 ///The protocol version that was requested by the client.
10287 pub requested: ::std::string::String,
10288 /**Protocol versions the server supports. The client should choose a
10289 mutually supported version from this list and retry.*/
10290 pub supported: ::std::vec::Vec<::std::string::String>,
10291}
10292///Schema for multiple-selection enumeration without display titles for options.
10293///
10294/// <details><summary>JSON schema</summary>
10295///
10296/// ```json
10297///{
10298/// "description": "Schema for multiple-selection enumeration without display titles for options.",
10299/// "type": "object",
10300/// "required": [
10301/// "items",
10302/// "type"
10303/// ],
10304/// "properties": {
10305/// "default": {
10306/// "description": "Optional default value.",
10307/// "type": "array",
10308/// "items": {
10309/// "type": "string"
10310/// }
10311/// },
10312/// "description": {
10313/// "description": "Optional description for the enum field.",
10314/// "type": "string"
10315/// },
10316/// "items": {
10317/// "description": "Schema for the array items.",
10318/// "type": "object",
10319/// "required": [
10320/// "enum",
10321/// "type"
10322/// ],
10323/// "properties": {
10324/// "enum": {
10325/// "description": "Array of enum values to choose from.",
10326/// "type": "array",
10327/// "items": {
10328/// "type": "string"
10329/// }
10330/// },
10331/// "type": {
10332/// "type": "string",
10333/// "const": "string"
10334/// }
10335/// }
10336/// },
10337/// "maxItems": {
10338/// "description": "Maximum number of items to select.",
10339/// "type": "integer"
10340/// },
10341/// "minItems": {
10342/// "description": "Minimum number of items to select.",
10343/// "type": "integer"
10344/// },
10345/// "title": {
10346/// "description": "Optional title for the enum field.",
10347/// "type": "string"
10348/// },
10349/// "type": {
10350/// "type": "string",
10351/// "const": "array"
10352/// }
10353/// }
10354///}
10355/// ```
10356/// </details>
10357#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10358pub struct UntitledMultiSelectEnumSchema {
10359 ///Optional default value.
10360 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
10361 pub default: ::std::vec::Vec<::std::string::String>,
10362 ///Optional description for the enum field.
10363 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10364 pub description: ::std::option::Option<::std::string::String>,
10365 pub items: UntitledMultiSelectEnumSchemaItems,
10366 ///Maximum number of items to select.
10367 #[serde(rename = "maxItems", default, skip_serializing_if = "::std::option::Option::is_none")]
10368 pub max_items: ::std::option::Option<i64>,
10369 ///Minimum number of items to select.
10370 #[serde(rename = "minItems", default, skip_serializing_if = "::std::option::Option::is_none")]
10371 pub min_items: ::std::option::Option<i64>,
10372 ///Optional title for the enum field.
10373 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10374 pub title: ::std::option::Option<::std::string::String>,
10375 #[serde(rename = "type", deserialize_with = "validate::untitled_multi_select_enum_schema_type_")]
10376 type_: ::std::string::String,
10377}
10378impl UntitledMultiSelectEnumSchema {
10379 pub fn new(
10380 default: ::std::vec::Vec<::std::string::String>,
10381 items: UntitledMultiSelectEnumSchemaItems,
10382 description: ::std::option::Option<::std::string::String>,
10383 max_items: ::std::option::Option<i64>,
10384 min_items: ::std::option::Option<i64>,
10385 title: ::std::option::Option<::std::string::String>,
10386 ) -> Self {
10387 Self {
10388 default,
10389 description,
10390 items,
10391 max_items,
10392 min_items,
10393 title,
10394 type_: "array".to_string(),
10395 }
10396 }
10397 pub fn type_(&self) -> &::std::string::String {
10398 &self.type_
10399 }
10400 /// returns "array"
10401 pub fn type_value() -> &'static str {
10402 "array"
10403 }
10404 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
10405 pub fn type_name() -> &'static str {
10406 "array"
10407 }
10408}
10409///Schema for the array items.
10410///
10411/// <details><summary>JSON schema</summary>
10412///
10413/// ```json
10414///{
10415/// "description": "Schema for the array items.",
10416/// "type": "object",
10417/// "required": [
10418/// "enum",
10419/// "type"
10420/// ],
10421/// "properties": {
10422/// "enum": {
10423/// "description": "Array of enum values to choose from.",
10424/// "type": "array",
10425/// "items": {
10426/// "type": "string"
10427/// }
10428/// },
10429/// "type": {
10430/// "type": "string",
10431/// "const": "string"
10432/// }
10433/// }
10434///}
10435/// ```
10436/// </details>
10437#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10438pub struct UntitledMultiSelectEnumSchemaItems {
10439 ///Array of enum values to choose from.
10440 #[serde(rename = "enum")]
10441 pub enum_: ::std::vec::Vec<::std::string::String>,
10442 #[serde(
10443 rename = "type",
10444 deserialize_with = "validate::untitled_multi_select_enum_schema_items_type_"
10445 )]
10446 type_: ::std::string::String,
10447}
10448impl UntitledMultiSelectEnumSchemaItems {
10449 pub fn new(enum_: ::std::vec::Vec<::std::string::String>) -> Self {
10450 Self {
10451 enum_,
10452 type_: "string".to_string(),
10453 }
10454 }
10455 pub fn type_(&self) -> &::std::string::String {
10456 &self.type_
10457 }
10458 /// returns "string"
10459 pub fn type_value() -> &'static str {
10460 "string"
10461 }
10462 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
10463 pub fn type_name() -> &'static str {
10464 "string"
10465 }
10466}
10467///Schema for single-selection enumeration without display titles for options.
10468///
10469/// <details><summary>JSON schema</summary>
10470///
10471/// ```json
10472///{
10473/// "description": "Schema for single-selection enumeration without display titles for options.",
10474/// "type": "object",
10475/// "required": [
10476/// "enum",
10477/// "type"
10478/// ],
10479/// "properties": {
10480/// "default": {
10481/// "description": "Optional default value.",
10482/// "type": "string"
10483/// },
10484/// "description": {
10485/// "description": "Optional description for the enum field.",
10486/// "type": "string"
10487/// },
10488/// "enum": {
10489/// "description": "Array of enum values to choose from.",
10490/// "type": "array",
10491/// "items": {
10492/// "type": "string"
10493/// }
10494/// },
10495/// "title": {
10496/// "description": "Optional title for the enum field.",
10497/// "type": "string"
10498/// },
10499/// "type": {
10500/// "type": "string",
10501/// "const": "string"
10502/// }
10503/// }
10504///}
10505/// ```
10506/// </details>
10507#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
10508pub struct UntitledSingleSelectEnumSchema {
10509 ///Optional default value.
10510 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10511 pub default: ::std::option::Option<::std::string::String>,
10512 ///Optional description for the enum field.
10513 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10514 pub description: ::std::option::Option<::std::string::String>,
10515 ///Array of enum values to choose from.
10516 #[serde(rename = "enum")]
10517 pub enum_: ::std::vec::Vec<::std::string::String>,
10518 ///Optional title for the enum field.
10519 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
10520 pub title: ::std::option::Option<::std::string::String>,
10521 #[serde(rename = "type", deserialize_with = "validate::untitled_single_select_enum_schema_type_")]
10522 type_: ::std::string::String,
10523}
10524impl UntitledSingleSelectEnumSchema {
10525 pub fn new(
10526 enum_: ::std::vec::Vec<::std::string::String>,
10527 default: ::std::option::Option<::std::string::String>,
10528 description: ::std::option::Option<::std::string::String>,
10529 title: ::std::option::Option<::std::string::String>,
10530 ) -> Self {
10531 Self {
10532 default,
10533 description,
10534 enum_,
10535 title,
10536 type_: "string".to_string(),
10537 }
10538 }
10539 pub fn type_(&self) -> &::std::string::String {
10540 &self.type_
10541 }
10542 /// returns "string"
10543 pub fn type_value() -> &'static str {
10544 "string"
10545 }
10546 #[deprecated(since = "0.8.0", note = "Use `type_value()` instead.")]
10547 pub fn type_name() -> &'static str {
10548 "string"
10549 }
10550}
10551impl<'de> serde::Deserialize<'de> for ClientRequest {
10552 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10553 where
10554 D: serde::Deserializer<'de>,
10555 {
10556 let value: serde_json::Value = serde::Deserialize::deserialize(deserializer)?;
10557 let method_option = value.get("method").and_then(|v| v.as_str());
10558 if let Some(method) = method_option {
10559 match method {
10560 "server/discover" => {
10561 let req = serde_json::from_value::<DiscoverRequest>(value).map_err(serde::de::Error::custom)?;
10562 Ok(ClientRequest::DiscoverRequest(req))
10563 }
10564 "resources/list" => {
10565 let req = serde_json::from_value::<ListResourcesRequest>(value).map_err(serde::de::Error::custom)?;
10566 Ok(ClientRequest::ListResourcesRequest(req))
10567 }
10568 "resources/templates/list" => {
10569 let req =
10570 serde_json::from_value::<ListResourceTemplatesRequest>(value).map_err(serde::de::Error::custom)?;
10571 Ok(ClientRequest::ListResourceTemplatesRequest(req))
10572 }
10573 "resources/read" => {
10574 let req = serde_json::from_value::<ReadResourceRequest>(value).map_err(serde::de::Error::custom)?;
10575 Ok(ClientRequest::ReadResourceRequest(req))
10576 }
10577 "subscriptions/listen" => {
10578 let req =
10579 serde_json::from_value::<SubscriptionsListenRequest>(value).map_err(serde::de::Error::custom)?;
10580 Ok(ClientRequest::SubscriptionsListenRequest(req))
10581 }
10582 "prompts/list" => {
10583 let req = serde_json::from_value::<ListPromptsRequest>(value).map_err(serde::de::Error::custom)?;
10584 Ok(ClientRequest::ListPromptsRequest(req))
10585 }
10586 "prompts/get" => {
10587 let req = serde_json::from_value::<GetPromptRequest>(value).map_err(serde::de::Error::custom)?;
10588 Ok(ClientRequest::GetPromptRequest(req))
10589 }
10590 "tools/list" => {
10591 let req = serde_json::from_value::<ListToolsRequest>(value).map_err(serde::de::Error::custom)?;
10592 Ok(ClientRequest::ListToolsRequest(req))
10593 }
10594 "tools/call" => {
10595 let req = serde_json::from_value::<CallToolRequest>(value).map_err(serde::de::Error::custom)?;
10596 Ok(ClientRequest::CallToolRequest(req))
10597 }
10598 "completion/complete" => {
10599 let req = serde_json::from_value::<CompleteRequest>(value).map_err(serde::de::Error::custom)?;
10600 Ok(ClientRequest::CompleteRequest(req))
10601 }
10602 _ => Err(serde::de::Error::unknown_variant("method", &[""])),
10603 }
10604 } else {
10605 Err(serde::de::Error::missing_field("method"))
10606 }
10607 }
10608}
10609impl ClientRequest {
10610 pub fn method(&self) -> &str {
10611 match self {
10612 ClientRequest::DiscoverRequest(request) => request.method(),
10613 ClientRequest::ListResourcesRequest(request) => request.method(),
10614 ClientRequest::ListResourceTemplatesRequest(request) => request.method(),
10615 ClientRequest::ReadResourceRequest(request) => request.method(),
10616 ClientRequest::SubscriptionsListenRequest(request) => request.method(),
10617 ClientRequest::ListPromptsRequest(request) => request.method(),
10618 ClientRequest::GetPromptRequest(request) => request.method(),
10619 ClientRequest::ListToolsRequest(request) => request.method(),
10620 ClientRequest::CallToolRequest(request) => request.method(),
10621 ClientRequest::CompleteRequest(request) => request.method(),
10622 }
10623 }
10624}
10625impl<'de> serde::Deserialize<'de> for ServerNotification {
10626 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10627 where
10628 D: serde::Deserializer<'de>,
10629 {
10630 let value: serde_json::Value = serde::Deserialize::deserialize(deserializer)?;
10631 let method_option = value.get("method").and_then(|v| v.as_str());
10632 if let Some(method) = method_option {
10633 match method {
10634 "notifications/cancelled" => {
10635 let req = serde_json::from_value::<CancelledNotification>(value).map_err(serde::de::Error::custom)?;
10636 Ok(ServerNotification::CancelledNotification(req))
10637 }
10638 "notifications/progress" => {
10639 let req = serde_json::from_value::<ProgressNotification>(value).map_err(serde::de::Error::custom)?;
10640 Ok(ServerNotification::ProgressNotification(req))
10641 }
10642 "notifications/resources/list_changed" => {
10643 let req = serde_json::from_value::<ResourceListChangedNotification>(value)
10644 .map_err(serde::de::Error::custom)?;
10645 Ok(ServerNotification::ResourceListChangedNotification(req))
10646 }
10647 "notifications/subscriptions/acknowledged" => {
10648 let req = serde_json::from_value::<SubscriptionsAcknowledgedNotification>(value)
10649 .map_err(serde::de::Error::custom)?;
10650 Ok(ServerNotification::SubscriptionsAcknowledgedNotification(req))
10651 }
10652 "notifications/resources/updated" => {
10653 let req =
10654 serde_json::from_value::<ResourceUpdatedNotification>(value).map_err(serde::de::Error::custom)?;
10655 Ok(ServerNotification::ResourceUpdatedNotification(req))
10656 }
10657 "notifications/prompts/list_changed" => {
10658 let req =
10659 serde_json::from_value::<PromptListChangedNotification>(value).map_err(serde::de::Error::custom)?;
10660 Ok(ServerNotification::PromptListChangedNotification(req))
10661 }
10662 "notifications/tools/list_changed" => {
10663 let req =
10664 serde_json::from_value::<ToolListChangedNotification>(value).map_err(serde::de::Error::custom)?;
10665 Ok(ServerNotification::ToolListChangedNotification(req))
10666 }
10667 "notifications/message" => {
10668 let req =
10669 serde_json::from_value::<LoggingMessageNotification>(value).map_err(serde::de::Error::custom)?;
10670 Ok(ServerNotification::LoggingMessageNotification(req))
10671 }
10672 _ => Err(serde::de::Error::unknown_variant("method", &[""])),
10673 }
10674 } else {
10675 Err(serde::de::Error::missing_field("method"))
10676 }
10677 }
10678}
10679impl ServerNotification {
10680 pub fn method(&self) -> &str {
10681 match self {
10682 ServerNotification::CancelledNotification(request) => request.method(),
10683 ServerNotification::ProgressNotification(request) => request.method(),
10684 ServerNotification::ResourceListChangedNotification(request) => request.method(),
10685 ServerNotification::SubscriptionsAcknowledgedNotification(request) => request.method(),
10686 ServerNotification::ResourceUpdatedNotification(request) => request.method(),
10687 ServerNotification::PromptListChangedNotification(request) => request.method(),
10688 ServerNotification::ToolListChangedNotification(request) => request.method(),
10689 ServerNotification::LoggingMessageNotification(request) => request.method(),
10690 }
10691 }
10692}
10693impl<'de> serde::Deserialize<'de> for ServerResult {
10694 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
10695 where
10696 D: serde::Deserializer<'de>,
10697 {
10698 let value: serde_json::Value = serde::Deserialize::deserialize(deserializer)?;
10699 let result_type = value.get("resultType").and_then(|v| v.as_str());
10700 if result_type == Some("input_required") {
10701 return serde_json::from_value::<InputRequiredResult>(value)
10702 .map(ServerResult::InputRequiredResult)
10703 .map_err(serde::de::Error::custom);
10704 }
10705 let value = match result_type {
10706 Some(_) => value,
10707 None => match value {
10708 serde_json::Value::Object(mut map) => {
10709 map.insert("resultType".to_string(), serde_json::Value::String("complete".to_string()));
10710 serde_json::Value::Object(map)
10711 }
10712 v => v,
10713 },
10714 };
10715 if let ::std::result::Result::Ok(v) = serde_json::from_value::<DiscoverResult>(value.clone()) {
10716 return ::std::result::Result::Ok(ServerResult::DiscoverResult(v));
10717 }
10718 if let ::std::result::Result::Ok(v) = serde_json::from_value::<ListResourcesResult>(value.clone()) {
10719 return ::std::result::Result::Ok(ServerResult::ListResourcesResult(v));
10720 }
10721 if let ::std::result::Result::Ok(v) = serde_json::from_value::<ListResourceTemplatesResult>(value.clone()) {
10722 return ::std::result::Result::Ok(ServerResult::ListResourceTemplatesResult(v));
10723 }
10724 if let ::std::result::Result::Ok(v) = serde_json::from_value::<ReadResourceResult>(value.clone()) {
10725 return ::std::result::Result::Ok(ServerResult::ReadResourceResult(v));
10726 }
10727 if let ::std::result::Result::Ok(v) = serde_json::from_value::<SubscriptionsListenResult>(value.clone()) {
10728 return ::std::result::Result::Ok(ServerResult::SubscriptionsListenResult(v));
10729 }
10730 if let ::std::result::Result::Ok(v) = serde_json::from_value::<ListPromptsResult>(value.clone()) {
10731 return ::std::result::Result::Ok(ServerResult::ListPromptsResult(v));
10732 }
10733 if let ::std::result::Result::Ok(v) = serde_json::from_value::<GetPromptResult>(value.clone()) {
10734 return ::std::result::Result::Ok(ServerResult::GetPromptResult(v));
10735 }
10736 if let ::std::result::Result::Ok(v) = serde_json::from_value::<ListToolsResult>(value.clone()) {
10737 return ::std::result::Result::Ok(ServerResult::ListToolsResult(v));
10738 }
10739 if let ::std::result::Result::Ok(v) = serde_json::from_value::<CallToolResult>(value.clone()) {
10740 return ::std::result::Result::Ok(ServerResult::CallToolResult(v));
10741 }
10742 if let ::std::result::Result::Ok(v) = serde_json::from_value::<CompleteResult>(value.clone()) {
10743 return ::std::result::Result::Ok(ServerResult::CompleteResult(v));
10744 }
10745 serde_json::from_value::<Result>(value)
10746 .map(ServerResult::Result)
10747 .map_err(serde::de::Error::custom)
10748 }
10749}
10750fn into_result<T>(value: T) -> GenericResult
10751where
10752 T: serde::Serialize,
10753{
10754 let json_value = serde_json::to_value(value).unwrap_or(serde_json::Value::Null);
10755 if let serde_json::Value::Object(mut map) = json_value {
10756 let meta = map.remove("_meta").and_then(|v| match v {
10757 serde_json::Value::Object(obj) => serde_json::from_value(serde_json::Value::Object(obj)).ok(),
10758 _ => None,
10759 });
10760 let result_type = map
10761 .remove("resultType")
10762 .and_then(|v| v.as_str().map(|s| s.to_string()))
10763 .unwrap_or_else(|| "complete".to_string());
10764 let extra = if map.is_empty() { None } else { Some(map) };
10765 GenericResult {
10766 meta,
10767 result_type,
10768 extra,
10769 }
10770 } else {
10771 GenericResult {
10772 meta: None,
10773 result_type: "complete".to_string(),
10774 extra: None,
10775 }
10776 }
10777}
10778impl From<InputRequiredResult> for GenericResult {
10779 fn from(value: InputRequiredResult) -> Self {
10780 into_result(value)
10781 }
10782}
10783impl From<DiscoverResult> for GenericResult {
10784 fn from(value: DiscoverResult) -> Self {
10785 into_result(value)
10786 }
10787}
10788impl From<ListResourcesResult> for GenericResult {
10789 fn from(value: ListResourcesResult) -> Self {
10790 into_result(value)
10791 }
10792}
10793impl From<ListResourceTemplatesResult> for GenericResult {
10794 fn from(value: ListResourceTemplatesResult) -> Self {
10795 into_result(value)
10796 }
10797}
10798impl From<ReadResourceResult> for GenericResult {
10799 fn from(value: ReadResourceResult) -> Self {
10800 into_result(value)
10801 }
10802}
10803impl From<SubscriptionsListenResult> for GenericResult {
10804 fn from(value: SubscriptionsListenResult) -> Self {
10805 into_result(value)
10806 }
10807}
10808impl From<ListPromptsResult> for GenericResult {
10809 fn from(value: ListPromptsResult) -> Self {
10810 into_result(value)
10811 }
10812}
10813impl From<GetPromptResult> for GenericResult {
10814 fn from(value: GetPromptResult) -> Self {
10815 into_result(value)
10816 }
10817}
10818impl From<ListToolsResult> for GenericResult {
10819 fn from(value: ListToolsResult) -> Self {
10820 into_result(value)
10821 }
10822}
10823impl From<CallToolResult> for GenericResult {
10824 fn from(value: CallToolResult) -> Self {
10825 into_result(value)
10826 }
10827}
10828impl From<CompleteResult> for GenericResult {
10829 fn from(value: CompleteResult) -> Self {
10830 into_result(value)
10831 }
10832}
10833impl ClientRequest {
10834 pub fn request_id(&self) -> &RequestId {
10835 match self {
10836 ClientRequest::DiscoverRequest(request) => &request.id,
10837 ClientRequest::ListResourcesRequest(request) => &request.id,
10838 ClientRequest::ListResourceTemplatesRequest(request) => &request.id,
10839 ClientRequest::ReadResourceRequest(request) => &request.id,
10840 ClientRequest::SubscriptionsListenRequest(request) => &request.id,
10841 ClientRequest::ListPromptsRequest(request) => &request.id,
10842 ClientRequest::GetPromptRequest(request) => &request.id,
10843 ClientRequest::ListToolsRequest(request) => &request.id,
10844 ClientRequest::CallToolRequest(request) => &request.id,
10845 ClientRequest::CompleteRequest(request) => &request.id,
10846 }
10847 }
10848}
10849impl Default for ProgressToken {
10850 fn default() -> Self {
10851 ProgressToken::Integer(0)
10852 }
10853}
10854impl Default for RequestId {
10855 fn default() -> Self {
10856 RequestId::Integer(0)
10857 }
10858}
10859/// Alias to avoid conflicts with Rust's standard `Result` type.
10860pub type GenericResult = Result;
10861#[deprecated(since = "0.8.0", note = "Use `IncludeContext` instead.")]
10862pub type CreateMessageRequestParamsIncludeContext = IncludeContext;
10863#[deprecated(since = "0.8.0", note = "Use `CompleteRequestContext` instead.")]
10864pub type CompleteRequestParamsContext = CompleteRequestContext;
10865#[deprecated(since = "0.8.0", note = "Use `CompleteRequestArgument` instead.")]
10866pub type CompleteRequestParamsArgument = CompleteRequestArgument;
10867#[deprecated(since = "0.8.0", note = "Use `CompleteRequestRef` instead.")]
10868pub type CompleteRequestParamsRef = CompleteRequestRef;
10869#[deprecated(since = "0.8.0", note = "Use `CreateMessageContent` instead.")]
10870pub type CreateMessageResultContent = CreateMessageContent;
10871#[deprecated(since = "0.8.0", note = "Use `ElicitResultContent` instead.")]
10872pub type ElicitResultContentValue = ElicitResultContent;
10873#[deprecated(since = "0.8.0", note = "Use `ReadResourceContent` instead.")]
10874pub type ReadResourceResultContentsItem = ReadResourceContent;