2025-08-03 06:50:19 +08:00
|
|
|
import { Plugin } from "./index"
|
2025-09-18 15:58:21 +08:00
|
|
|
import { tool } from "./tool"
|
2025-08-03 06:50:19 +08:00
|
|
|
|
2025-09-18 15:58:21 +08:00
|
|
|
export const ExamplePlugin: Plugin = async (ctx) => {
|
2025-08-03 06:50:19 +08:00
|
|
|
return {
|
2025-09-18 15:58:21 +08:00
|
|
|
tool: {
|
2025-09-18 17:42:59 +08:00
|
|
|
mytool: tool({
|
2025-11-01 03:07:36 +08:00
|
|
|
description: "This is a custom tool",
|
2025-09-18 15:58:21 +08:00
|
|
|
args: {
|
2025-09-18 17:42:59 +08:00
|
|
|
foo: tool.schema.string().describe("foo"),
|
2025-09-18 15:58:21 +08:00
|
|
|
},
|
2025-09-18 17:42:59 +08:00
|
|
|
async execute(args) {
|
2025-09-18 15:58:21 +08:00
|
|
|
return `Hello ${args.foo}!`
|
|
|
|
|
},
|
2025-09-18 17:42:59 +08:00
|
|
|
}),
|
2025-09-18 15:58:21 +08:00
|
|
|
},
|
2025-08-03 06:50:19 +08:00
|
|
|
}
|
|
|
|
|
}
|