Repository navigation
fix(server): canonicalize retrieve_tools identity to server:tool - #874
Conversation
Discovery stores tools with a BARE name (ToolMetadata{ServerName:"github",
Name:"create_issue"}), which bleve persisted verbatim as full_tool_name and
returned unchanged from SearchTools / GetToolsByServer. retrieve_tools then
emitted that bare id, but describe_tool and call_tool_* require the
"<server>:<tool>" form — so the exact id retrieve_tools returned could not be
fed back into either.
Add canonicalToolName(serverName, name) and apply it at the two index READ
seams (SearchTools hit conversion, GetToolsByServer). The write path and stored
docs are untouched. A mandatory double-prefix guard leaves already-prefixed
legacy/fixture names unchanged, and profile rebuilds that re-index a canonical
name round-trip cleanly.
Companion fix: lookupToolAnnotations now normalizes its input via
normalizeServerTool. With Name canonical and ServerName set, the full entry
builder and annotation-filter loop pass a prefixed name into the lookup, whose
live StateView tool names are bare — without normalization the match would miss,
dropping annotations and degrading call_with back to call_tool_read (#306).
Tests: index read-seam canonicalization + double-prefix guard; live-path
annotation resolution through a real StateView; retrieve_tools -> describe_tool
round-trip on the bare-index bug path. Updated the quarantine config-apply E2E
to the canonical-id contract (its bare-name checks passed only vacuously).
Deploying mcpproxy-docs with
|
| Latest commit: |
68abe59
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://561a29e3.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://fix-871-canonical-tool-ids.mcpproxy-docs.pages.dev |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 29824535453 --repo smart-mcp-proxy/mcpproxy-go
|
The #871 canonicalization of tool identity to "server:tool" at the index read seams is correct for the MCP discovery surface, but it leaked into the REST GET /api/v1/index/search response, whose name field has always been the bare tool name with server_name reported separately. External consumers (the D1 retrieval-regression scorer) assemble the id themselves, so a prefixed name double-prefixes (git:git:git_log) and drops recall@5 to 0. Strip the server prefix at the httpapi conversion seam only; the MCP surface stays canonical. Add a regression test pinning the REST bare-name contract and revert the E2E expectations that were flipped to canonical on this branch.
|
Cross-model review (Codex 0.144.6 / gpt-5.6-sol): ACCEPT in round 1, no findings. CI: all checks green except |
Fixes #871
retrieve_toolsreturned the bare indexed tool name (echo) whiledescribe_tool/call_tool_*requireserver:tool— breaking the spec-085 progressive-disclosure round-trip for every live-indexed tool (compact mode was unrecoverable: no server field).Change
SearchTools,GetToolsByServerininternal/index/bleve.go) viacanonicalToolNamewith a double-prefix guard. Stored docs unchanged — works on existing indexes.lookupToolAnnotationsnow normalizes its input (central fix inmcp_visibility.go), so annotations/call_withderivation keeps working with canonical names — without this, canonicalization would silently regress retrieve_tools: annotations/call_with always defaults to call_tool_read due to tool name parsing bug #306 (annotations dropped,call_withdegrading tocall_tool_read).include_statsusage lookup keys match how usage is recorded; disabled/locked entry names consistent with the quarantine pass.Verification
server-everythingupstream): compact id and full name noweverything:echo;describe_tool/call_tool_readaccept the exact returned id; annotations/call_withverified intact across 6 tools;include_statspopulated.go test -racegreen, 65/65 API E2E green, golangci-lint v2 clean.Note: while updating
TestE2E_QuarantineConfigApplywe noticed a pre-existing gap (not introduced here):/api/v1/index/searchapplies no quarantine filtering. Will file separately.Draft: @neylwalecki mentioned having a patch for this — happy to reconcile.