cloudflare / cloudflare/agents
Support codemode-only exposure for Think extension tools
- Dominant language
- TypeScript
- Stars
- 5.6k
- Forks
- 711
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 53
Description
Think currently automatically merges loaded extension tools into the top-level tool set:
```ts
const extensionTools = this.extensionManager?.getTools() ?? {}
```
In some applications, it would be useful to expose extension tools only inside `execute` / codemode instead of making them directly callable as top-level tools.
Example desired usage:
```ts
execute: createExecuteTool({
ctx: this.ctx,
tools: {
...domainTools,
...extensionManager.getTools(),
},
})
```
This makes dynamically loaded extensions behave more like a programmable plugin library: the model calls them through codemode when composing code, without expanding the top-level tool space for every turn.
Could Think provide an official way to control extension tool exposure, for example:
```ts
extensionToolExposure: "top-level" | "codemode" | "both" | "manual"
```
or a simpler opt-out:
```ts
exposeExtensionToolsAsTopLevel: false
```
The default could stay unchanged for compatibility.
Motivation:
- reduce top-level tool count
- prevent dynamic extensions from bloating the tool space
- encourage composing extension capabilities through code
- let applications decide where extension tools are exposed
Contributor guide
Assessment
This issue has not been assessed yet.