Prerequisites
- A Veryfront project running locally (see Create project).
- An agent that will call the tool, or an API route that invokes the tool directly (see Agents and API routes).
defineSchemais available fromveryfront/schemas.
Define a tool
Create a file intools/:
tools/get-weather.ts registers as getWeather.
Try a tool directly
Agents usually invoke tools, but direct execution is useful for testing and for API routes that expose a specific action:How agents use tools
When you add a tool to an agent, the framework sends the input schema to the model. The model decides when to call the tool and provides the parameters:model and let runtime defaults choose local
or Veryfront Cloud inference automatically.
When a user asks “What’s the weather in Tokyo?”, the agent:
- Sends the question to the model
- The model calls
getWeather({ city: "Tokyo" }) - The tool returns
{ temperature: 22, conditions: "sunny" } - The model formats a natural language response
Tool surfaces in agent config
Agent config separates tools by execution boundary:| Config field | Use it for | Executes in |
|---|---|---|
tools | Local project tools from tools/ or inline tool(...) | Veryfront runtime |
providerTools | Provider-native tools such as web_search | Selected model provider |
mcpServers | Remote MCP-compatible tool servers | Remote MCP server through Veryfront |
skills | Reusable skill packs that can load skill instructions | Veryfront runtime |
tools for functions you define in the project. Do not add provider-native
tools or skill loader tools to tools.
Use providerTools for provider-executed capabilities:
mcpServers for remote MCP tools. Put remote visibility policy on the MCP
server. When tools is an explicit object, also list the remote tool name in
tools so the model can use it.
Tool configuration
| Property | Type | Description |
|---|---|---|
description | string | What the tool does (shown to the model) |
inputSchema | Schema<T> | Schema for input validation |
execute | (params) => Promise<unknown> | Function that runs when the tool is called |
id | string | Override the auto-generated ID |
Writing good descriptions
Thedescription field is what the model reads to decide when to call your tool. Be specific, and use .describe() on schema fields to help the model understand what to pass:
Returning errors
Throw fromexecute to signal an error. The agent sees the error message and can retry or respond accordingly:
Tools with context
Theexecute function receives an optional second argument with runtime context:
| Context field | Type | Description |
|---|---|---|
agentId | string | ID of the agent that called the tool |
projectId | string | Current project identifier |
runId | string | Current agent run identifier |
toolCallId | string | Current tool call identifier |
blobStorage | BlobStorage | Blob storage access (if configured in workflow) |
| custom fields | unknown | Host-provided application metadata for the tool |
Inline tools
For one-off tools that don’t need auto-discovery, define them inline:evaluateMathExpression is your own validated math evaluator. Avoid passing
free-form input into eval() or Function().
Verify it worked
Restartveryfront dev after creating the tool file. To run the tool by
itself, expose a small debug API route:
execute function produced. Remove the
debug route before deploying.