Skip to content

feat!: update schema default version and latest draft changes #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 22, 2025
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
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Rust
uses: actions/cache@v4
with:
path: |
~/.rustup/toolchains
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-rust-${{ steps.toolchain.outputs.cachekey }}
restore-keys: ${{ runner.os }}-rust-

- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@master
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ features = ["2024_11_05", "schema_utils"]
[features]

# defalt features
default = ["2024_11_05", "schema_utils"] # Default features
default = ["2025_03_26", "schema_utils"] # Default features

# activates the latest MCP schema version, this will be updated once a new version of schema is published
latest = ["2025_03_26"]
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ This repository provides all official released versions the schema , including d
### How to switch between different schema versions?

Each schema version has a corresponding Cargo feature that can be enabled in your project's Cargo.toml.
By default, the version `2024_11_05` of the schema is active.
By default, the version `2025_03_26` of the schema is active.

Example: enable `2025_03_26` version of the shema:
Example: enable `2024_11_05` version of the shema:

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

```toml
# Cargo.toml
rust-mcp-schema = { version: 0.4.0 , features=["2025_03_26"] }
rust-mcp-schema = { version: 0.4.0 , features=["2024_11_05"] }
```

Example: enable `latest` version of the shema:
Expand All @@ -95,11 +95,11 @@ Example: enable `latest` version of the shema:
rust-mcp-schema = { version: 0.4.0 , features=["latest"] }
```

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

```toml
#Cargo.toml
rust-mcp-schema = { version: 0.4.0 , features=["2024_11_05"] }
rust-mcp-schema = { version: 0.4.0 , features=["draft"] }
```

<!-- x-release-please-end -->
Expand Down Expand Up @@ -324,7 +324,7 @@ fn handle_message(message_payload: &str) -> std::result::Result<(), AppError> {

We welcome everyone who wishes to contribute! Please refer to the [contributing guidelines](CONTRIBUTING.md) for more details.

All contributions, including issues and pull requests, must follow
All contributions, including issues and pull requests, must follow
[Rust's Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct).

Unless explicitly stated otherwise, any contribution you submit for inclusion in `rust-mcp-schema` is provided under the terms of the MIT License, without any additional conditions or restrictions.
9 changes: 9 additions & 0 deletions examples/mcp_client_handle_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,18 @@ fn handle_message(message_payload: &str) -> std::result::Result<(), AppError> {
ServerResult::ListToolsResult(list_tools_result) => {
dbg!(list_tools_result);
}
#[cfg(any(feature = "2025_03_26", feature = "2024_11_05"))]
ServerResult::CallToolResult(call_tool_result) => {
dbg!(call_tool_result);
}
#[cfg(feature = "draft")]
ServerResult::CallToolUnstructuredResult(call_tool_unstructured_result) => {
dbg!(call_tool_unstructured_result);
}
#[cfg(feature = "draft")]
ServerResult::CallToolStructuredResult(call_tool_structured_result) => {
dbg!(call_tool_structured_result);
}
ServerResult::CompleteResult(complete_result) => {
dbg!(complete_result);
}
Expand Down
27 changes: 9 additions & 18 deletions src/generated_schema.rs
Original file line number Diff line number Diff line change
@@ -1,44 +1,35 @@
/// Schema Version : 2024_11_05
/// Schema Version: 2024_11_05
#[cfg(feature = "2024_11_05")]
#[path = "generated_schema/2024_11_05/mcp_schema.rs"]
mod schema_2024_11_05;
mod mcp_schema;

#[cfg(feature = "2024_11_05")]
pub use schema_2024_11_05::*;
pub use mcp_schema::*;

#[cfg(all(feature = "schema_utils", feature = "2024_11_05"))]
#[path = "generated_schema/2024_11_05/schema_utils.rs"]
pub mod schema_utils;

/// Schema Version : 2025_03_26
/// Schema Version: 2025_03_26
#[cfg(feature = "2025_03_26")]
#[cfg(not(feature = "2024_11_05"))]
#[path = "generated_schema/2025_03_26/mcp_schema.rs"]
mod schema_2025_03_26;
mod mcp_schema;

#[cfg(feature = "2025_03_26")]
#[cfg(not(feature = "2024_11_05"))]
pub use schema_2025_03_26::*;
pub use mcp_schema::*;

#[cfg(all(feature = "schema_utils", feature = "2025_03_26"))]
#[cfg(not(feature = "2024_11_05"))]
#[path = "generated_schema/2025_03_26/schema_utils.rs"]
pub mod schema_utils;

/// Schema Version : draft
/// Schema Version: draft
#[cfg(feature = "draft")]
#[cfg(not(feature = "2024_11_05"))]
#[cfg(not(feature = "2025_03_26"))]
#[path = "generated_schema/draft/mcp_schema.rs"]
mod schema_draft;
mod mcp_schema;

#[cfg(feature = "draft")]
#[cfg(not(feature = "2024_11_05"))]
#[cfg(not(feature = "2025_03_26"))]
pub use schema_draft::*;
pub use mcp_schema::*;

#[cfg(all(feature = "schema_utils", feature = "draft"))]
#[cfg(not(feature = "2024_11_05"))]
#[cfg(not(feature = "2025_03_26"))]
#[path = "generated_schema/draft/schema_utils.rs"]
pub mod schema_utils;
6 changes: 3 additions & 3 deletions src/generated_schema/2024_11_05/mcp_schema.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/// ----------------------------------------------------------------------------
/// This file is auto-generated by mcp-schema-gen v0.2.0.
/// This file is auto-generated by mcp-schema-gen v0.3.0.
/// 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 : 5da5bac89165d68cad24a211119e4c1b61178d5a
/// Generated at : 2025-04-26 18:56:03
/// Hash : UNKNOWN
/// Generated at : 2025-05-20 20:52:14
/// ----------------------------------------------------------------------------
///
/// MCP Protocol Version
Expand Down
6 changes: 3 additions & 3 deletions src/generated_schema/2025_03_26/mcp_schema.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/// ----------------------------------------------------------------------------
/// This file is auto-generated by mcp-schema-gen v0.2.0.
/// This file is auto-generated by mcp-schema-gen v0.3.0.
/// 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 : 5da5bac89165d68cad24a211119e4c1b61178d5a
/// Generated at : 2025-04-26 18:56:03
/// Hash : UNKNOWN
/// Generated at : 2025-05-20 20:52:15
/// ----------------------------------------------------------------------------
///
/// MCP Protocol Version
Expand Down
3 changes: 2 additions & 1 deletion src/generated_schema/2025_03_26/schema_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub enum MessageTypes {
/// Implements the `Display` trait for the `MessageTypes` enum,
/// allowing it to be converted into a human-readable string.
impl Display for MessageTypes {
/// Formats the `MessageTypes` enum variant as a string.
/// Formats the `MessageTypes` enum variant as a string.
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
Expand Down Expand Up @@ -1071,6 +1071,7 @@ impl FromStr for ServerJsonrpcResponse {

/// To determine standard and custom results from the server side
/// Custom results (CustomResult) are of type serde_json::Value and can be deserialized into any custom type.
#[allow(clippy::large_enum_variant)]
#[derive(::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ResultFromServer {
Expand Down
Loading