Download packages/coding-agent/examples/extensions/hello.ts from SaylorTwift/pi: direct link, hf CLI and curl.
- Browser
- Download file 640 Bytes
-
https://huggingface.co/SaylorTwift/pi/resolve/main/packages/coding-agent/examples/extensions/hello.ts
- Command line
-
hf download hf://SaylorTwift/pi/packages/coding-agent/examples/extensions/hello.ts
-
curl -L -o hello.ts https://huggingface.co/SaylorTwift/pi/resolve/main/packages/coding-agent/examples/extensions/hello.ts
640 Bytes
| /** | |
| * Hello Tool - Minimal custom tool example | |
| */ | |
| import { Type } from "@earendil-works/pi-ai"; | |
| import { defineTool, type ExtensionAPI } from "@earendil-works/pi-coding-agent"; | |
| const helloTool = defineTool({ | |
| name: "hello", | |
| label: "Hello", | |
| description: "A simple greeting tool", | |
| parameters: Type.Object({ | |
| name: Type.String({ description: "Name to greet" }), | |
| }), | |
| async execute(_toolCallId, params, _signal, _onUpdate, _ctx) { | |
| return { | |
| content: [{ type: "text", text: `Hello, ${params.name}!` }], | |
| details: { greeted: params.name }, | |
| }; | |
| }, | |
| }); | |
| export default function (pi: ExtensionAPI) { | |
| pi.registerTool(helloTool); | |
| } | |