项目文件夹

文件
2026-07-13 12:22:59 +08:00

21 行
500 B
TypeScript

import type { CustomToolFactory } from "@oh-my-pi/pi-coding-agent";
const factory: CustomToolFactory = pi => ({
name: "hello",
label: "Hello",
description: "A simple greeting tool",
parameters: pi.zod.object({
name: pi.zod.string().describe("Name to greet"),
}),
async execute(_toolCallId, params, _onUpdate, _ctx, _signal) {
const { name } = params;
return {
content: [{ type: "text", text: `Hello, ${name}!` }],
details: { greeted: name },
};
},
});
export default factory;