MCP: execute legacy logging through awaited SDK handler
CI / UI Checks (pull_request) Successful in 9s
CI / Rust Checks (pull_request) Successful in 39m38s
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-14 03:11:37 +00:00
1 parent 7aab666aaa
commit 22637861c3
11 files changed
+505 -39

No files matched your search

@@ -31,11 +31,11 @@ use crate::{
auth::VerifiedMachineCredential,
jsonrpc::{LEGACY_PROTOCOL_VERSION, jsonrpc_error, jsonrpc_result, params, request_id},
protocol::{
CompletionCommand, CompletionOutcome, ContinuationSupport, DispatchDecision,
EVENT_LEVEL_APPLIED, INVALID_LEVEL, Kind, LoggingOutcome, MethodHandler, PromptGetCommand,
PromptsCommand, PromptsListCommand, PromptsOutcome, RequestIdentity, ResourceReadCommand,
ResourcesCommand, ResourcesListCommand, ResourcesOutcome, ServiceContext, SetLevelCommand,
ToolCallCommand, ToolsCommand, ToolsListCommand, handle_logging_command,
CompletionCommand, CompletionOutcome, ContinuationSupport, DispatchDecision, INVALID_LEVEL,
Kind, MethodHandler, PromptGetCommand, PromptsCommand, PromptsListCommand, PromptsOutcome,
RequestIdentity, ResourceReadCommand, ResourcesCommand, ResourcesListCommand,
ResourcesOutcome, ServiceContext, SetLevelCommand, ToolCallCommand, ToolsCommand,
ToolsListCommand,
},
tool_error::execution_locale,
transport::{ResponseMode, session_id_from_headers, transport_response},
@@ -727,30 +727,23 @@ pub(super) async fn handle_legacy_request(
);
}
};
match handle_logging_command(&state.logging_levels, &session.id, command) {
LoggingOutcome::Applied(level) => {
crate::protocol::set_active_level(Some(level));
crate::protocol::note(
crate::protocol::LogLevel::Notice,
EVENT_LEVEL_APPLIED,
"applied",
);
transport_response(
StatusCode::OK,
jsonrpc_result(request_id(message), json!({})),
let request = match command.validate() {
Ok(request) => request,
Err(detail) => {
return super::dispatch::sdk_error_response(
message,
response_mode,
None,
Some(&session.protocol_version),
)
&session.protocol_version,
rmcp::ErrorData::invalid_params(detail, None),
);
}
LoggingOutcome::InvalidParams(detail) => transport_response(
StatusCode::OK,
jsonrpc_error(request_id(message), -32602, detail),
response_mode,
None,
Some(&session.protocol_version),
),
}
};
super::rmcp_logging::response(
message,
response_mode,
&session.protocol_version,
super::rmcp_logging::set_level(&state, &session.id, request).await,
)
}
// A notification whose method the registration does not map to this adapter's handlers is
// acknowledged without being dispatched, exactly as before.