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:
parent
42a1069833
commit
77932141e3
1 changed files with 4321 additions and 3886 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue