mcp ui collision fixes: route resource reads by origin call

This commit is contained in:
Drew Schuster
2026-07-06 16:41:55 -07:00
committed by fbauer
parent 9732b406e7
commit 247fd27ba8
13 changed files with 777 additions and 10 deletions
@@ -1938,6 +1938,7 @@ mod tests {
thread_id: Some("thread-1".to_string()),
server: "server-a".to_string(),
uri: "file:///tmp/resource".to_string(),
origin_call_id: None,
},
};
assert_eq!(
@@ -2116,6 +2117,7 @@ mod tests {
thread_id: None,
server: "server-a".to_string(),
uri: "file:///tmp/resource".to_string(),
origin_call_id: None,
},
};
assert_eq!(mcp_resource_read.serialization_scope(), None);
@@ -85,6 +85,9 @@ pub struct McpResourceReadParams {
pub thread_id: Option<String>,
pub server: String,
pub uri: String,
/// The MCP tool call whose app context identifies the resource provider. Requires `threadId`.
#[ts(optional = nullable)]
pub origin_call_id: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
@@ -72,6 +72,19 @@ fn test_absolute_path() -> AbsolutePathBuf {
absolute_path("readable")
}
#[test]
fn mcp_resource_read_params_deserialize_origin_call_id() {
let params: McpResourceReadParams = serde_json::from_value(json!({
"threadId": "thread-123",
"server": "codex_apps",
"uri": "test://codex/resource",
"originCallId": "call-123",
}))
.expect("deserialize resource read params");
assert_eq!(params.origin_call_id.as_deref(), Some("call-123"));
}
#[test]
fn thread_sources_round_trip_as_scalar_labels() {
for (source, label) in [