opencode creating tools

We can easily extend opencode to support custom tools and plugins. We will cover plugin which is essentially npm packages you publish. 

To create a custom tools, we create a folder called ".opencode/tools/hello.ts and in this file we have the following code. 

hello.ts

import { tool } from "@opencode-ai/plugin"

export const sayhello = tool({
  description: "say hello multiple times",
  args: {
     name: tool.schema.string().describe("Name to greet")
  },
  async execute(args) {
    return `Hello, ${args.name}! Hello again, ${args.name}!`
  },
})  

Next, fire opencode and then you can start to use it and you will get the following output. This is just an example.







Comments

Popular posts from this blog

mongosh install properly

gemini cli getting file not defined error

vllm : Failed to infer device type