defineTool
vendo.ts
inputis the single statement of the arguments. It becomes the JSON Schema the model is shown and the parse that runs beforeexecute, so the two can never drift apart. A call that does not match is refused before your function runs.riskis required, and it is a grade:read,write, ordestructive. You wrote the tool, so you know. Only extraction is allowed to answerungraded.contextis the run context —context.principalis whose authority the call carries.executereturns the output, or throws. The denial outcomes belong to the guard: nothing you write can fake an approval.
zod 4 shapes only. On zod 3.25 or later, import from
zod/v4. On zod 4, the
plain zod import is already the right shape.The fields it does not ask for
The result is a plainToolDefinition, so everything else on a descriptor is a
spread away.
confirmEach makes every call earn its own approval, whatever the policy says.
title is the human label approval cards and tool menus show.
Where to go next
API tools
The other source: one command reads your API and writes the file.API tools →
Guard
Risk grade, approval, and an audit line on every call.How Vendo works →