example.ts 390 B

123456789101112131415161718
  1. import { Plugin } from "./index"
  2. import { tool } from "./tool"
  3. export const ExamplePlugin: Plugin = async (ctx) => {
  4. return {
  5. tool: {
  6. mytool: tool({
  7. description: "This is a custom tool",
  8. args: {
  9. foo: tool.schema.string().describe("foo"),
  10. },
  11. async execute(args) {
  12. return `Hello ${args.foo}!`
  13. },
  14. }),
  15. },
  16. }
  17. }