feat(tool): allow tool call return a serializable value in json format (#75) (#78)

This commit is contained in:
4t145 2025-04-01 15:53:01 +08:00 • committed by GitHub
commit 2c0cafdde3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,6 @@
use rmcp::{
ServerHandler,
handler::server::wrapper::Json,
model::{ServerCapabilities, ServerInfo},
schemars, tool,
};
@ -28,8 +29,8 @@ impl Calculator {
#[tool(param)]
#[schemars(description = "the left hand side number")]
b: i32,
) -> String {
(a - b).to_string()
) -> Json<i32> {
Json(a - b)
}
}