Skip to content

Custom tools

Custom tools and API calls for AI voice agents

Give your agent tools it can use during the call: an API call to your own system, your own JavaScript, or a written answer. The agent reads each tool’s description and decides when to call it, just like its built-in tools.

How it works

From a description to an action on the call.

Tools live on each agent, under Add to your agent. Describe the tool, choose how it runs, and test it before callers reach it.

  1. Open Add to your agent and pick from Build your own: a Custom tool, an API call to your own system, or an MCP server. Built-in abilities such as call transfer and texting a booking link sit in the same picker.

  2. Give the tool a name and a description of when to call it, then list the parameters the AI fills in from the conversation: text, numbers, yes or no, or a fixed set of values.

  3. Run it as Code, your JavaScript with no server of your own; as an API call that sends the arguments to your endpoint; or as Response only, a written answer the agent gets back. Whatever the tool returns goes back to the agent on the call.

  4. Test API sends a real request and shows the response, so you can capture the fields you need. Then try the agent by voice or text in the test panel. Real calls only use changes you publish.

In action

Adding a custom tool

Adding a custom tool to an agent from a template.

Custom tools

Teach your agent a new ability.

A custom tool is a named action with typed parameters. The AI sees its name, description and parameters, and calls it when the conversation needs it.

  • Named, with typed parameters

    Each tool has a name the AI calls and parameters it fills in: text, numbers, yes or no, or a set of allowed values, each marked required or not.

  • Your JavaScript, no server

    A Code tool runs your JavaScript for you. It reads the AI’s arguments, can make its own HTTP requests, and returns an object the agent gets back.

  • Or your endpoint, or a set answer

    An API call tool sends the arguments to your endpoint as JSON or through a body template. Response only returns text you wrote, such as a policy, with no code at all.

  • Results kept for the rest of the call

    The agent gets each result back, and the keys a Code tool returns are saved as call variables for the steps that follow.

API calls

Your systems, read and written mid-call.

In-call APIs let the agent fetch or send data while the caller is still on the line: look up an account, check a record, create a booking request.

  • Your endpoint, your method

    GET, POST, PUT, PATCH or DELETE to your own URL, with a JSON or text body built from what the caller said.

  • Headers, sign-in and secrets

    Add request headers or basic authentication, and keep keys in workspace secrets you reference from the request instead of pasting them in.

  • Capture what comes back

    Test the API, click the fields in the response you want, and the agent can use them later in the call.

  • Required fields: no guessing

    Mark a field Required and, if the API doesn’t return it, the agent is told it’s missing and must not guess it. You choose what counts as missing: null, empty text, an empty list and more.

Code and connections

Code, MCP servers and the built-ins, in one place.

Beyond single tools, agents can run code actions, call flows can run code nodes, and agents can connect to MCP servers.

  • JavaScript code actions

    Code actions the agent can invoke during calls, each in a sandboxed environment with the call’s variables. JavaScript is available on every workspace.

  • Code nodes in Advanced Call Flows

    In the visual node editor, a code node runs your JavaScript over the call data at a fixed point in the flow, with no AI deciding.

  • MCP servers (Beta)

    Connect an agent to a Model Context Protocol server and test the connection, so it can reach systems that expose one.

  • Next to native integrations

    Your own tools sit beside the native integrations for calendars and GoHighLevel, built-in call transfer and texting a booking link.

Frequently asked questions

What are custom tools on a voice agent?

Actions the agent can take during a call that you define yourself. Each has a name, a description of when to use it and parameters the AI fills in, and runs as JavaScript, an API call to your system, or a written response.

Can my AI voice agent call my API during a call?

Yes. Add an in-call API with the method, URL, headers or basic authentication, and a body built from the conversation. The agent calls it mid-call and can use the fields you capture from the response for the rest of the call.

Can the agent run my own code during a call?

Yes, in JavaScript, on every workspace: as a Code custom tool, as a code action the agent invokes, or as a code node in an Advanced Call Flow. Code can make its own HTTP requests and returns a result to the call.

What happens if my API doesn’t return the data?

Mark the field Required. If the API leaves it out or returns it empty, the agent is told it’s missing and must not guess it. You set what counts as missing for each field.

How do we keep API keys out of the agent’s setup?

Store them as workspace secrets and reference them from the request or from your code, instead of typing them into each API.

Does Trillet support MCP servers?

Yes. You can connect an agent to a Model Context Protocol server; the connection is marked Beta in the app. This is separate from the Trillet MCP, which lets developers build and manage agents from Claude Code, Cursor or Codex.

Which systems can the agent reach?

Any system with an API or an MCP server, such as HubSpot or Salesforce, through your own tools. Calendars, GoHighLevel and other native integrations are listed on the integrations page.

How do we test a tool before callers use it?

Use Test API to send a real request and see the response, then try the agent by voice or text in the test panel. Real calls only use the changes you publish.

Let your agent do the work on the call.

Book a demo and we’ll show an agent calling your API, running your code and answering with the result.