Skip to content

fix(codemode): suggest tools when a namespace is called - #63697

Merged
rekram1-node merged 1 commit into
devfrom
namespace-call-hint
Nov 13, 2026
Merged

rekram1-node merged 1 commit into
devfrom
namespace-call-hint

Conversation

@rekram1-node

Copy link
Copy Markdown
Member

Issue for this PR

Closes #62336

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

In Code Mode, calling a namespace like a tool (tools.issues({})) only said Tool 'issues' is not callable. and the model had to guess what to call instead.

Now the error names up to three real tools under that namespace and says how many more there are, same idea as the suggestions you get when reading a file that doesn't exist:

Tool 'issues' is not callable, it is a namespace. Did you mean tools.issues.issues, tools.issues.archive, or tools.issues.create?
2 more under 'issues'. Use search({ namespace: "issues" }) to list them.

The three are picked with the existing search ranking against the namespace name, so tools.search_skills.search_skills comes first for tools.search_skills(...). It never lists the whole namespace. The error kind is still UnknownTool.

How did you verify your code works?

Added a test in packages/codemode/test/tool-paths.test.ts for a namespace with five tools, and tightened the existing single-tool one. bun test (1641 pass) and bun typecheck in packages/codemode.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works as described. I ran tools.<namespace>({}) through the Code Mode runtime on the base and with this PR, for both a flat namespace and a nested one. The base only says Tool 'X' is not callable., with no suggestions. With the PR, the error names up to three tools from the namespace and counts the rest. The search({ namespace }) command it points to does list them, nested namespaces included. bun test (1641 pass) and tsc --noEmit in packages/codemode are clean.

Public API is unchanged: this only changes the text of a Code Mode diagnostic, and the error kind is still UnknownTool.

No blocking concerns.

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.

Code Mode error "Tool 'X' is not callable" doesn't say how to fix it

1 participant