feat!: align model types with MCP 2025-11-25 spec (#927)

* feat!: align model types with MCP 2025-11-25 spec

* fix: complete 2025-11-25 model spec conformance
This commit is contained in:
Dale Seo 2026-06-24 20:41:13 -04:00 • committed by GitHub
commit 77932141e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,7 @@
use rmcp::{
ClientHandler, ServerHandler, ServiceError, ServiceExt,
handler::server::router::tool::ToolRouter,
model::{CallToolRequestParams, ClientInfo, ErrorCode, JsonObject},
model::{CallToolRequestParams, ClientInfo, ErrorCode, TaskMetadata},
tool, tool_handler, tool_router,
};
@ -75,8 +75,8 @@ impl ClientHandler for DummyClientHandler {
}
/// Helper to create a task object for tool calls
fn make_task() -> JsonObject {
serde_json::Map::new()
fn make_task() -> TaskMetadata {
TaskMetadata::new()
}
#[tokio::test]
@ -203,7 +203,7 @@ async fn test_forbidden_task_tool_without_task_succeeds() -> anyhow::Result<()>
let text = result
.content
.first()
.and_then(|c| c.raw.as_text())
.and_then(|c| c.as_text())
.map(|t| t.text.as_str())
.unwrap_or("");
assert_eq!(text, "forbidden task executed");
@ -239,7 +239,7 @@ async fn test_optional_task_tool_without_task_succeeds() -> anyhow::Result<()> {
let text = result
.content
.first()
.and_then(|c| c.raw.as_text())
.and_then(|c| c.as_text())
.map(|t| t.text.as_str())
.unwrap_or("");
assert_eq!(text, "optional task executed");