feat(mcp): expose plain query parameter for auto-expand search#432
Open
feat(mcp): expose plain query parameter for auto-expand search#432
Conversation
af034b0 to
75ec25f
Compare
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.
Problem
The SDK
search()method accepts eitherquery(plain string → auto-expanded by the trained model) orqueries(pre-expanded typed sub-queries). The CLIqmd query "text"uses thequerypath, triggering the full pipeline: expansion → parallel BM25 + vector → RRF → reranking.However, the MCP
querytool only exposes thequeriespath via thesearchesparameter. There is no way to send a plain text query through MCP and get the full auto-expand pipeline.The tool description Strategy table even says: "Unknown vocabulary | Use a standalone natural-language query (no typed lines) so the server can auto-expand it" — but the tool schema doesn't accept a standalone query.
Fix
Add an optional
querystring parameter to the MCPquerytool. When provided, route tostore.search({ query })which callshybridQuery()with auto-expansion.queryandsearchesare mutually exclusive — providing both returns an error.The
searchesparameter is made optional (was required). Validation ensures at least one ofqueryorsearchesis provided.Tool description Strategy table updated to recommend
queryas the default approach.Testing
Built and tested locally against a 7,791 document index:
query: "how does authentication work"(cold)query: "how does authentication work"(warm)query: "DEC-0054 sub-agent spawn protocol"searches: [{type: "lex", query: "\"DEC-0054\""}]searches: [{type: "vec", query: "..."}]Existing
searchesparameter works identically to before — no breaking changes.Environment