Add a tool
You want to add a new tool to a route and call it with full type safety. Here's how.
The code
import { z } from "zod"
export default z.object({
tenant: z.string(),
count: z.number().default(0),
})Notes
- No registration. Drop the file into
tools/. Dawn discovers it on the nextdawn typegenor dev-server reload. - Inline type on the input. Dawn's compiler pass reads the inline type from the function signature. Aliases imported from elsewhere are not extracted.
- Plain JSON in, plain JSON out. Tool inputs and outputs cross the runtime boundary. No
Date, noMap, no class instances. agentroutes don't callctx.tools. The LLM picks tools by name oncedawn buildbinds them. The example above uses aworkflowroute to show the typed call site.