Skip to content

Think: opt-in deferred tool discovery for ordinary tool calls across providers #2277

Description

@yu2001-s

Problem

We use Think with ordinary structured tool calls in a native application. Our current integration has 16 enabled tools, including application data operations, skills, history and web tools. We want to add integrations without including every tool's full input schema in every model request.

We can assemble a filtered tool set ourselves today. The missing convenience is an opt-in, first-class discovery mechanism that works with ordinary tool calls across providers, without requiring model-generated code or a provider-specific tool-search API.

Consumer versions: @cloudflare/think@0.18.0, agents@0.23.0.

Requested behavior

  • Allow application and MCP tools to be registered as deferred, with a compact name/description catalog or a searchable catalog handle.
  • Expose a discovery tool that selects relevant tools and makes their full schemas available on a subsequent model step. Unselected schemas should remain outside the model request.
  • Execute selected tools through the normal Think tool lifecycle, preserving validation, authorization, approvals where applicable, and tool-call/result events.
  • Keep discovery scoped to the tools the current turn is authorized to use; discovery must not grant additional permissions.
  • Document activation lifetime and recovery behavior. A resumed turn should reconstruct the appropriate tool set, with authorization rechecked at execution.

The exact API and search strategy are open; an application-supplied search callback would be sufficient for an initial implementation.

Existing mechanisms and related work

Code Mode already offers discovery for code execution. We are specifically requesting the ordinary structured-tool-call path, including application tools that need their own lifecycle and UI status.

#1336 requests control over MCP auto-registration so consumers can implement their own search/execute pattern. This request is for the discovery and deferred schema activation layer itself, covering application tools as well as MCP tools. It does not request another auto-registration switch.

#1121 concerns Code Mode discovery/type emission, and #1938 concerns eager MCP schema conversion and memory use. This is not a report of either bug.

Suggested acceptance test

With a synthetic catalog of 100 deferred tools, inspect the actual model request payload: the first request should contain only discovery and explicitly eager tools, not all 100 schemas. After selecting one deferred tool, the next request should expose that tool and execute it through the normal hooks. Repeat with two ordinary tool-calling model adapters, and verify that an unauthorized tool cannot be discovered or executed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions