feat(mcp): add index routing to search-records (RAAE-1606)#631
Draft
vishal-bala wants to merge 1 commit into
Draft
feat(mcp): add index routing to search-records (RAAE-1606)#631vishal-bala wants to merge 1 commit into
vishal-bala wants to merge 1 commit into
Conversation
Add an optional `index` argument to the search-records tool so a single multi-binding MCP server can target a specific logical index. The argument is optional when exactly one binding is configured (preserving single-index behavior) and resolves through the same resolve_binding routing used elsewhere, so an omitted index on a multi-binding server and unknown ids both surface as invalid_request. The resolved logical id is echoed back as the `index` field in the response. - Expose `index` on the FastMCP wrapper param list. - Append a routing note to the tool description when the schema is ambiguous (multiple bindings) directing clients to call list-indexes first. - Add unit + integration coverage for routing, omitted-index rejection, unknown ids, and single-binding backward compatibility. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
This was referenced Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
With a single MCP server now able to expose multiple logical index bindings (RAAE-1604) and advertise them via
list-indexes(RAAE-1605), thesearch-recordstool still implicitly resolved the sole binding. On a multi-binding server it had no way to say which index a query should run against. This change (RAAE-1606) makes that routing explicit while keeping the public contract backwards-safe for existing single-index callers.The design goal is that v1 clients see no behavioral change: when exactly one binding is configured and the caller omits
index, the request resolves to that binding exactly as before. Routing only becomes mandatory once ambiguity exists. Query construction, validation, pagination, filtering, and the configured search mode all remain owned by the selected binding — this ticket adds only the selection and a confirmation echo, not new query behavior.Implemented changes
search-recordsgains an optionalindexargument naming the logical binding to query. Resolution flows through the sharedresolve_bindingrouting introduced in RAAE-1604, so the three cases fall out consistently: an omittedindexwith one binding resolves to that binding; an omittedindexwith multiple bindings returnsinvalid_request; and an unknown id returnsinvalid_request. The resolved logical id is echoed back as theindexfield of the response payload so multi-index clients can confirm where a query actually ran. All downstream work (limits, schema, vectorizer, search config) continues to read from the resolved binding's runtime.When multiple bindings are configured the tool description is ambiguous about fields, so instead of emitting per-field filter hints it now appends a short routing note directing the client to call
list-indexesfirst and pass the chosen id asindex. Single-binding servers keep their full schema-derived description unchanged.Minor additional changes:
indexas a tool parameter so MCP clients can supply it.Verification
make format(isort + black) and mypy clean on changed files.Stacking
This PR targets
feature/raae-1605-list-indexesso its diff stays scoped to search routing. Review/merge bottom-up: #629 → #630 → this PR.🤖 Generated with Claude Code