ToolRegistry¶
Methods¶
add¶
Register a tool from a { name, description, parameters, run, ... }
table.
Parameters
spec: {name: string, description: string, parameters: any, available: (ctx: RunCtx) -> boolean?, run: (args: any, ctx: RunCtx) -> string | {content: string, is_error: boolean?}, render: (state: any, view: RenderView) -> string | {[integer]: string}?}name— The advertised name and dispatch key.description— The description shown to the model.parameters— The raw JSON schema for the tool's arguments, adapted throughSerdeLuasince a bareserde_json::Valuehas noFromLuaof its own.available— Decides whether the tool is advertised this turn; always available when absent.run— The tool body, called with the arguments and a run context.render— The tool's own TUI presentation, given a display-state snapshot and a render context. Absent leaves the tool with the shared default block.