MCP: execute Tools through request-scoped SDK handlers
CI / UI Checks (pull_request) Successful in 8s
CI / Rust Checks (pull_request) Successful in 35m42s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped

This commit is contained in:
bsodfather committed 2026-11-13 16:57:28 +00:00
1 parent 5611e81579
commit 3b30aad28e
12 files changed
+798 -151

No files matched your search

@@ -22,7 +22,6 @@ use super::response::{
completion_result, internal_jsonrpc_error, prompt_arguments_error_response, prompt_get_result,
prompts_list_result, resource_error_response, resource_read_result,
resource_templates_list_result, resources_list_result, take_confirmation_token,
tools_list_result,
};
use super::rmcp_dispatch::{
handle_resources_command, handle_tools_command, list_resource_templates,
@@ -36,7 +35,7 @@ use crate::{
EVENT_LEVEL_APPLIED, INVALID_LEVEL, Kind, LoggingOutcome, MethodHandler, PromptGetCommand,
PromptsCommand, PromptsListCommand, PromptsOutcome, RequestIdentity, ResourceReadCommand,
ResourcesCommand, ResourcesListCommand, ResourcesOutcome, ServiceContext, SetLevelCommand,
ToolCallCommand, ToolsCommand, ToolsListCommand, ToolsOutcome, handle_logging_command,
ToolCallCommand, ToolsCommand, ToolsListCommand, handle_logging_command,
},
tool_error::execution_locale,
transport::{ResponseMode, session_id_from_headers, transport_response},
@@ -159,36 +158,12 @@ pub(super) async fn handle_legacy_request(
None,
)
.await;
match outcome {
ToolsOutcome::List { tools, next_cursor } => {
match tools_list_result(tools, next_cursor, &session.protocol_version) {
Ok(result) => transport_response(
StatusCode::OK,
jsonrpc_result(request_id(message), result),
response_mode,
None,
Some(&session.protocol_version),
),
Err(error) => internal_jsonrpc_error(message, error),
}
}
ToolsOutcome::InvalidParams(message_text) => transport_response(
StatusCode::OK,
jsonrpc_error(request_id(message), -32602, message_text),
response_mode,
None,
Some(&session.protocol_version),
),
ToolsOutcome::CatalogUnavailable => {
internal_jsonrpc_error(message, "published catalog is unavailable")
}
// A list command never produces a call outcome; it is answered with the adapter's
// internal error instead of being silently ignored.
ToolsOutcome::Call(_) => internal_jsonrpc_error(
message,
"unexpected shared tools outcome for a tools/list",
),
}
super::response::sdk_tools_response(
message,
response_mode,
&session.protocol_version,
outcome,
)
}
DispatchDecision::Allowed {
handler: MethodHandler::ToolCall,