mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[codex] Support flattened deferred MCP tool calls (#17556)
## Summary - register flattened handler aliases for deferred MCP tools - cover the node_repl-shaped deferred MCP call path in tool registry tests ## Root Cause Deferred MCP tools were registered only under their namespaced handler key, e.g. `mcp__node_repl__:js`. If the model/bridge emitted the flattened qualified name `mcp__node_repl__js`, core parsed it as an MCP payload but dispatch looked up the flattened handler key and returned `unsupported call` before reaching the MCP handler. ## Validation - `just fmt` - `cargo test -p codex-tools search_tool_registers_deferred_mcp_flattened_handlers` - `cargo test -p codex-core search_tool_registers_namespaced_mcp_tool_aliases` - `git diff --check`
This commit is contained in:
committed by
GitHub
Unverified
parent
4db60d5d8b
commit
720932ca3d
@@ -263,6 +263,15 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(deferred_mcp_tools) = deferred_mcp_tools.as_ref() {
|
||||
for (name, _) in deferred_mcp_tools.iter().filter(|(name, _)| {
|
||||
!mcp_tools
|
||||
.as_ref()
|
||||
.is_some_and(|tools| tools.contains_key(*name))
|
||||
}) {
|
||||
builder.register_handler(name.clone(), mcp_handler.clone());
|
||||
}
|
||||
}
|
||||
builder
|
||||
}
|
||||
|
||||
|
||||
@@ -909,6 +909,8 @@ fn search_tool_registers_namespaced_mcp_tool_aliases() {
|
||||
assert!(registry.has_handler(&ToolName::plain(TOOL_SEARCH_TOOL_NAME)));
|
||||
assert!(registry.has_handler(&app_alias));
|
||||
assert!(registry.has_handler(&mcp_alias));
|
||||
assert!(registry.has_handler(&ToolName::plain("mcp__codex_apps__calendar_create_event")));
|
||||
assert!(registry.has_handler(&ToolName::plain("mcp__rmcp__echo")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user