docs: rewrite sdk-migration and bundles, fold agent-tools into building-plugins, remove cookbook from nav, remove dead WeChat listing

This commit is contained in:
Vincent Koc
2026-03-20 11:32:11 -07:00
parent 2e0b445b46
commit 483926a6fb
6 changed files with 247 additions and 433 deletions

View File

@@ -285,6 +285,58 @@ my-plugin/
</Step>
</Steps>
## Registering agent tools
Plugins can register **agent tools** — typed functions the LLM can call. Tools
can be required (always available) or optional (users opt in via allowlists).
```typescript
import { Type } from "@sinclair/typebox";
export default definePluginEntry({
id: "my-plugin",
name: "My Plugin",
register(api) {
// Required tool (always available)
api.registerTool({
name: "my_tool",
description: "Do a thing",
parameters: Type.Object({ input: Type.String() }),
async execute(_id, params) {
return { content: [{ type: "text", text: params.input }] };
},
});
// Optional tool (user must add to allowlist)
api.registerTool(
{
name: "workflow_tool",
description: "Run a workflow",
parameters: Type.Object({ pipeline: Type.String() }),
async execute(_id, params) {
return { content: [{ type: "text", text: params.pipeline }] };
},
},
{ optional: true },
);
},
});
```
Enable optional tools in config:
```json5
{
tools: { allow: ["workflow_tool"] },
}
```
Tips:
- Tool names must not clash with core tool names (conflicts are skipped)
- Use `optional: true` for tools that trigger side effects or require extra binaries
- Users can enable all tools from a plugin by adding the plugin id to `tools.allow`
## Lint enforcement (in-repo plugins)
Three scripts enforce SDK boundaries for plugins in the OpenClaw repository: