Skip to content

Commit 279baf2

Browse files
authored
feat!: update schema default version and latest draft changes (#68)
* feat: update schema with latest draft changes * chore: update cargo features * chore: ignore clippy check * chore: ignore clippy check
1 parent 870e70e commit 279baf2

File tree

13 files changed

+500
-78
lines changed

13 files changed

+500
-78
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ jobs:
2121
steps:
2222
- name: Checkout
2323
uses: actions/checkout@v4
24+
- name: Cache Rust
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
~/.rustup/toolchains
29+
~/.cargo/registry
30+
~/.cargo/git
31+
target
32+
key: ${{ runner.os }}-rust-${{ steps.toolchain.outputs.cachekey }}
33+
restore-keys: ${{ runner.os }}-rust-
2434

2535
- name: Install Rust Toolchain
2636
uses: dtolnay/rust-toolchain@master

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ features = ["2024_11_05", "schema_utils"]
3636
[features]
3737

3838
# defalt features
39-
default = ["2024_11_05", "schema_utils"] # Default features
39+
default = ["2025_03_26", "schema_utils"] # Default features
4040

4141
# activates the latest MCP schema version, this will be updated once a new version of schema is published
4242
latest = ["2025_03_26"]

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ This repository provides all official released versions the schema , including d
7777
### How to switch between different schema versions?
7878

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

82-
Example: enable `2025_03_26` version of the shema:
82+
Example: enable `2024_11_05` version of the shema:
8383

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

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

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

98-
Example: enable specific version of the shema (2024_11_05) :
98+
Example: enable `draft`` version of the shema (2024_11_05) :
9999

100100
```toml
101101
#Cargo.toml
102-
rust-mcp-schema = { version: 0.4.0 , features=["2024_11_05"] }
102+
rust-mcp-schema = { version: 0.4.0 , features=["draft"] }
103103
```
104104

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

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

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

330330
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.

examples/mcp_client_handle_message.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,18 @@ fn handle_message(message_payload: &str) -> std::result::Result<(), AppError> {
122122
ServerResult::ListToolsResult(list_tools_result) => {
123123
dbg!(list_tools_result);
124124
}
125+
#[cfg(any(feature = "2025_03_26", feature = "2024_11_05"))]
125126
ServerResult::CallToolResult(call_tool_result) => {
126127
dbg!(call_tool_result);
127128
}
129+
#[cfg(feature = "draft")]
130+
ServerResult::CallToolUnstructuredResult(call_tool_unstructured_result) => {
131+
dbg!(call_tool_unstructured_result);
132+
}
133+
#[cfg(feature = "draft")]
134+
ServerResult::CallToolStructuredResult(call_tool_structured_result) => {
135+
dbg!(call_tool_structured_result);
136+
}
128137
ServerResult::CompleteResult(complete_result) => {
129138
dbg!(complete_result);
130139
}

src/generated_schema.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,35 @@
1-
/// Schema Version : 2024_11_05
1+
/// Schema Version: 2024_11_05
22
#[cfg(feature = "2024_11_05")]
33
#[path = "generated_schema/2024_11_05/mcp_schema.rs"]
4-
mod schema_2024_11_05;
4+
mod mcp_schema;
55

66
#[cfg(feature = "2024_11_05")]
7-
pub use schema_2024_11_05::*;
7+
pub use mcp_schema::*;
88

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

13-
/// Schema Version : 2025_03_26
13+
/// Schema Version: 2025_03_26
1414
#[cfg(feature = "2025_03_26")]
15-
#[cfg(not(feature = "2024_11_05"))]
1615
#[path = "generated_schema/2025_03_26/mcp_schema.rs"]
17-
mod schema_2025_03_26;
16+
mod mcp_schema;
1817

1918
#[cfg(feature = "2025_03_26")]
20-
#[cfg(not(feature = "2024_11_05"))]
21-
pub use schema_2025_03_26::*;
19+
pub use mcp_schema::*;
2220

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

28-
/// Schema Version : draft
25+
/// Schema Version: draft
2926
#[cfg(feature = "draft")]
30-
#[cfg(not(feature = "2024_11_05"))]
31-
#[cfg(not(feature = "2025_03_26"))]
3227
#[path = "generated_schema/draft/mcp_schema.rs"]
33-
mod schema_draft;
28+
mod mcp_schema;
3429

3530
#[cfg(feature = "draft")]
36-
#[cfg(not(feature = "2024_11_05"))]
37-
#[cfg(not(feature = "2025_03_26"))]
38-
pub use schema_draft::*;
31+
pub use mcp_schema::*;
3932

4033
#[cfg(all(feature = "schema_utils", feature = "draft"))]
41-
#[cfg(not(feature = "2024_11_05"))]
42-
#[cfg(not(feature = "2025_03_26"))]
4334
#[path = "generated_schema/draft/schema_utils.rs"]
4435
pub mod schema_utils;

src/generated_schema/2024_11_05/mcp_schema.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/// ----------------------------------------------------------------------------
2-
/// This file is auto-generated by mcp-schema-gen v0.2.0.
2+
/// This file is auto-generated by mcp-schema-gen v0.3.0.
33
/// WARNING:
44
/// It is not recommended to modify this file directly. You are free to
55
/// modify or extend the implementations as needed, but please do so at your own risk.
66
///
77
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
8-
/// Hash : 5da5bac89165d68cad24a211119e4c1b61178d5a
9-
/// Generated at : 2025-04-26 18:56:03
8+
/// Hash : UNKNOWN
9+
/// Generated at : 2025-05-20 20:52:14
1010
/// ----------------------------------------------------------------------------
1111
///
1212
/// MCP Protocol Version

src/generated_schema/2025_03_26/mcp_schema.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/// ----------------------------------------------------------------------------
2-
/// This file is auto-generated by mcp-schema-gen v0.2.0.
2+
/// This file is auto-generated by mcp-schema-gen v0.3.0.
33
/// WARNING:
44
/// It is not recommended to modify this file directly. You are free to
55
/// modify or extend the implementations as needed, but please do so at your own risk.
66
///
77
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
8-
/// Hash : 5da5bac89165d68cad24a211119e4c1b61178d5a
9-
/// Generated at : 2025-04-26 18:56:03
8+
/// Hash : UNKNOWN
9+
/// Generated at : 2025-05-20 20:52:15
1010
/// ----------------------------------------------------------------------------
1111
///
1212
/// MCP Protocol Version

src/generated_schema/2025_03_26/schema_utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub enum MessageTypes {
1515
/// Implements the `Display` trait for the `MessageTypes` enum,
1616
/// allowing it to be converted into a human-readable string.
1717
impl Display for MessageTypes {
18-
/// Formats the `MessageTypes` enum variant as a string.
18+
/// Formats the `MessageTypes` enum variant as a string.
1919
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2020
write!(
2121
f,
@@ -1071,6 +1071,7 @@ impl FromStr for ServerJsonrpcResponse {
10711071

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

0 commit comments

Comments
 (0)