Repository navigation
feat(tools): Improve tool search ranking with stemming, synonyms, and a ranking test - #2898
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
8 screenshot changes — 8 changed · 0 added · 0 removed Review screenshots in Frameshift |
…earch Fold -ed, -ing, and a final e so "closing" matches "closed". Use a weaker BM25 length penalty on tool descriptions, because long descriptions add usage guidance, not topics. Add a ranking test over the real catalog of core tools plus the GitHub and memory plugins. Refs #2893 Co-Authored-By: David Cramer <[email protected]>
Treat common action words such as fetch/get, edit/update, and reply/comment as one BM25 term with a 0.6 weight for the synonym, as Lucene's SynonymQuery does. Expand pr, repo, and msg in queries. Refs #2893 Co-Authored-By: David Cramer <[email protected]>
Field weights make most term frequencies saturate, so a weight applied to term frequency gave a synonym match the same score as an exact match. "add a comment to an issue" nearly tied commentOnIssue with createIssue (add -> create), and the catalog on main flipped it. Refs #2893
sentry-junior
Bot
force-pushed
the
feat/tool-search-ranking-cases
branch
from
November 7, 2026 19:22
5d85321 to
d4677d2
Compare
dcramer
approved these changes
Nov 7, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d4677d2. Configure here.
…ch ranking A description such as "For issues, use github_commentOnIssue" made github_commentOnPullRequest match issue queries. Ranking now skips description sentences that name another catalog tool.
Stemming folds the noun "files" onto the verb "file", so file queries expanded to create, add, and write.
dcramer
added a commit
that referenced
this pull request
Nov 7, 2026
…ol fits (#2903) Next step on #2893, after #2898. **Action and object from tool names.** `searchTools` splits each tool name (camelCase or snake_case, without the source prefix) into an action word and object words: `commentOnIssue` and `create_issue` give "comment"/"create" and "issue". When the query matches the action (synonyms count) and the object, the score goes up by as much as 2x. This works for any plugin or MCP tool, and plugins don't need to add anything. **No guess when nothing fits.** If one tool has the query's action and another has its object, but no tool has both, search returns no tools and a `note`. "create repository" used to return `createIssue`. Any empty search now has the note. **Crowded ranking test.** It adds a fake `tracker` plugin with `create_issue`, `get_issue` and `comment_on_issue`, set up through the real plugin wiring. The new cases check: - with `source`, the right plugin's tool ranks first - without `source`, a provider name in the query picks the tool - without either, the GitHub and Tracker tools tie for the top 2 The two-step source selection planned next should fix that last case. | Query | Before | After | | --- | --- | --- | | "create repository" (github) | `createIssue` | nothing + note | | "create repository" (any source) | `createIssue`, `tracker_create_issue`, … | nothing + note | | "edit a memory" (any source) | `createMemory` | nothing + note | | "get pull request diff" (github) | `submitPullRequestReview` | `getPullRequest` | All new cases come from tool descriptions. <!-- junior-request-attribution:start --> via @dcramer. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Ac153e1c8612191d35fbd9fa76faa8da2 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Ac153e1c8612191d35fbd9fa76faa8da2) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Ac153e1c8612191d35fbd9fa76faa8da2/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
23 tasks done
This branch was successfully deployed
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.

Part of #2893: adds the ranking test from recommendation 6, plus ranking fixes.
Ranking test.
tool-search-ranking.test.tsbuilds the real catalog: core tools plus the GitHub and memory plugins, throughcreateAppandcreatePiAgentTools. 31 queries must rank the fitting tool first, and 2 queries with no fitting tool must return nothing. The queries are written from the tool descriptions. Each test compares its whole table, so one failure shows every query that regressed.Ranking fixes:
-ed,-ing, and a finale, on both the query and the tool text. Before this, "closing a pull request" rankedgetPullRequestfirst and "closing an issue" rankedcreateIssuefirst, because the update tools say "closed".b = 0.3; the other fields keep 0.75). Long descriptions add usage guidance, not topics. Before this, "remember something" rankedlistMemoriesabovecreateMemoryonly because thecreateMemorydescription is long.pr,repo, andmsg. Tool text is not expanded, because most GitHub tools have arepoparameter.The test fails on main and passes with this change. The related search, adapter, and Code Mode tests pass.
Known gaps:
createIssue. A cutoff on the share of the query that a tool matches did not help. Any threshold that dropped the weak matches also dropped correct ones.createMemoryabovelistMemories. Stop words reduce it to "remember", so either tool can be right.Refs #2893
via @dcramer.
--
View Session [Sentry]