Skip to content

feat(codemode): name the closest tool in unknown-tool errors - #50455

Merged
rekram1-node merged 1 commit into
v2from
unknown-tool-suggestion
Sep 21, 2026
Merged

rekram1-node merged 1 commit into
v2from
unknown-tool-suggestion

Conversation

@rekram1-node

Copy link
Copy Markdown
Collaborator

What

Calling a tool that does not exist now names the closest real one:

Unknown tool 'github.get-me'. Did you mean tools.github.get_me?
Unknown tool 'github.dependabot_list_alerts'. Did you mean tools.github.list_dependabot_alerts?
Unknown tool 'cloudflare.get_kv_namespaces'. Did you mean tools.cloudflare.get_accounts_storage_kv_namespaces?
Unknown tool 'gitub.get_me'. Did you mean tools.github.get_me?
Unknown tool 'zzz.qqq'.

The guessed name is ranked against the index with the same scorer search uses. When the first segment is a real namespace, the match is scoped to it and the namespace word is dropped from the query, so cloudflare.search does not get pointed at a GitHub tool. The follow-up line is now just "Use search to find available tools."; the old "may have been removed or renamed" was speculation.

Why

In a tool-discovery eval, models occasionally type a plausible name instead of searching (get-me, dependabot_list_alerts, list_starred_repositories_for_authenticated_user, get_user_accounts). The generic error costs a search and another round trip; naming the right tool ends it in one step. All four real examples from the last run resolve correctly.

How

The scoring loop moves out of makeSearchTool into rank(entries, query), used by both search and resolve.

When a model calls a tool that does not exist, the error said only that
it may have been removed or renamed. Rank the guessed name against the
index (scoped to the namespace when that part is real) and name the
best match:

  Unknown tool 'github.get-me'. Did you mean tools.github.get_me?

The ranker moves out of the search tool into rank() so both can use it.
@rekram1-node
rekram1-node merged commit 1e1cd04 into v2 Sep 21, 2026
10 checks passed
@rekram1-node
rekram1-node deleted the unknown-tool-suggestion branch September 21, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant