feat!: add MRTR behavior support (SEP-2322) (#929)
* feat!: add MRTR behavior support * feat: harden SEP-2322 MRTR support * ci: diff public API only on features common to base and head cargo public-api builds both revisions with the same feature set, so a feature introduced (or removed) by a PR broke the build of the other revision. Restrict the all-features diff to features present in both the base and head revisions.
This commit is contained in:
parent
a7194590ff
commit
dd30a70f84
1 changed files with 2121 additions and 127 deletions
|
|
@ -3,7 +3,7 @@
|
|||
use rmcp::{
|
||||
Json, ServerHandler,
|
||||
handler::server::{router::tool::ToolRouter, tool::IntoCallToolResult, wrapper::Parameters},
|
||||
model::{CallToolResult, ContentBlock, ServerResult, Tool},
|
||||
model::{CallToolResponse, CallToolResult, ContentBlock, ServerResult, Tool},
|
||||
tool, tool_handler, tool_router,
|
||||
};
|
||||
use schemars::JsonSchema;
|
||||
|
|
@ -245,11 +245,13 @@ async fn test_structured_return_conversion() {
|
|||
};
|
||||
|
||||
let structured = Json(calc_result);
|
||||
let result: Result<CallToolResult, rmcp::ErrorData> =
|
||||
let result: Result<CallToolResponse, rmcp::ErrorData> =
|
||||
rmcp::handler::server::tool::IntoCallToolResult::into_call_tool_result(structured);
|
||||
|
||||
assert!(result.is_ok());
|
||||
let call_result = result.unwrap();
|
||||
let CallToolResponse::Complete(call_result) = result.unwrap() else {
|
||||
panic!("expected complete CallToolResult");
|
||||
};
|
||||
|
||||
// Tools which return structured content should also return a serialized version as
|
||||
// Content::text for backwards compatibility.
|
||||
|
|
@ -306,11 +308,13 @@ async fn test_output_schema_requires_structured_content() {
|
|||
let result = server.calculate(params).await.unwrap();
|
||||
|
||||
// Convert the Json<CalculationResult> to CallToolResult
|
||||
let call_result: Result<CallToolResult, rmcp::ErrorData> =
|
||||
let call_result: Result<CallToolResponse, rmcp::ErrorData> =
|
||||
IntoCallToolResult::into_call_tool_result(result);
|
||||
|
||||
assert!(call_result.is_ok());
|
||||
let call_result = call_result.unwrap();
|
||||
let CallToolResponse::Complete(call_result) = call_result.unwrap() else {
|
||||
panic!("expected complete CallToolResult");
|
||||
};
|
||||
|
||||
// Verify it has structured_content and content
|
||||
assert!(call_result.structured_content.is_some());
|
||||
|
|
|
|||
Loading…
Reference in a new issue