Files
oh-my-pi/packages/coding-agent/examples/extensions/hello.ts
T
can1357 e9888367d1 refactor: migrated packages to internal utility modules and removed external dependencies
- Implemented in-house, zero-dependency utility modules in `pi-utils` covering DOM manipulation, markdown parsing, templating, browser automation helpers, and terminal buffers.
- Migrated packages across the repository to consume the new internal utilities and `omptype` schema validators instead of external dependencies.
- Removed multiple external runtime and development dependencies including Zod, Marked, LRU cache, Turndown, and Puppeteer browser packages.
2026-08-05 13:39:09 +02:00

32 lines
730 B
TypeScript

/**
* Hello Tool - Minimal custom tool example
*
* Demonstrates using ExtensionAPI's logger and injected schema builder.
*/
import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";
export default function (pi: ExtensionAPI) {
const z = pi.zod;
pi.registerTool({
name: "hello",
label: "Hello",
description: "A simple greeting tool",
parameters: z.object({
name: z.string().describe("Name to greet"),
}),
async execute(_toolCallId, params, _onUpdate, _ctx, _signal) {
const { name } = params;
// Use logger for debugging
pi.logger.debug("Hello tool executed", { name });
return {
content: [{ type: "text", text: `Hello, ${name}!` }],
details: { greeted: name },
};
},
});
}