Tools
Let an agent call your API mid-conversation — check an order, book a slot, look up a balance.
A tool is an HTTP endpoint of yours that the agent may call while it is talking.
Tools live on the agent (tools, up to 15) rather than as their own resource, and
you set them with PATCH /v1/agents/{id} like any other field.
{
"tools": [{
"name": "lookup_order",
"description": "Look up an order by its id. Use this when the caller asks about an order they have already placed.",
"parameters": [
{ "name": "order_id", "type": "string", "description": "The order id, e.g. AC-4417", "required": true, "in": "path", "path": "orderId" }
],
"speech": { "en-IN": "Let me pull that up.", "hi-IN": "मैं देखता हूँ।" },
"http": {
"url": "https://api.example.com/orders/{orderId}",
"method": "GET",
"auth": { "type": "bearer", "secretId": "4c8f8f4e-3b1a-4d7c-9a92-1f2e3d4c5b6a" },
"timeoutMs": 4000
}
}]
}🔴 A tool change reaches calls when you publish, not when you save. Calls run
the agent version that was published when they were placed — its prompt, its
tools, their URLs and their mocks. PATCH edits the draft; POST /v1/agents/{id}/publish makes the draft what new calls use. A call already in
progress keeps the tools it started with. See Agent versions.
The description is the contract
description is not documentation — it is what the model uses to decide whether
to call the tool at all. Write it as a trigger condition ("use this when the
caller asks about an order they have already placed"), not as a summary ("order
lookup endpoint"). The same goes for each parameter.
A parameter description also decides how a value is written. Speech is transcribed in the
script the caller spoke, so a Hindi caller's address reaches the model in Devanagari, and the model
passes it on as heard unless told otherwise. If your system stores names and addresses in English
letters, say so: "Flat or house, building and area, written in English letters (Latin script) even if the customer spoke Hindi". Without that line, a test call sent
"flat 12, शोभा Dream Acres पाना थोर"; with it, "22 Brigade Gateway, Rajajinagar" from a
transcript entirely in Devanagari.
Parameters
Each parameter is a string, number, integer or boolean; a string can
carry an enum. There are no array or object parameters, so a tool that needs
a list takes it as one string your API splits. At most 16 parameters per tool.
A parameter's name is what the agent fills in, and is lowercase snake_case.
Your API receives it under path instead whenever you set one, and path can
be any name your API expects: trainingLocationId, training-location-id,
Training Location. In the dashboard you type the name your API expects, and
the agent's name is made from it.
Where a value goes is in: query, body or path. Without it, a GET or
DELETE sends parameters in the query string and every other method in a JSON
body. path is a query key, a dotted location in the body such as
attendee.email (a dot always nests), or — for in: "path" — the
{placeholder} in the URL it fills. A path parameter whose placeholder is
not in the URL is refused when you save. bodyFormat: "form" sends the body
form-encoded instead of JSON.
Pinned values are parameters you fill, not the model: give the parameter a
value and it is sent on every call and never shown to the model. A pinned value
can read the call — {{customer_number}}, {{to_number}}, {{from_number}}
(and _national forms of the three, without +91), {{call_id}},
{{agent_id}}, {{channel}} — any of the agent's input variables, and
{{context.order.id}} from the call's context. A placeholder with no value is
sent as written, so a typo shows up in your own logs rather than as an empty
field.
🔴 Pin anything the agent cannot know. The agent is never told the number it
is talking to. A phone parameter left for the model to fill gets a number the
model made up, on a real call as much as in a test, so pin it to
{{customer_number_national}} (or {{customer_number}} for the +91 form)
instead. The same goes for a value you passed in variables: pin it to
{{first_name}} rather than letting the model spell the name again.
In the dashboard's test chat there is no phone line. Pinned input variables
read the values in the test panel, and {{customer_number}} reads the
Customer number you enter there (the field appears in the Chat tab when the
agent has tools); with it empty, the placeholder is sent as written. The other
call names ({{to_number}}, {{from_number}}, {{channel}}) have no value in
a chat. A browser test call has no customer number either, so to see the
real value, place a real call to your own phone.
What the caller hears while it runs
A tool's speech line is said the moment the model asks for the tool, in the
call's language. Without one, a short filler plays if your API is slow ("जी…",
then "एक सेकंड…"), so a slow tool is never dead air, but a sentence of your own
always reads better. Keep timeoutMs honest: 1000–30000 is allowed and the
default is 6000, but anything past a few seconds is a long wait on a phone call.
The model can chain tools: up to five rounds in one turn (find the customer, then their order, then open a ticket). Calls the model asks for together run one after another, and if the caller interrupts or hangs up, the ones not yet sent are not sent. Past five rounds the model is told the limit was reached and answers with what it has.
The request Tone sends
Every tool request carries these headers:
| Header | What it is |
|---|---|
x-tone-call-id | The call (GET /v1/calls/{id}). |
x-tone-tool-call-id | Unique to this one invocation. The id on the call's tool-call record. |
x-tone-timestamp | Unix seconds when it was signed. |
x-tone-signature | v1=<hex> v2=<hex>, HMAC-SHA256 with your tool signing key. |
Verify it. Read the key once with GET /v1/tools/signing-secret (admin; a
live key or the dashboard) and keep it server-side. v2 signs
{timestamp}.{METHOD}.{path?query}.{raw body} (an empty body for a GET), so it
binds the exact URL; v1 signs {timestamp}.{raw body}, the same scheme as
webhooks, so one verifier checks both. Prefer v2, compare in
constant time over the raw bytes, and reject a timestamp more than five minutes
old.
Tone does not retry a tool request, and a POST can succeed on your side while
the call has already given up on it (a timeout). The model may then ask again
under a new x-tone-tool-call-id. Make a tool that changes something idempotent
on your own business key — the order, the slot — rather than on that header.
What Tone does with your answer
- A
2xxbody is handed to the model, cut to 6,000 characters (marked[truncated]). JSON or plain text both work; keep it to what the agent needs to say. - Any other status tells the model the request failed, with the first 500 characters of your body. Say why in that body ("no order with that id") and the agent can pass it on.
- A response over 256 KB, a timeout, a host that cannot be reached and a host in private address space fail the tool request; the model is told it failed and why, never given a partial body.
- Redirects are followed for
GETonly. Any other method's redirect comes back to the model as a failed request.
Seeing what ran
GET /v1/calls/{id}/tool-calls lists every tool the agent ran on a call, in
order: the arguments the model sent, your HTTP status or why the request never
reached you (timeout, blocked_url, response_too_large, …), and the
latency. It fills in while the call is live. Pinned values and credentials are
never in it. Tool calls are not turns in the transcript.
Credentials are referenced, never inline
🔴 A tool may not carry a credential in its definition. auth.secretId points at
a secret in your organization's write-only store; there is no route that reads a
value back. Do not put a key in headers or a pinned value instead: both are
stored in plain text and returned by every agent read.
curl "$TONE_API/v1/secrets" -X POST \
-H "Authorization: Bearer $TONE_LIVE_ADMIN_KEY" \
-H 'content-type: application/json' \
-d '{"name":"Orders API key","value":"sk_live_…","allowedOrigin":"https://api.example.com"}'The response gives the id a tool names as auth.secretId. auth.type is
bearer (Authorization: Bearer …), basic (store user:password) or
api_key (sent in the header, query or body field you name).
🔴 A secret goes to one origin. allowedOrigin binds it: a tool on any other
host is refused when the agent is saved and again when it runs. With an API key
allowedOrigin is required; in the dashboard (Settings → Secrets) it is
optional, and the first tool saved with the secret binds it. A secret that a
webhook endpoint, a number or a partner token already uses cannot be given to a
tool. To point a tool at a new host, create a new secret for it. Creating and
deleting secrets needs admin and a live key or the dashboard, because agents
— and the secrets their tools send — are shared by the test and live lanes.
Rotating a key: create the new secret, PATCH the tools to its id, publish,
then DELETE /v1/secrets/{id} the old one (deletion is refused while a tool
still uses it).
URLs are checked when you save the agent and again at execution time after DNS resolution, so a hostname that resolves into private address space is refused both when it is written and when it is used.
Mock it before you build it
{ "mock": { "enabled": true, "response": "{\"status\":\"shipped\",\"eta\":\"Thursday\"}" } }With mock.enabled, the tool returns response (a string, up to 6,000
characters) instead of calling anything. Design the conversation first, build
the endpoint second.
Built-in tools
end_call is available and is how an agent hangs up deliberately.
transfer_call is how it hands a call to a person; it is switched on by the
agent's transfer setting, not declared as a tool — see
Transfers to a person. press_digit is a reserved name — it is
not built, and an agent declaring it will not get the behaviour you expect.
These names cannot be used for your own tools, and neither can query_knowledge,
switch_language or the calendar tools (find_appointment_slots,
book_appointment_slot, find_caller_appointments, cancel_caller_appointment,
move_caller_appointment). A header named x-tone-… is reserved too.