feat(mcp): add tools search <query> for fuzzy tool discovery - #6317
Conversation
Add a `loopover-mcp tools search <query>` subcommand (with `--json`) that fuzzy-matches a query against each registered tool's name and description, so a tool can be found without scrolling the full `tools` listing or knowing its exact name. Ranks name-substring over description-substring over a Levenshtein typo match, reusing the CLI's existing distance helper rather than adding a dependency. Declared in the command spec so completion and the typo-suggester pick it up, and documented in --help. Closes JSONbored#6300
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-16 01:42:01 UTC
Review summary Nits — 5 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
What
Add
loopover-mcp tools search <query>(with--json) so a user or agent can find the right tool amongthe combined local + remote surface without reading the full
toolslisting top to bottom or alreadyknowing the exact name. The query fuzzy-matches against each registered tool's name AND description, so
a term that only appears in a description still surfaces the tool.
Why
tools/tools --jsononly dump every locally-registered stdio tool in registration order — the only wayto find one is to scroll the whole list or know its exact name (confirmed in #6300; no search/filter
existed). Once the local and remote sets are unified into ~150 tools that no longer scales.
How
toolsinto a small dispatcher:tools searchroutes to a newtoolsSearchCommand, and thebare
tools/tools --jsonlisting behaves byte-for-byte as before (its option parsing just movedinside the command).
searchToolsranks matches best-first: a substring hit on the name beats a substring hit on thedescription, which beats a typo-tolerant hit; non-matches are dropped and ties break alphabetically for a
stable listing.
levenshteinDistance(the same utility behindsuggestCommand's "did you mean") instead of adding a fuzzy-match dependency, per the issue's guidance.The edit-distance budget scales with the query length.
--jsonreturns{ query, count, tools }; the human view prints aligned name + description rows, or afriendly
No tools match "<query>".line when nothing matches. Runningtools searchwith no queryprints a usage error.
searchinCLI_COMMAND_SPECso tab-completion (all four shells) and the typo-suggester pickit up, and documented it in
--help. Kept it local-CLI-only — the remote server's tool list stays aseparate concern, as the issue scopes it.
Testing
test/unit/mcp-cli-tools-search.test.tsdrives the real CLI and covers a name match (ranked first),a description-only match (query absent from every tool name), a Levenshtein typo match, a no-match query
(empty
--jsonresult set and the plain "No tools match" line), the human row output, and themissing-query usage error.
npm run typecheck,npm run build:mcp,npm run test:mcp-pack, and the existingtest/unit/mcp-cli-tools.test.ts+test/unit/mcp-cli-completion-spec.test.tssuites — all green.Closes #6300