ToolDefinition
The ToolDefinition interface from @mariozechner/pi-coding-agent defines a custom tool that an agent can invoke.
Interface
Execute Signature
Return Value
Parameter Schemas
Tools use @sinclair/typebox (NOT Zod) for parameter definitions:
Minimal Example
With Confirmation
For dangerous operations, accept a waitForConfirmation callback:
See Chapter 05: Confirmation Pattern for the full pattern.
Registering Tools
Pass custom tools to createAgentSession():
Tool Events
When a tool executes, the session emits events you can observe:
See Chapter 03: Custom Tools for a complete walkthrough.