Convert custom tool examples to subdirectory/index.ts structure
- hello.ts → hello/index.ts - question.ts → question/index.ts - todo.ts → todo/index.ts - subagent/subagent.ts → subagent/index.ts
This commit is contained in:
20
packages/coding-agent/examples/custom-tools/hello/index.ts
Normal file
20
packages/coding-agent/examples/custom-tools/hello/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import type { CustomToolFactory } from "@mariozechner/pi-coding-agent";
|
||||
|
||||
const factory: CustomToolFactory = (pi) => ({
|
||||
name: "hello",
|
||||
label: "Hello",
|
||||
description: "A simple greeting tool",
|
||||
parameters: Type.Object({
|
||||
name: Type.String({ description: "Name to greet" }),
|
||||
}),
|
||||
|
||||
async execute(toolCallId, params) {
|
||||
return {
|
||||
content: [{ type: "text", text: `Hello, ${params.name}!` }],
|
||||
details: { greeted: params.name },
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export default factory;
|
||||
Reference in New Issue
Block a user