update
This commit is contained in:
25
tool/math.ts
Normal file
25
tool/math.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
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 + ""
|
||||
},
|
||||
})
|
||||
11
tool/project.ts
Normal file
11
tool/project.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { tool } from "@opencode-ai/plugin"
|
||||
|
||||
export default tool({
|
||||
description: "获取当前会话信息",
|
||||
args: {},
|
||||
async execute(args, context) {
|
||||
// Access context information
|
||||
const { agent, sessionID, messageID } = context
|
||||
return `智能体: ${agent}, 会话ID: ${sessionID}, 消息ID: ${messageID}`
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user