MCP: execute legacy notifications through SDK handlers
CI / UI Checks (pull_request) Successful in 9s
CI / Rust Checks (pull_request) Successful in 40m6s
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 00:00:27 +00:00
1 parent 986cd78b96
commit fd76aaf676
10 files changed
+735 -52

No files matched your search

@@ -1,31 +1,11 @@
//! Lossless projection of legacy cancellation targets through the pinned SDK.
use rmcp::model::CancelledNotificationParam;
use serde_json::{Map, Value};
//! Test compatibility entry for the production notification decoder.
use serde_json::Value;
pub(super) fn decode_cancelled_request_id(params: &Value) -> Option<Value> {
let mut projection = Map::new();
let original_id = params.get("requestId");
if let Some(id) = original_id {
// SDK IDs use i64; the temporary string never reaches the in-flight lookup.
let projected = match id {
Value::Number(number) if number.as_i64().is_none() => Value::String(number.to_string()),
_ => id.clone(),
};
projection.insert("requestId".to_owned(), projected);
}
// Only requestId names a target; reason, _meta and extensions retain their ignore semantics.
let decoded =
serde_json::from_value::<CancelledNotificationParam>(Value::Object(projection)).ok()?;
#[cfg(test)]
super::dispatch_observer::sdk_cancelled_params_decoded();
let id = decoded.request_id?;
Some(match original_id {
Some(Value::Number(number)) => Value::Number(number.clone()),
_ => id.into_json_value(),
})
let (typed, raw_number) = super::rmcp_notifications::cancelled_params(params)?;
let id = typed.request_id?;
Some(raw_number.unwrap_or_else(|| id.into_json_value()))
}
#[cfg(test)]
#[path = "rmcp_progress_cancel_tests.rs"]
mod tests;