|
1 | 1 | /// ---------------------------------------------------------------------------- |
2 | | -/// This file is auto-generated by mcp-schema-gen v0.4.2. |
| 2 | +/// This file is auto-generated by mcp-schema-gen v0.4.4. |
3 | 3 | /// WARNING: |
4 | 4 | /// It is not recommended to modify this file directly. You are free to |
5 | 5 | /// modify or extend the implementations as needed, but please do so at your own risk. |
6 | 6 | /// |
7 | 7 | /// Generated from : <https://github.com/modelcontextprotocol/specification.git> |
8 | | -/// Hash : 3473e6e72b222f44163b41eab8d4b0973ac106b6 |
9 | | -/// Generated at : 2025-09-17 19:15:48 |
| 8 | +/// Hash : 71204c22f8e062795dca00a87d31070033572ba2 |
| 9 | +/// Generated at : 2025-10-03 15:17:01 |
10 | 10 | /// ---------------------------------------------------------------------------- |
11 | 11 | /// |
| 12 | +use super::validators as validate; |
12 | 13 | /// MCP Protocol Version |
13 | 14 | pub const LATEST_PROTOCOL_VERSION: &str = "2024-11-05"; |
14 | 15 | /// JSON-RPC Version |
@@ -171,6 +172,7 @@ pub struct BlobResourceContents { |
171 | 172 | /// </details> |
172 | 173 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
173 | 174 | pub struct CallToolRequest { |
| 175 | + #[serde(deserialize_with = "validate::call_tool_request_method")] |
174 | 176 | method: ::std::string::String, |
175 | 177 | pub params: CallToolRequestParams, |
176 | 178 | } |
@@ -359,6 +361,7 @@ A client MUST NOT attempt to cancel its initialize request.*/ |
359 | 361 | /// </details> |
360 | 362 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
361 | 363 | pub struct CancelledNotification { |
| 364 | + #[serde(deserialize_with = "validate::cancelled_notification_method")] |
362 | 365 | method: ::std::string::String, |
363 | 366 | pub params: CancelledNotificationParams, |
364 | 367 | } |
@@ -766,6 +769,7 @@ impl ::std::convert::From<Result> for ClientResult { |
766 | 769 | /// </details> |
767 | 770 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
768 | 771 | pub struct CompleteRequest { |
| 772 | + #[serde(deserialize_with = "validate::complete_request_method")] |
769 | 773 | method: ::std::string::String, |
770 | 774 | pub params: CompleteRequestParams, |
771 | 775 | } |
@@ -1063,6 +1067,7 @@ pub struct CompleteResultCompletion { |
1063 | 1067 | /// </details> |
1064 | 1068 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
1065 | 1069 | pub struct CreateMessageRequest { |
| 1070 | + #[serde(deserialize_with = "validate::create_message_request_method")] |
1066 | 1071 | method: ::std::string::String, |
1067 | 1072 | pub params: CreateMessageRequestParams, |
1068 | 1073 | } |
@@ -1358,7 +1363,7 @@ pub struct EmbeddedResource { |
1358 | 1363 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
1359 | 1364 | pub annotations: ::std::option::Option<EmbeddedResourceAnnotations>, |
1360 | 1365 | pub resource: EmbeddedResourceResource, |
1361 | | - #[serde(rename = "type")] |
| 1366 | + #[serde(rename = "type", deserialize_with = "validate::embedded_resource_type_")] |
1362 | 1367 | type_: ::std::string::String, |
1363 | 1368 | } |
1364 | 1369 | impl EmbeddedResource { |
@@ -1498,6 +1503,7 @@ pub struct EmptyResult(pub Result); |
1498 | 1503 | /// </details> |
1499 | 1504 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
1500 | 1505 | pub struct GetPromptRequest { |
| 1506 | + #[serde(deserialize_with = "validate::get_prompt_request_method")] |
1501 | 1507 | method: ::std::string::String, |
1502 | 1508 | pub params: GetPromptRequestParams, |
1503 | 1509 | } |
@@ -1648,7 +1654,7 @@ pub struct ImageContent { |
1648 | 1654 | ///The MIME type of the image. Different providers may support different image types. |
1649 | 1655 | #[serde(rename = "mimeType")] |
1650 | 1656 | pub mime_type: ::std::string::String, |
1651 | | - #[serde(rename = "type")] |
| 1657 | + #[serde(rename = "type", deserialize_with = "validate::image_content_type_")] |
1652 | 1658 | type_: ::std::string::String, |
1653 | 1659 | } |
1654 | 1660 | impl ImageContent { |
@@ -1776,6 +1782,7 @@ pub struct Implementation { |
1776 | 1782 | /// </details> |
1777 | 1783 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
1778 | 1784 | pub struct InitializeRequest { |
| 1785 | + #[serde(deserialize_with = "validate::initialize_request_method")] |
1779 | 1786 | method: ::std::string::String, |
1780 | 1787 | pub params: InitializeRequestParams, |
1781 | 1788 | } |
@@ -1915,6 +1922,7 @@ pub struct InitializeResult { |
1915 | 1922 | /// </details> |
1916 | 1923 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
1917 | 1924 | pub struct InitializedNotification { |
| 1925 | + #[serde(deserialize_with = "validate::initialized_notification_method")] |
1918 | 1926 | method: ::std::string::String, |
1919 | 1927 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
1920 | 1928 | pub params: ::std::option::Option<InitializedNotificationParams>, |
@@ -2008,6 +2016,7 @@ pub struct InitializedNotificationParams { |
2008 | 2016 | pub struct JsonrpcError { |
2009 | 2017 | pub error: RpcError, |
2010 | 2018 | pub id: RequestId, |
| 2019 | + #[serde(deserialize_with = "validate::jsonrpc_error_jsonrpc")] |
2011 | 2020 | jsonrpc: ::std::string::String, |
2012 | 2021 | } |
2013 | 2022 | impl JsonrpcError { |
@@ -2110,6 +2119,7 @@ impl ::std::convert::From<JsonrpcError> for JsonrpcMessage { |
2110 | 2119 | /// </details> |
2111 | 2120 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
2112 | 2121 | pub struct JsonrpcNotification { |
| 2122 | + #[serde(deserialize_with = "validate::jsonrpc_notification_jsonrpc")] |
2113 | 2123 | jsonrpc: ::std::string::String, |
2114 | 2124 | pub method: ::std::string::String, |
2115 | 2125 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
@@ -2199,6 +2209,7 @@ pub struct JsonrpcNotificationParams { |
2199 | 2209 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
2200 | 2210 | pub struct JsonrpcRequest { |
2201 | 2211 | pub id: RequestId, |
| 2212 | + #[serde(deserialize_with = "validate::jsonrpc_request_jsonrpc")] |
2202 | 2213 | jsonrpc: ::std::string::String, |
2203 | 2214 | pub method: ::std::string::String, |
2204 | 2215 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
@@ -2299,6 +2310,7 @@ pub struct JsonrpcRequestParamsMeta { |
2299 | 2310 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
2300 | 2311 | pub struct JsonrpcResponse { |
2301 | 2312 | pub id: RequestId, |
| 2313 | + #[serde(deserialize_with = "validate::jsonrpc_response_jsonrpc")] |
2302 | 2314 | jsonrpc: ::std::string::String, |
2303 | 2315 | pub result: Result, |
2304 | 2316 | } |
@@ -2345,6 +2357,7 @@ impl JsonrpcResponse { |
2345 | 2357 | /// </details> |
2346 | 2358 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
2347 | 2359 | pub struct ListPromptsRequest { |
| 2360 | + #[serde(deserialize_with = "validate::list_prompts_request_method")] |
2348 | 2361 | method: ::std::string::String, |
2349 | 2362 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
2350 | 2363 | pub params: ::std::option::Option<ListPromptsRequestParams>, |
@@ -2459,6 +2472,7 @@ pub struct ListPromptsResult { |
2459 | 2472 | /// </details> |
2460 | 2473 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
2461 | 2474 | pub struct ListResourceTemplatesRequest { |
| 2475 | + #[serde(deserialize_with = "validate::list_resource_templates_request_method")] |
2462 | 2476 | method: ::std::string::String, |
2463 | 2477 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
2464 | 2478 | pub params: ::std::option::Option<ListResourceTemplatesRequestParams>, |
@@ -2574,6 +2588,7 @@ pub struct ListResourceTemplatesResult { |
2574 | 2588 | /// </details> |
2575 | 2589 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
2576 | 2590 | pub struct ListResourcesRequest { |
| 2591 | + #[serde(deserialize_with = "validate::list_resources_request_method")] |
2577 | 2592 | method: ::std::string::String, |
2578 | 2593 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
2579 | 2594 | pub params: ::std::option::Option<ListResourcesRequestParams>, |
@@ -2699,6 +2714,7 @@ structure or access specific locations that the client has permission to read fr |
2699 | 2714 | /// </details> |
2700 | 2715 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
2701 | 2716 | pub struct ListRootsRequest { |
| 2717 | + #[serde(deserialize_with = "validate::list_roots_request_method")] |
2702 | 2718 | method: ::std::string::String, |
2703 | 2719 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
2704 | 2720 | pub params: ::std::option::Option<ListRootsRequestParams>, |
@@ -2835,6 +2851,7 @@ pub struct ListRootsResult { |
2835 | 2851 | /// </details> |
2836 | 2852 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
2837 | 2853 | pub struct ListToolsRequest { |
| 2854 | + #[serde(deserialize_with = "validate::list_tools_request_method")] |
2838 | 2855 | method: ::std::string::String, |
2839 | 2856 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
2840 | 2857 | pub params: ::std::option::Option<ListToolsRequestParams>, |
@@ -3017,6 +3034,7 @@ impl ::std::fmt::Display for LoggingLevel { |
3017 | 3034 | /// </details> |
3018 | 3035 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
3019 | 3036 | pub struct LoggingMessageNotification { |
| 3037 | + #[serde(deserialize_with = "validate::logging_message_notification_method")] |
3020 | 3038 | method: ::std::string::String, |
3021 | 3039 | pub params: LoggingMessageNotificationParams, |
3022 | 3040 | } |
@@ -3353,6 +3371,7 @@ pub struct PaginatedResult { |
3353 | 3371 | /// </details> |
3354 | 3372 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
3355 | 3373 | pub struct PingRequest { |
| 3374 | + #[serde(deserialize_with = "validate::ping_request_method")] |
3356 | 3375 | method: ::std::string::String, |
3357 | 3376 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
3358 | 3377 | pub params: ::std::option::Option<PingRequestParams>, |
@@ -3466,6 +3485,7 @@ pub struct PingRequestParamsMeta { |
3466 | 3485 | /// </details> |
3467 | 3486 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
3468 | 3487 | pub struct ProgressNotification { |
| 3488 | + #[serde(deserialize_with = "validate::progress_notification_method")] |
3469 | 3489 | method: ::std::string::String, |
3470 | 3490 | pub params: ProgressNotificationParams, |
3471 | 3491 | } |
@@ -3659,6 +3679,7 @@ pub struct PromptArgument { |
3659 | 3679 | /// </details> |
3660 | 3680 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
3661 | 3681 | pub struct PromptListChangedNotification { |
| 3682 | + #[serde(deserialize_with = "validate::prompt_list_changed_notification_method")] |
3662 | 3683 | method: ::std::string::String, |
3663 | 3684 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
3664 | 3685 | pub params: ::std::option::Option<PromptListChangedNotificationParams>, |
@@ -3814,7 +3835,7 @@ impl ::std::convert::From<EmbeddedResource> for PromptMessageContent { |
3814 | 3835 | pub struct PromptReference { |
3815 | 3836 | ///The name of the prompt or prompt template |
3816 | 3837 | pub name: ::std::string::String, |
3817 | | - #[serde(rename = "type")] |
| 3838 | + #[serde(rename = "type", deserialize_with = "validate::prompt_reference_type_")] |
3818 | 3839 | type_: ::std::string::String, |
3819 | 3840 | } |
3820 | 3841 | impl PromptReference { |
@@ -3867,6 +3888,7 @@ impl PromptReference { |
3867 | 3888 | /// </details> |
3868 | 3889 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
3869 | 3890 | pub struct ReadResourceRequest { |
| 3891 | + #[serde(deserialize_with = "validate::read_resource_request_method")] |
3870 | 3892 | method: ::std::string::String, |
3871 | 3893 | pub params: ReadResourceRequestParams, |
3872 | 3894 | } |
@@ -4275,6 +4297,7 @@ pub struct ResourceContents { |
4275 | 4297 | /// </details> |
4276 | 4298 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
4277 | 4299 | pub struct ResourceListChangedNotification { |
| 4300 | + #[serde(deserialize_with = "validate::resource_list_changed_notification_method")] |
4278 | 4301 | method: ::std::string::String, |
4279 | 4302 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
4280 | 4303 | pub params: ::std::option::Option<ResourceListChangedNotificationParams>, |
@@ -4347,7 +4370,7 @@ pub struct ResourceListChangedNotificationParams { |
4347 | 4370 | /// </details> |
4348 | 4371 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
4349 | 4372 | pub struct ResourceReference { |
4350 | | - #[serde(rename = "type")] |
| 4373 | + #[serde(rename = "type", deserialize_with = "validate::resource_reference_type_")] |
4351 | 4374 | type_: ::std::string::String, |
4352 | 4375 | ///The URI or URI template of the resource. |
4353 | 4376 | pub uri: ::std::string::String, |
@@ -4506,6 +4529,7 @@ pub struct ResourceTemplateAnnotations { |
4506 | 4529 | /// </details> |
4507 | 4530 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
4508 | 4531 | pub struct ResourceUpdatedNotification { |
| 4532 | + #[serde(deserialize_with = "validate::resource_updated_notification_method")] |
4509 | 4533 | method: ::std::string::String, |
4510 | 4534 | pub params: ResourceUpdatedNotificationParams, |
4511 | 4535 | } |
@@ -4676,6 +4700,7 @@ The server should then request an updated list of roots using the ListRootsReque |
4676 | 4700 | /// </details> |
4677 | 4701 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
4678 | 4702 | pub struct RootsListChangedNotification { |
| 4703 | + #[serde(deserialize_with = "validate::roots_list_changed_notification_method")] |
4679 | 4704 | method: ::std::string::String, |
4680 | 4705 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
4681 | 4706 | pub params: ::std::option::Option<RootsListChangedNotificationParams>, |
@@ -5078,6 +5103,7 @@ impl ::std::convert::From<LoggingMessageNotification> for ServerNotification { |
5078 | 5103 | /// </details> |
5079 | 5104 | #[derive(::serde::Serialize, Clone, Debug)] |
5080 | 5105 | #[serde(untagged)] |
| 5106 | +#[allow(clippy::large_enum_variant)] |
5081 | 5107 | pub enum ServerRequest { |
5082 | 5108 | PingRequest(PingRequest), |
5083 | 5109 | CreateMessageRequest(CreateMessageRequest), |
@@ -5141,6 +5167,7 @@ impl ::std::convert::From<ListRootsRequest> for ServerRequest { |
5141 | 5167 | /// </details> |
5142 | 5168 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
5143 | 5169 | #[serde(untagged)] |
| 5170 | +#[allow(clippy::large_enum_variant)] |
5144 | 5171 | pub enum ServerResult { |
5145 | 5172 | InitializeResult(InitializeResult), |
5146 | 5173 | ListResourcesResult(ListResourcesResult), |
@@ -5238,6 +5265,7 @@ impl ::std::convert::From<Result> for ServerResult { |
5238 | 5265 | /// </details> |
5239 | 5266 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
5240 | 5267 | pub struct SetLevelRequest { |
| 5268 | + #[serde(deserialize_with = "validate::set_level_request_method")] |
5241 | 5269 | method: ::std::string::String, |
5242 | 5270 | pub params: SetLevelRequestParams, |
5243 | 5271 | } |
@@ -5315,6 +5343,7 @@ pub struct SetLevelRequestParams { |
5315 | 5343 | /// </details> |
5316 | 5344 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
5317 | 5345 | pub struct SubscribeRequest { |
| 5346 | + #[serde(deserialize_with = "validate::subscribe_request_method")] |
5318 | 5347 | method: ::std::string::String, |
5319 | 5348 | pub params: SubscribeRequestParams, |
5320 | 5349 | } |
@@ -5406,7 +5435,7 @@ pub struct TextContent { |
5406 | 5435 | pub annotations: ::std::option::Option<TextContentAnnotations>, |
5407 | 5436 | ///The text content of the message. |
5408 | 5437 | pub text: ::std::string::String, |
5409 | | - #[serde(rename = "type")] |
| 5438 | + #[serde(rename = "type", deserialize_with = "validate::text_content_type_")] |
5410 | 5439 | type_: ::std::string::String, |
5411 | 5440 | } |
5412 | 5441 | impl TextContent { |
@@ -5599,7 +5628,7 @@ pub struct ToolInputSchema { |
5599 | 5628 | >, |
5600 | 5629 | #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] |
5601 | 5630 | pub required: ::std::vec::Vec<::std::string::String>, |
5602 | | - #[serde(rename = "type")] |
| 5631 | + #[serde(rename = "type", deserialize_with = "validate::tool_input_schema_type_")] |
5603 | 5632 | type_: ::std::string::String, |
5604 | 5633 | } |
5605 | 5634 | impl ToolInputSchema { |
@@ -5658,6 +5687,7 @@ impl ToolInputSchema { |
5658 | 5687 | /// </details> |
5659 | 5688 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
5660 | 5689 | pub struct ToolListChangedNotification { |
| 5690 | + #[serde(deserialize_with = "validate::tool_list_changed_notification_method")] |
5661 | 5691 | method: ::std::string::String, |
5662 | 5692 | #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] |
5663 | 5693 | pub params: ::std::option::Option<ToolListChangedNotificationParams>, |
@@ -5738,6 +5768,7 @@ pub struct ToolListChangedNotificationParams { |
5738 | 5768 | /// </details> |
5739 | 5769 | #[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)] |
5740 | 5770 | pub struct UnsubscribeRequest { |
| 5771 | + #[serde(deserialize_with = "validate::unsubscribe_request_method")] |
5741 | 5772 | method: ::std::string::String, |
5742 | 5773 | pub params: UnsubscribeRequestParams, |
5743 | 5774 | } |
|
0 commit comments