Other
API items not yet assigned to a domain. These need to be categorized.
import Pillar from '@pillar-ai/sdk'
Methods
Pillar.getTools()
Get all registered tools for debugging. Returns tools from all sources: defineTool(), registerTool(), and onTask() handlers. Only available when debug mode is enabled.
getTools(): ToolInfo[]
Returns
ToolInfo[]Pillar.executeToolForDebug()
Execute a tool by name for debugging purposes. Only available when debug mode is enabled.
executeToolForDebug(toolName: string, input: Record<string, unknown>): Promise<{ success: boolean; result?: unknown; error?: string }>
Parameters
toolNameinputReturns
Promise<{ success: boolean; result?: unknown; error?: string }>Pillar.defineTool()
Define a tool with co-located metadata and handler. This is the recommended way to register tools. The metadata (name, description, inputSchema) is discoverable by the CLI scanner (`npx pillar-sync --scan ./src`) and the handler runs client-side. If `execute` returns a value, it is automatically sent back to the agent — no explicit `returns: true` flag needed.
defineTool(schema: ToolSchema<TInput>): () => void
Parameters
schemaReturns
() => voidPillar.registerTool()
Register a tool definition at runtime.
registerTool(tool: { name: string } & Record<string, unknown>): void
Parameters
toolPillar.getRegisteredTool()
Get a registered tool definition by name.
getRegisteredTool(name: string): Record<string, unknown> | undefined
Parameters
nameReturns
Record<string, unknown> | undefinedPillar.completeTool()
Signal that a tool has completed. For simple tools, this emits the completion event. For wizard tools (modals, multi-step flows), call this when the user finishes the flow.
completeTool(toolName: string, success?: boolean, data?: Record<string, unknown>): Promise<void>
Parameters
toolNamesuccessdataReturns
Promise<void>Pillar.sendToolResult()
Send tool result back to the agent. Called automatically for tools with `returns: true` after their handler completes. The result is sent to the agent for further reasoning.
sendToolResult(toolName: string, result: unknown, toolCallId?: string): Promise<void>
Parameters
toolNameresulttoolCallIdReturns
Promise<void>Pillar.executeQueryTool()
Execute a query tool and send the result back to the agent. This is called when the agent sends a `query_request` event. Query tools are expected to return data that the agent can use for further reasoning.
executeQueryTool(toolName: string, args?: Record<string, unknown>, schema?: { properties?: Record<string, unknown>; required?: string[] }): Promise<void>
Parameters
toolNameargsschemaReturns
Promise<void>