Skip to content

feat(tools): Rank tool names by action and object, and say when no tool fits - #2903

Merged
dcramer merged 1 commit into
mainfrom
feat/tool-search-name-fields
Nov 7, 2026
Merged

dcramer merged 1 commit into
mainfrom
feat/tool-search-name-fields

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

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.

via @dcramer.

--

View Session [Sentry]

…ol fits

Split each tool name into an action word and object words, and boost tools
whose action and object both match the query. When one tool has the query's
action and another has its object, but no tool has both, return no tools and
a note instead of a guess.

The ranking test now adds a second issue plugin with snake_case tool names,
so it covers overlapping tools from two plugins.

Co-Authored-By: David Cramer <[email protected]>
@vercel

vercel Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 7, 2026 7:57pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

11 screenshot changes — 11 changed · 0 added · 0 removed

Review screenshots in Frameshift

Automation Page · Desktop
Automation Page · Desktop
Changed
Conversation Captured Memories Popover · Desktop
Conversation Captured Memories Popover · Desktop
Changed
Conversation Details Watched Linked Work · Desktop
Conversation Details Watched Linked Work · Desktop
Changed
Conversation Details Watched Linked Work · Mobile
Conversation Details Watched Linked Work · Mobile
Changed
Conversation Fork Dialog · Desktop
Conversation Fork Dialog · Desktop
Changed
Conversation Fork Dialog · Mobile
Conversation Fork Dialog · Mobile
Changed
Show 5 more changed screenshots
Conversation Long Transcript Touch · Mobile
Conversation Long Transcript Touch · Mobile
Changed
Conversation Recalled Memories Popover · Desktop
Conversation Recalled Memories Popover · Desktop
Changed
Conversation Recalled Memories Popover · Mobile
Conversation Recalled Memories Popover · Mobile
Changed
Conversation Stop Active · Mobile
Conversation Stop Active · Mobile
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed

@dcramer
dcramer merged commit b599bd9 into main Nov 7, 2026
49 checks passed
@dcramer
dcramer deleted the feat/tool-search-name-fields branch November 7, 2026 21:14
dcramer added a commit that referenced this pull request Nov 12, 2026
…2904)

Stacked on #2903. Part of #2893.

`searchTools` still ranks by word match first. When the word match is
unclear, the fast model picks from the top 20 candidates. Unclear means:
the best tool's name lacks the query's action and object, the next score
is within 70% of the best, or the #2903 no-fit rule fired. The model
returns up to 3 candidate names, or none. Names that are not candidates
are dropped. A clear winner skips the model.

- A timeout (5s) or a transient provider failure keeps the word match.
Other failures go to the tool call.
- The query and tool text go in the prompt as escaped data.
- Telemetry: `app.tool_search.rerank.*` (TELEMETRY.md "Tool Search").
- About 1,000 input tokens per call at 20 candidates.

Tests: the test architecture check does not allow model fakes in
`packages/junior/tests`. So the ranking tests check the word match and
which queries go to the model, and a clear search runs through
`searchTools` with no model. The new `classifiers` eval
(`tool-search.eval.ts`) runs the model path with the real model.

<!-- 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]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 56d4a023 Deployed Nov 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant