fix(stage): match tool semantics by bare MCP tool name - #831
Conversation
Stage `tool_semantics` now match MCP tools by their bare tool name. For example, `mutate = ["send_payment_request"]` now matches:
- A Codex Responses call with `"name": "send_payment_request", "namespace": "mcp__billing"`.
- A Claude Code call named `mcp__billing__send_payment_request`.
The full name `mcp__billing__send_payment_request` still matches both. The full name is checked first, and the bare name only when the full name matches nothing.
Changes:
1. `libsy` finds the bare name in one of two ways:
- Codex: from the namespace mapping that the Responses decoder stores on the request.
- Claude Code: from the `mcp__<server>__<tool>` form. The name is split once, after the server name, so tool names that contain `__` still work.
2. The namespace key and its two read helpers (`tool_namespaces`, `split_qualified_name`) move from `switchyard-translation` into a new `switchyard_protocol::codex_namespaces` module. This lets `libsy` read the mapping without depending on
`switchyard-translation`.
Fixes: https://linear.app/nvidia/issue/SWITCH-1456
Assisted-by: Claude:Opus 5.5 medium
Signed-off-by: Graham King <grahamk@nvidia.com>
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: NVIDIA-NeMo/Switchyard/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review. WalkthroughTool-signal extraction now matches configured semantics against bare names from namespaced and MCP-prefixed tool calls when the original name is unknown. Codex namespace helpers are exposed from the protocol crate, and translation code reuses them. ChangesTool semantic matching
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to Unmapped Claude MCP calls with a server name containing 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 5 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
A rabbit checks the tool names in a row Comment |
|
Do you think we should add a normalizer for all tool calls by defining at internal IR? |
I looked into it you kind of already have that with |
Stage
tool_semanticsnow match MCP tools by their bare tool name. For example,mutate = ["send_payment_request"]now matches:"name": "send_payment_request", "namespace": "mcp__billing".mcp__billing__send_payment_request.The full name
mcp__billing__send_payment_requeststill matches both. The full name is checked first, and the bare name only when the full name matches nothing.Changes:
libsyfinds the bare name in one of two ways:mcp__<server>__<tool>form. The name is split once, after the server name, so tool names that contain__still work.tool_namespaces,split_qualified_name) move fromswitchyard-translationinto a newswitchyard_protocol::codex_namespacesmodule. This letslibsyread the mapping without depending onswitchyard-translation.Fixes: https://linear.app/nvidia/issue/SWITCH-1456
Assisted-by: Claude:Opus 5.5 medium
Signed-off-by: Graham King grahamk@nvidia.com
Summary by CodeRabbit
New Features
mcp__server__tooland still resolve the underlying tool when appropriate.Bug Fixes
Documentation