Skip to content

Commit 6cd9273

Browse files
committed
fix: add meta field to CallToolResult struct and update constructors
- Add meta field to CallToolResult struct definition - Update all CallToolResult constructor methods to include missing fields: - Add structured_content field to success(), error(), success_with_meta(), and error_with_meta() - Add meta field to structured() and structured_error() - Update CallToolResultHelper deserializer to include meta field - Regenerate server_json_rpc_message_schema_current.json with updated schema BREAKING CHANGE: CallToolResult struct now includes meta field
1 parent cdea86f commit 6cd9273

82 files changed

Lines changed: 8978 additions & 492 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
applyTo: '**'
3+
---
4+
5+
When you need the information about the Model Context Protocol (MCP) specification, you can fetch the latest document from the official MCP website.
6+
7+
# Overall
8+
#fetch https://modelcontextprotocol.io/specification/2025-06-18.md
9+
10+
## Key Changes
11+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/changelog.md
12+
13+
## Architecture
14+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/architecture.md
15+
16+
# BaseProtocol
17+
## Overview
18+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/basic.md
19+
20+
## Lifecycle
21+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle.md
22+
23+
## Transports
24+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/basic/transports.md
25+
26+
## Authorization
27+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization.md
28+
29+
## Security Best Practices
30+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/basic/security_best_practices.md
31+
32+
## Utilities
33+
### Cancellation
34+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/basic/utilities/cancellation.md
35+
36+
### Ping
37+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/basic/utilities/ping.md
38+
39+
### Progress
40+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/basic/utilities/progress.md
41+
42+
# Client Features
43+
## Roots
44+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/client/roots.md
45+
46+
## Sampling
47+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/client/sampling.md
48+
49+
## Elicitation
50+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation.md
51+
52+
# Server Features
53+
## Overview
54+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/server.md
55+
56+
## Prompts
57+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/server/prompts.md
58+
59+
## Resources
60+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/server/resources.md
61+
62+
## Tools
63+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/server/tools.md
64+
65+
## Utilities
66+
### Completion
67+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/server/utilities/completion.md
68+
### Logging
69+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/server/utilities/logging.md
70+
### Pagination
71+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/server/utilities/pagination.md
72+
73+
# Schema Reference
74+
#fetch https://modelcontextprotocol.io/specification/2025-06-18/schema.md

.github/workflows/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
if: github.event_name == 'pull_request'
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v5
2222
with:
2323
fetch-depth: 0
2424

@@ -39,7 +39,7 @@ jobs:
3939
name: Code Formatting
4040
runs-on: ubuntu-latest
4141
steps:
42-
- uses: actions/checkout@v4
42+
- uses: actions/checkout@v5
4343

4444
- name: Install Rust fmt
4545
run: rustup toolchain install nightly --component rustfmt
@@ -51,7 +51,7 @@ jobs:
5151
name: Lint with Clippy
5252
runs-on: ubuntu-latest
5353
steps:
54-
- uses: actions/checkout@v4
54+
- uses: actions/checkout@v5
5555

5656
- name: Install Rust
5757
uses: dtolnay/rust-toolchain@stable
@@ -65,15 +65,15 @@ jobs:
6565
name: spell check with typos
6666
runs-on: ubuntu-latest
6767
steps:
68-
- uses: actions/checkout@v4
68+
- uses: actions/checkout@v5
6969
- name: Spell Check Repo
7070
uses: crate-ci/typos@master
7171

7272
test:
7373
name: Run Tests
7474
runs-on: ubuntu-latest
7575
steps:
76-
- uses: actions/checkout@v4
76+
- uses: actions/checkout@v5
7777

7878
# install nodejs
7979
- name: Setup Node.js
@@ -104,7 +104,7 @@ jobs:
104104
permissions:
105105
contents: write
106106
steps:
107-
- uses: actions/checkout@v4
107+
- uses: actions/checkout@v5
108108

109109
# install nodejs
110110
- name: Setup Node.js
@@ -139,7 +139,7 @@ jobs:
139139
name: Example test
140140
runs-on: ubuntu-latest
141141
steps:
142-
- uses: actions/checkout@v4
142+
- uses: actions/checkout@v5
143143

144144
# install nodejs
145145
- name: Setup Node.js
@@ -195,7 +195,7 @@ jobs:
195195
name: Security Audit
196196
runs-on: ubuntu-latest
197197
steps:
198-
- uses: actions/checkout@v4
198+
- uses: actions/checkout@v5
199199

200200
- name: Install Rust
201201
uses: dtolnay/rust-toolchain@stable
@@ -212,7 +212,7 @@ jobs:
212212
name: Generate Documentation
213213
runs-on: ubuntu-latest
214214
steps:
215-
- uses: actions/checkout@v4
215+
- uses: actions/checkout@v5
216216

217217
- name: Install Rust
218218
uses: dtolnay/rust-toolchain@nightly
@@ -239,7 +239,7 @@ jobs:
239239
# This happened recently in the attack on `tj-actions/changed-files`, but
240240
# has happened many times before as well.
241241

242-
- uses: actions/checkout@v4
242+
- uses: actions/checkout@v5
243243

244244
- name: Update Rust
245245
run: |

.github/workflows/release-plz.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
contents: write
2121
steps:
2222
- name: Checkout repository
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v5
2424
with:
2525
fetch-depth: 0
2626
- name: Install Rust toolchain
@@ -46,7 +46,7 @@ jobs:
4646
cancel-in-progress: false
4747
steps:
4848
- name: Checkout repository
49-
uses: actions/checkout@v4
49+
uses: actions/checkout@v5
5050
with:
5151
fetch-depth: 0
5252
- name: Install Rust toolchain

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@ Cargo.lock
1313
# MSVC Windows builds of rustc generate these, which store debugging information
1414
*.pdb
1515
.vscode/
16+
17+
# Python artifacts (for test directories)
18+
*.egg-info/
19+
__pycache__/
20+
*.pyc
21+
*.pyo
22+
1623
# RustRover
1724
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
1825
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
1926
# and can be added to the global gitignore or merged into this file. For a more nuclear
2027
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
21-
#.idea/
28+
#.idea/

Cargo.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
2-
31
[workspace]
42
members = ["crates/rmcp", "crates/rmcp-macros", "examples/*"]
53
resolver = "2"
64

75
[workspace.dependencies]
8-
rmcp = { version = "0.3.0", path = "./crates/rmcp" }
9-
rmcp-macros = { version = "0.3.0", path = "./crates/rmcp-macros" }
6+
rmcp = { version = "0.6.0", path = "./crates/rmcp" }
7+
rmcp-macros = { version = "0.6.0", path = "./crates/rmcp-macros" }
108

119
[workspace.package]
1210
edition = "2024"
13-
version = "0.3.0"
11+
version = "0.6.0"
1412
authors = ["4t145 <u4t145@163.com>"]
15-
license = "MIT/Apache-2.0"
13+
license = "MIT"
1614
repository = "https://github.com/modelcontextprotocol/rust-sdk/"
1715
description = "Rust SDK for Model Context Protocol"
1816
keywords = ["mcp", "sdk", "tokio", "modelcontextprotocol"]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ See [oauth_support](docs/OAUTH_SUPPORT.md) for details.
119119
- [Schema](https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.ts)
120120

121121
## Related Projects
122+
- [rustfs-mcp](https://github.com/rustfs/rustfs/tree/main/crates/mcp) - High-performance MCP server providing S3-compatible object storage operations for AI/LLM integration
122123
- [containerd-mcp-server](https://github.com/jokemanfire/mcp-containerd) - A containerd-based MCP server implementation
123124

124125
## Development

crates/rmcp-macros/CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.6.0](https://github.com/modelcontextprotocol/rust-sdk/compare/rmcp-macros-v0.5.0...rmcp-macros-v0.6.0) - 2025-08-19
11+
12+
### Other
13+
14+
- add related project rustfs-mcp ([#378](https://github.com/modelcontextprotocol/rust-sdk/pull/378))
15+
16+
## [0.4.0](https://github.com/modelcontextprotocol/rust-sdk/compare/rmcp-macros-v0.3.2...rmcp-macros-v0.4.0) - 2025-08-05
17+
18+
### Added
19+
20+
- [**breaking**] Add support for `Tool.outputSchema` and `CallToolResult.structuredContent` ([#316](https://github.com/modelcontextprotocol/rust-sdk/pull/316))
21+
22+
### Other
23+
24+
- README.md codeblock terminator ([#348](https://github.com/modelcontextprotocol/rust-sdk/pull/348))
25+
26+
## [0.3.1](https://github.com/modelcontextprotocol/rust-sdk/compare/rmcp-macros-v0.3.0...rmcp-macros-v0.3.1) - 2025-07-29
27+
28+
### Other
29+
30+
- Fix formatting in crate descriptions in README.md ([#333](https://github.com/modelcontextprotocol/rust-sdk/pull/333))
31+
1032
## [0.3.0](https://github.com/modelcontextprotocol/rust-sdk/compare/rmcp-macros-v0.2.1...rmcp-macros-v0.3.0) - 2025-07-15
1133

1234
### Added

crates/rmcp-macros/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl MyToolHandler {
9898
}
9999
}
100100
}
101-
101+
```
102102

103103
### tool_handler
104104

@@ -159,4 +159,4 @@ impl ServerHandler for MyToolHandler {
159159

160160
## License
161161

162-
Please refer to the LICENSE file in the project root directory.
162+
Please refer to the LICENSE file in the project root directory.

crates/rmcp-macros/src/common.rs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//! Common utilities shared between different macro implementations
2+
3+
use quote::quote;
4+
use syn::{Attribute, Expr, FnArg, ImplItemFn, Signature, Type};
5+
6+
/// Parse a None expression
7+
pub fn none_expr() -> syn::Result<Expr> {
8+
syn::parse2::<Expr>(quote! { None })
9+
}
10+
11+
/// Extract documentation from doc attributes
12+
pub fn extract_doc_line(existing_docs: Option<String>, attr: &Attribute) -> Option<String> {
13+
if !attr.path().is_ident("doc") {
14+
return None;
15+
}
16+
17+
let syn::Meta::NameValue(name_value) = &attr.meta else {
18+
return None;
19+
};
20+
21+
let syn::Expr::Lit(expr_lit) = &name_value.value else {
22+
return None;
23+
};
24+
25+
let syn::Lit::Str(lit_str) = &expr_lit.lit else {
26+
return None;
27+
};
28+
29+
let content = lit_str.value().trim().to_string();
30+
match (existing_docs, content) {
31+
(Some(mut existing_docs), content) if !content.is_empty() => {
32+
existing_docs.push('\n');
33+
existing_docs.push_str(&content);
34+
Some(existing_docs)
35+
}
36+
(Some(existing_docs), _) => Some(existing_docs),
37+
(None, content) if !content.is_empty() => Some(content),
38+
_ => None,
39+
}
40+
}
41+
42+
/// Find Parameters<T> type in function signature
43+
/// Returns the full Parameters<T> type if found
44+
pub fn find_parameters_type_in_sig(sig: &Signature) -> Option<Box<Type>> {
45+
sig.inputs.iter().find_map(|input| {
46+
if let FnArg::Typed(pat_type) = input {
47+
if let Type::Path(type_path) = &*pat_type.ty {
48+
if type_path
49+
.path
50+
.segments
51+
.last()
52+
.is_some_and(|type_name| type_name.ident == "Parameters")
53+
{
54+
return Some(pat_type.ty.clone());
55+
}
56+
}
57+
}
58+
None
59+
})
60+
}
61+
62+
/// Find Parameters<T> type in ImplItemFn
63+
pub fn find_parameters_type_impl(fn_item: &ImplItemFn) -> Option<Box<Type>> {
64+
find_parameters_type_in_sig(&fn_item.sig)
65+
}

0 commit comments

Comments
 (0)