Skip to content

feat(tools): promote discovered tools only on execute - #1226

Merged
TheGreatAxios merged 3 commits into
mainfrom
cl-9488-cap-tool_search-at-a-handful-35-with-an-overridable-limit
Sep 29, 2026
Merged

TheGreatAxios merged 3 commits into
mainfrom
cl-9488-cap-tool_search-at-a-handful-35-with-an-overridable-limit

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • tool_search returns name + description cards only and does not grow the advertised tool set.
  • A call to a registered-but-unadvertised tool declares that one name, then dispatches, so strict providers see the schema before the call runs.
  • Fold drops execute-promoted schemas back to the frozen core prefix (pruneIdlePromotions).

Verification

  • bun test src/agent/tool-search.test.ts src/tui/dynamic-tool-runner.test.ts src/exec/runner.test.ts src/session/assemble-runtime.test.ts src/tui/mcp-view.test.ts — 139 pass, 0 fail
  • bun run typecheck — exit 0
  • pre-commit typecheck + build passed on commit

Fixes CL-9488

@linear-code

linear-code Bot commented Sep 29, 2026

Copy link
Copy Markdown

CL-9488

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review

Contracts hold: tool_search is cards-only, promote-on-execute declares a single called name, optional limit defaults to 5 (cap 20), core/pinned prefix stays frozen. No blocking defects.

Should-fix

list_dir is in UNADVERTISED_MOUNTED_BUILTINS (search still hides it; “use glob”). The new intercept promotes any registered unadvertised name, so a model that emits list_dir flushes that schema onto the wire until fold. Fix in the intercept/promoter (refuse or dispatch without flushPromotions), not in search.

Nits

  • src/tui/runner/mcp.ts still says MCP tools stay blind until tool_search promotes them.
  • Numeric-string limit: "8" silently falls back to 5 (arktype fail → default).

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review (32bedf8a)

Shippable. list_dir stays off computeAdvertised on execute and still dispatches. MCP promote-on-execute remains single-name. No blocking defects.

Intercept, exec promoter, and flushPromotions all refuse UNADVERTISED_MOUNTED_BUILTINS. Targeted tests 128 pass.

File-for-later (pre-existing, not this commit): closed exec overlays that pass BUILD_TOOLS as builtInPrefix can still project list_dir onto the wire without execute.

Search returns cards only. A call declares that one name, then dispatches.
Promote-on-execute flushed any registered unadvertised name, so a
list_dir call put its schema on the wire until fold. Search already
hides that builtin in favor of glob; dispatch it without advertising.
@TheGreatAxios
TheGreatAxios force-pushed the cl-9488-cap-tool_search-at-a-handful-35-with-an-overridable-limit branch from 32bedf8 to d677b90 Compare September 29, 2026 23:14
Search no longer grows the advertised set. The late-dispatch harness
now uses the same call-gate promoter as TUI and exec so schemas land
on the next infer.
@TheGreatAxios
TheGreatAxios merged commit 4bbd78c into main Sep 29, 2026
13 checks passed
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