Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@

### Bug Fixes

* custom result deserialization conflic with rust_mcp_schema::Result ([#44](https://github.com/rust-mcp-stack/rust-mcp-schema/issues/44)) ([f141060](https://github.com/rust-mcp-stack/rust-mcp-schema/commit/f14106047ee6fdc499f0915ea2029954cf06d634))
* custom result deserialization conflict with rust_mcp_schema::Result ([#44](https://github.com/rust-mcp-stack/rust-mcp-schema/issues/44)) ([f141060](https://github.com/rust-mcp-stack/rust-mcp-schema/commit/f14106047ee6fdc499f0915ea2029954cf06d634))

## [0.1.9](https://github.com/rust-mcp-stack/rust-mcp-schema/compare/v0.1.8...v0.1.9) (2025-03-02)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Multiple schema versions may be enabled concurrently if needed. Non-default vers
- rust_mcp_schema::mcp_2024_11_05
- rust_mcp_schema::mcp_draft"

Example: enable `2024_11_05` version of the shema:
Example: enable `2024_11_05` version of the schema:

<!-- x-release-please-start-version -->

Expand All @@ -95,7 +95,7 @@ Example: enable `2024_11_05` version of the shema:
rust-mcp-schema = { version: 0.7.4 , default-features = false, features=["2024_11_05"] }
```

Example: enable `draft`` version of the shema (2024_11_05) :
Example: enable `draft`` version of the schema (2024_11_05) :

```toml
#Cargo.toml
Expand Down
8 changes: 8 additions & 0 deletions src/generated_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ macro_rules! define_schema_version {
$mod_name:ident,
$schema_path:literal,
$utils_path:literal,
$validators_path:literal,
$schema_mod:ident,
$utils_mod:ident
) => {
Expand All @@ -15,6 +16,9 @@ macro_rules! define_schema_version {
#[path = $utils_path]
mod $utils_mod;

#[path = $validators_path]
mod validators;

#[cfg(feature = $feature)]
pub mod $mod_name {
pub use super::$schema_mod::*;
Expand All @@ -37,6 +41,7 @@ define_schema_version!(
mcp_2025_06_18,
"generated_schema/2025_06_18/mcp_schema.rs",
"generated_schema/2025_06_18/schema_utils.rs",
"generated_schema/2025_06_18/validators.rs",
__int_2025_06_18,
__int_utils_2025_06_18
);
Expand All @@ -47,6 +52,7 @@ define_schema_version!(
mcp_2025_03_26,
"generated_schema/2025_03_26/mcp_schema.rs",
"generated_schema/2025_03_26/schema_utils.rs",
"generated_schema/2025_03_26/validators.rs",
__int_2025_03_26,
__int_utils_2025_03_26
);
Expand All @@ -57,6 +63,7 @@ define_schema_version!(
mcp_2024_11_05,
"generated_schema/2024_11_05/mcp_schema.rs",
"generated_schema/2024_11_05/schema_utils.rs",
"generated_schema/2024_11_05/validators.rs",
__int_2024_11_05,
__int_utils_2024_11_05
);
Expand All @@ -67,6 +74,7 @@ define_schema_version!(
mcp_draft,
"generated_schema/draft/mcp_schema.rs",
"generated_schema/draft/schema_utils.rs",
"generated_schema/draft/validators.rs",
__int_draft,
__int_utils_draft
);
Expand Down
49 changes: 40 additions & 9 deletions src/generated_schema/2024_11_05/mcp_schema.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/// ----------------------------------------------------------------------------
/// This file is auto-generated by mcp-schema-gen v0.4.2.
/// This file is auto-generated by mcp-schema-gen v0.4.4.
/// WARNING:
/// It is not recommended to modify this file directly. You are free to
/// modify or extend the implementations as needed, but please do so at your own risk.
///
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
/// Hash : 3473e6e72b222f44163b41eab8d4b0973ac106b6
/// Generated at : 2025-09-17 19:15:48
/// Hash : 71204c22f8e062795dca00a87d31070033572ba2
/// Generated at : 2025-10-03 15:17:01
/// ----------------------------------------------------------------------------
///
use super::validators as validate;
/// MCP Protocol Version
pub const LATEST_PROTOCOL_VERSION: &str = "2024-11-05";
/// JSON-RPC Version
Expand Down Expand Up @@ -171,6 +172,7 @@ pub struct BlobResourceContents {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CallToolRequest {
#[serde(deserialize_with = "validate::call_tool_request_method")]
method: ::std::string::String,
pub params: CallToolRequestParams,
}
Expand Down Expand Up @@ -359,6 +361,7 @@ A client MUST NOT attempt to cancel its initialize request.*/
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CancelledNotification {
#[serde(deserialize_with = "validate::cancelled_notification_method")]
method: ::std::string::String,
pub params: CancelledNotificationParams,
}
Expand Down Expand Up @@ -766,6 +769,7 @@ impl ::std::convert::From<Result> for ClientResult {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CompleteRequest {
#[serde(deserialize_with = "validate::complete_request_method")]
method: ::std::string::String,
pub params: CompleteRequestParams,
}
Expand Down Expand Up @@ -1063,6 +1067,7 @@ pub struct CompleteResultCompletion {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CreateMessageRequest {
#[serde(deserialize_with = "validate::create_message_request_method")]
method: ::std::string::String,
pub params: CreateMessageRequestParams,
}
Expand Down Expand Up @@ -1358,7 +1363,7 @@ pub struct EmbeddedResource {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub annotations: ::std::option::Option<EmbeddedResourceAnnotations>,
pub resource: EmbeddedResourceResource,
#[serde(rename = "type")]
#[serde(rename = "type", deserialize_with = "validate::embedded_resource_type_")]
type_: ::std::string::String,
}
impl EmbeddedResource {
Expand Down Expand Up @@ -1498,6 +1503,7 @@ pub struct EmptyResult(pub Result);
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct GetPromptRequest {
#[serde(deserialize_with = "validate::get_prompt_request_method")]
method: ::std::string::String,
pub params: GetPromptRequestParams,
}
Expand Down Expand Up @@ -1648,7 +1654,7 @@ pub struct ImageContent {
///The MIME type of the image. Different providers may support different image types.
#[serde(rename = "mimeType")]
pub mime_type: ::std::string::String,
#[serde(rename = "type")]
#[serde(rename = "type", deserialize_with = "validate::image_content_type_")]
type_: ::std::string::String,
}
impl ImageContent {
Expand Down Expand Up @@ -1776,6 +1782,7 @@ pub struct Implementation {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct InitializeRequest {
#[serde(deserialize_with = "validate::initialize_request_method")]
method: ::std::string::String,
pub params: InitializeRequestParams,
}
Expand Down Expand Up @@ -1915,6 +1922,7 @@ pub struct InitializeResult {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct InitializedNotification {
#[serde(deserialize_with = "validate::initialized_notification_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<InitializedNotificationParams>,
Expand Down Expand Up @@ -2008,6 +2016,7 @@ pub struct InitializedNotificationParams {
pub struct JsonrpcError {
pub error: RpcError,
pub id: RequestId,
#[serde(deserialize_with = "validate::jsonrpc_error_jsonrpc")]
jsonrpc: ::std::string::String,
}
impl JsonrpcError {
Expand Down Expand Up @@ -2110,6 +2119,7 @@ impl ::std::convert::From<JsonrpcError> for JsonrpcMessage {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct JsonrpcNotification {
#[serde(deserialize_with = "validate::jsonrpc_notification_jsonrpc")]
jsonrpc: ::std::string::String,
pub method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
Expand Down Expand Up @@ -2199,6 +2209,7 @@ pub struct JsonrpcNotificationParams {
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct JsonrpcRequest {
pub id: RequestId,
#[serde(deserialize_with = "validate::jsonrpc_request_jsonrpc")]
jsonrpc: ::std::string::String,
pub method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
Expand Down Expand Up @@ -2299,6 +2310,7 @@ pub struct JsonrpcRequestParamsMeta {
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct JsonrpcResponse {
pub id: RequestId,
#[serde(deserialize_with = "validate::jsonrpc_response_jsonrpc")]
jsonrpc: ::std::string::String,
pub result: Result,
}
Expand Down Expand Up @@ -2345,6 +2357,7 @@ impl JsonrpcResponse {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListPromptsRequest {
#[serde(deserialize_with = "validate::list_prompts_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<ListPromptsRequestParams>,
Expand Down Expand Up @@ -2459,6 +2472,7 @@ pub struct ListPromptsResult {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListResourceTemplatesRequest {
#[serde(deserialize_with = "validate::list_resource_templates_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<ListResourceTemplatesRequestParams>,
Expand Down Expand Up @@ -2574,6 +2588,7 @@ pub struct ListResourceTemplatesResult {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListResourcesRequest {
#[serde(deserialize_with = "validate::list_resources_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<ListResourcesRequestParams>,
Expand Down Expand Up @@ -2699,6 +2714,7 @@ structure or access specific locations that the client has permission to read fr
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListRootsRequest {
#[serde(deserialize_with = "validate::list_roots_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<ListRootsRequestParams>,
Expand Down Expand Up @@ -2835,6 +2851,7 @@ pub struct ListRootsResult {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ListToolsRequest {
#[serde(deserialize_with = "validate::list_tools_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<ListToolsRequestParams>,
Expand Down Expand Up @@ -3017,6 +3034,7 @@ impl ::std::fmt::Display for LoggingLevel {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct LoggingMessageNotification {
#[serde(deserialize_with = "validate::logging_message_notification_method")]
method: ::std::string::String,
pub params: LoggingMessageNotificationParams,
}
Expand Down Expand Up @@ -3353,6 +3371,7 @@ pub struct PaginatedResult {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct PingRequest {
#[serde(deserialize_with = "validate::ping_request_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<PingRequestParams>,
Expand Down Expand Up @@ -3466,6 +3485,7 @@ pub struct PingRequestParamsMeta {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ProgressNotification {
#[serde(deserialize_with = "validate::progress_notification_method")]
method: ::std::string::String,
pub params: ProgressNotificationParams,
}
Expand Down Expand Up @@ -3659,6 +3679,7 @@ pub struct PromptArgument {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct PromptListChangedNotification {
#[serde(deserialize_with = "validate::prompt_list_changed_notification_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<PromptListChangedNotificationParams>,
Expand Down Expand Up @@ -3814,7 +3835,7 @@ impl ::std::convert::From<EmbeddedResource> for PromptMessageContent {
pub struct PromptReference {
///The name of the prompt or prompt template
pub name: ::std::string::String,
#[serde(rename = "type")]
#[serde(rename = "type", deserialize_with = "validate::prompt_reference_type_")]
type_: ::std::string::String,
}
impl PromptReference {
Expand Down Expand Up @@ -3867,6 +3888,7 @@ impl PromptReference {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ReadResourceRequest {
#[serde(deserialize_with = "validate::read_resource_request_method")]
method: ::std::string::String,
pub params: ReadResourceRequestParams,
}
Expand Down Expand Up @@ -4275,6 +4297,7 @@ pub struct ResourceContents {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ResourceListChangedNotification {
#[serde(deserialize_with = "validate::resource_list_changed_notification_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<ResourceListChangedNotificationParams>,
Expand Down Expand Up @@ -4347,7 +4370,7 @@ pub struct ResourceListChangedNotificationParams {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ResourceReference {
#[serde(rename = "type")]
#[serde(rename = "type", deserialize_with = "validate::resource_reference_type_")]
type_: ::std::string::String,
///The URI or URI template of the resource.
pub uri: ::std::string::String,
Expand Down Expand Up @@ -4506,6 +4529,7 @@ pub struct ResourceTemplateAnnotations {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ResourceUpdatedNotification {
#[serde(deserialize_with = "validate::resource_updated_notification_method")]
method: ::std::string::String,
pub params: ResourceUpdatedNotificationParams,
}
Expand Down Expand Up @@ -4676,6 +4700,7 @@ The server should then request an updated list of roots using the ListRootsReque
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct RootsListChangedNotification {
#[serde(deserialize_with = "validate::roots_list_changed_notification_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<RootsListChangedNotificationParams>,
Expand Down Expand Up @@ -5078,6 +5103,7 @@ impl ::std::convert::From<LoggingMessageNotification> for ServerNotification {
/// </details>
#[derive(::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
#[allow(clippy::large_enum_variant)]
pub enum ServerRequest {
PingRequest(PingRequest),
CreateMessageRequest(CreateMessageRequest),
Expand Down Expand Up @@ -5141,6 +5167,7 @@ impl ::std::convert::From<ListRootsRequest> for ServerRequest {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
#[allow(clippy::large_enum_variant)]
pub enum ServerResult {
InitializeResult(InitializeResult),
ListResourcesResult(ListResourcesResult),
Expand Down Expand Up @@ -5238,6 +5265,7 @@ impl ::std::convert::From<Result> for ServerResult {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SetLevelRequest {
#[serde(deserialize_with = "validate::set_level_request_method")]
method: ::std::string::String,
pub params: SetLevelRequestParams,
}
Expand Down Expand Up @@ -5315,6 +5343,7 @@ pub struct SetLevelRequestParams {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct SubscribeRequest {
#[serde(deserialize_with = "validate::subscribe_request_method")]
method: ::std::string::String,
pub params: SubscribeRequestParams,
}
Expand Down Expand Up @@ -5406,7 +5435,7 @@ pub struct TextContent {
pub annotations: ::std::option::Option<TextContentAnnotations>,
///The text content of the message.
pub text: ::std::string::String,
#[serde(rename = "type")]
#[serde(rename = "type", deserialize_with = "validate::text_content_type_")]
type_: ::std::string::String,
}
impl TextContent {
Expand Down Expand Up @@ -5599,7 +5628,7 @@ pub struct ToolInputSchema {
>,
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub required: ::std::vec::Vec<::std::string::String>,
#[serde(rename = "type")]
#[serde(rename = "type", deserialize_with = "validate::tool_input_schema_type_")]
type_: ::std::string::String,
}
impl ToolInputSchema {
Expand Down Expand Up @@ -5658,6 +5687,7 @@ impl ToolInputSchema {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct ToolListChangedNotification {
#[serde(deserialize_with = "validate::tool_list_changed_notification_method")]
method: ::std::string::String,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub params: ::std::option::Option<ToolListChangedNotificationParams>,
Expand Down Expand Up @@ -5738,6 +5768,7 @@ pub struct ToolListChangedNotificationParams {
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct UnsubscribeRequest {
#[serde(deserialize_with = "validate::unsubscribe_request_method")]
method: ::std::string::String,
pub params: UnsubscribeRequestParams,
}
Expand Down
Loading