import {tool, ToolResult} from "@opencode-ai/plugin"; export const add = tool({ description: "Add two numbers", args: { a: tool.schema.number().describe("First number"), b: tool.schema.number().describe("Second number"), }, async execute(args) { return `${args.a + args.b}`; }, }); export const multiply = tool({ description: "Multiply two numbers", args: { a: tool.schema.number().describe("First number"), b: tool.schema.number().describe("Second number"), }, async execute(args) { return `${args.a * args.b}`; }, }); interface IpResponse { status: number; message: string; ip: string; userAgent: string; } export const get_my_ip = tool({ description: "Get my IP", args: {}, async execute(args): Promise { const ipResp = await fetch("https://hatter.ink/ip/ip.jsonp"); const ipResponse = await ipResp.json() as IpResponse; return ipResponse.ip; }, });