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
3 changed files with 2121 additions and 127 deletions
|
|
@ -35,7 +35,7 @@ pub fn prompt_handler(attr: TokenStream, input: TokenStream) -> syn::Result<Toke
|
|||
&self,
|
||||
request: rmcp::model::GetPromptRequestParams,
|
||||
context: rmcp::service::RequestContext<rmcp::RoleServer>,
|
||||
) -> Result<rmcp::model::GetPromptResult, rmcp::ErrorData> {
|
||||
) -> Result<rmcp::model::GetPromptResponse, rmcp::ErrorData> {
|
||||
let prompt_context = rmcp::handler::server::prompt::PromptContext::new(
|
||||
self,
|
||||
request.name,
|
||||
|
|
|
|||
|
|
@ -77,7 +77,16 @@ pub fn task_handler(attr: TokenStream, input: TokenStream) -> syn::Result<TokenS
|
|||
|
||||
let task_result_id = task_id.clone();
|
||||
let future = Box::pin(async move {
|
||||
let result = server.call_tool(future_request, future_context).await;
|
||||
let result = server
|
||||
.call_tool(future_request, future_context)
|
||||
.await
|
||||
.and_then(|response| match response {
|
||||
rmcp::model::CallToolResponse::Complete(result) => Ok(result),
|
||||
_ => Err(rmcp::ErrorData::internal_error(
|
||||
"input_required is not supported for task-based tool calls",
|
||||
None,
|
||||
)),
|
||||
});
|
||||
Ok(
|
||||
Box::new(ToolCallTaskResult::new(task_result_id, result))
|
||||
as Box<dyn OperationResultTransport>,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ pub fn tool_handler(attr: TokenStream, input: TokenStream) -> syn::Result<TokenS
|
|||
&self,
|
||||
request: rmcp::model::CallToolRequestParams,
|
||||
context: rmcp::service::RequestContext<rmcp::RoleServer>,
|
||||
) -> Result<rmcp::model::CallToolResult, rmcp::ErrorData> {
|
||||
) -> Result<rmcp::model::CallToolResponse, rmcp::ErrorData> {
|
||||
let tcc = rmcp::handler::server::tool::ToolCallContext::new(self, request, context);
|
||||
#router.call(tcc).await
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue