The Zod schema for the tool's input (must be a schema of a record).
The Zod schema for the tool's output. Can be z.never() for tools that do not return a value.
The keys of InputSchema that are dynamic (allows the LLM to provide them incrementally).
OptionaldescriptionOptional description of the tool for the LLM.
Array of field names from InputSchema that are dynamic (will be made optional at runtime).
Function that executes the tool after all dynamic fields have passed validation.
The input parameter is fully validated and matches the InputSchema (all required fields are present).
Must return a ToolCallResult that indicates success or failure:
{ ok: true, ...output } where output matches OutputSchema (if OutputSchema is a record, spread it directly; otherwise use { value: output }){ ok: false, validationResults: {...}, problems: [...], feedback: [...], instructions: [...], ... } with structured feedbackFully validated input matching InputSchema.
A Promise resolving to a ToolCallResult indicating success or failure with feedback.
The Zod schema defining the tool's input structure.
The Zod schema defining the tool's output structure.
Parameters for creating a tool builder.