Files
skills-template/tool/math.ts
2026-01-11 01:10:38 +08:00

25 lines
601 B
TypeScript

import { tool } from "@opencode-ai/plugin"
export const add = tool({
description: "两个数字相加",
args: {
a: tool.schema.number().describe("第一个数字"),
b: tool.schema.number().describe("第二个数字"),
},
async execute(args) {
const end = args.a + args.b
return end + ""
},
})
export const multiply = tool({
description: "两个数字相乘",
args: {
a: tool.schema.number().describe("第一个数字"),
b: tool.schema.number().describe("第二个数字"),
},
async execute(args) {
const end = args.a * args.b
return end + ""
},
})