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.
Platform and project tool names
For project agents running in Veryfront Cloud, select platform tools with the reservedveryfront__ prefix, for example veryfront__bash or
veryfront__get_file. Project tools keep their local IDs. An agent can select
both platform veryfront__bash and a project tool named bash:
get_file remain supported.
Integration tools retain names such as github__list_repos. Project tool IDs
cannot use the reserved double-underscore namespace. Platform aliases retain
the same project scope and policy restrictions as their legacy names.
Connector allowlists do not remove trusted platform capabilities. That exception
requires host-owned provenance; a remote source cannot claim it with a tool name
or source ID. Hosted wrappers and child forks preserve provenance.
Managed
executor installations carry broker-derived platform source and host-tool
metadata, then restore provenance on the executor-local facades.
Reserved platform names resolve only through trusted sources, regardless of
custom server ordering. Hosted discovery applies connector policy to the same
catalog snapshot it lists, without fetching each catalog a second time.
Parent, child, hosted-project, and standalone API sources derive canonical aliases
from the authenticated legacy catalog. API MCP allow/deny entries apply to both
spellings; a run’s tool-name ceiling still grants only its exact selected names.
Canonical calls use the legacy wire name after project and access checks.
Runtime
dispatch reuses the source selected during authorization for that call.
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
An explicit tool map authorizes only the selected tools and sends those schemas to the model immediately. Usetools: true for a broad authorized scope. The
framework initially sends only the load_skill bootstrap schema when it is
authorized, plus tool_search, then loads matching schemas for the next model
step. form_input is authorized but deferred until it is needed. Omit tools
to expose no project tools. Search results contain names and descriptions, not
input or output schemas.
tools: { getWeather: true } when the model needs a
selected schema on its first step. Schema loading and tool authorization stay
separate, and execution rechecks authorization.
tool_search uses deterministic, case-insensitive matching. It treats
underscores as spaces and ranks results in this order:
- Exact tool name.
- Tool name substring.
- Tool description substring.
- Input parameter description substring.
tools catalog. It also
loads configured providerTools that the selected model supports. A
provider-native search entry contains only its name and description. The
runtime attaches the provider’s native schema on the next model step and never
executes it as a local tool.
The runtime reapplies the current authorization policy, configured provider
tools, and model support before execution and checkpoint restoration, so a
previously loaded name cannot restore a removed permission.
Deferred loading works with direct provider model strings and provider API
keys. Veryfront Cloud is not required for that path. Hosted durable execution
uses the same framework search, but it requires the Veryfront API durable
run-event contract. Before the next model step, the hosted runtime persists a
private loaded-tool checkpoint. It fails the continuation if required
persistence is unavailable, and it excludes the checkpoint from public
messages and replay.
Omit model to use the Cloud default (mistral/mistral-small-2503) with hosted
context, or openai/gpt-5-nano with direct credentials. Set
model: "auto" when you want runtime defaults to choose local or Veryfront
Cloud inference automatically.
When a user asks “What’s the weather in Tokyo?”, an agent with tools: true:
- Sends the question with
tool_searchto the model. - The model searches for a weather capability.
- The framework loads the matching authorized
getWeatherschema. - The next model step 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:
Use
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. In deferred mode,
tool_search can load a configured capability when the selected model supports
it:
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.
When mcpServers is omitted, explicitly named tools that are not local are
resolved from the Veryfront API MCP server if server bootstrap credentials are
available. This makes a project pulled from Studio runnable locally without
duplicating transport configuration.
VERYFRONT_API_URL selects the endpoint, while VERYFRONT_API_TOKEN and
VERYFRONT_PROJECT_SLUG provide server-side identity. Environment variables
never grant tools: only explicitly named unresolved tools are requested, and
the remote tools/list response defines their schemas. Use mcpServers: []
to opt out, or declare { kind: "veryfront-api", toolPolicy: ... } to make the
connection policy explicit. Direct application routes and hosted runtimes do
not accept browser-supplied credentials or project identity for this server.
Tool configuration
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:
Pass context from the API route:
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.