Calling Multiple Tool Endpoints
Route AI tool calls to different API endpoints using named toolkits — or stick with a single default endpoint.
Overview
When the AI agent calls a tool (function), VoiceElements needs to know where to send the HTTP request. This endpoint is called a toolkit. There are two ways to configure it — a legacy single-endpoint style and a newer multi-toolkit style. Both are supported simultaneously.
Legacy style
A single endpoint configured with defaultToolsUrlBase and defaultToolsUrlAdapter. Still fully supported — no migration required.
Modern style (recommended)
A toolkits array where each entry is a named endpoint with its own URL, headers, and adapter. Supports routing different tools to different APIs.
Legacy Style
The original configuration uses two top-level fields inside
VoiceElements_Instructions:
{
"VoiceElements_Instructions": {
"defaultToolsUrlBase": {
"url": "https://your-api.example.com/api",
"headers": {
"Token": "<<vns-api-token:MyApiKey>>"
}
},
"defaultToolsUrlAdapter": "?toolName=<<toolname>>&sessionGuid=<<sessionguid>>"
}
}
defaultToolsUrlBase.url — the base URL of the tool endpoint.
defaultToolsUrlBase.headers — HTTP headers sent with every tool call. Supports placeholders.
defaultToolsUrlAdapter — controls how the tool name and session GUID are appended. See Adapter Syntax below.
Modern Style: Toolkits Array
The preferred approach is a toolkits array inside
VoiceElements_Instructions.
Each entry is a named endpoint with its own URL, headers, and adapter.
{
"VoiceElements_Instructions": {
"toolkits": [
{
"name": "default",
"url": "https://your-api.example.com/api/tool",
"headers": {
"Token": "<<vns-api-token:MyApiKey>>"
},
"toolsUrlAdapter": "?toolName=<<toolname>>&sessionGuid=<<sessionguid>>"
}
]
}
}
Toolkit Entry Fields
| Field | Description |
|---|---|
| name | Identifier for this toolkit. "default" is a reserved name — see below. |
| url | Full base URL of the endpoint. |
| headers | HTTP headers sent with every request to this toolkit. Supports placeholders. |
| toolsUrlAdapter | Controls how the tool name and session GUID are passed. See Adapter Syntax. |
The "default" Toolkit
If a toolkit named "default" exists in the array,
it is used for all tool calls that do not specify a toolkit name.
The named "default" toolkit takes precedence over the legacy
defaultToolsUrlBase /
defaultToolsUrlAdapter fields.
This is the recommended migration path.
Resolution order for unqualified tool calls
"default" in the toolkits array preferreddefaultToolsUrlBase + defaultToolsUrlAdapter legacy fallbackCalling an Alternate Toolkit
To route a specific tool call to a different endpoint, prefix the tool name with the toolkit name and
-- (two hyphens):
toolkitname--tool_function_name
For example, to route a transfer_request tool call
to a sandbox endpoint instead of the default,
define both toolkits and name the tool sandbox--transfer_request
in your OpenAI tool definitions:
"toolkits": [
{
"name": "default",
"url": "https://your-api.example.com/api/tool",
"headers": { "Token": "<<vns-api-token:MainApiKey>>" },
"toolsUrlAdapter": "?toolName=<<toolname>>&sessionGuid=<<sessionguid>>"
},
{
"name": "sandbox",
"url": "https://your-api.example.com/api/sandbox",
"headers": { "Authorization": "Bearer <<vns-api-token:SandboxToken>>" },
"toolsUrlAdapter": "?toolName=<<toolname>>&sessionGuid=<<sessionguid>>"
}
]
When the AI calls sandbox--transfer_request, VoiceElements:
- Splits on
--to extract toolkit name"sandbox"and tool name"transfer_request" - Looks up the
"sandbox"toolkit - Sends the HTTP request to that toolkit's URL with its headers
- If the toolkit name is not found, falls back to the default
^[a-zA-Z0-9_-]+$.
The double-hyphen -- is valid within this pattern, so sandbox--transfer_request is a legal tool name.
Adapter Syntax
The toolsUrlAdapter
(or legacy defaultToolsUrlAdapter)
controls how the tool name and session GUID are passed to your endpoint.
Two tokens are available:
| Token | Replaced with |
|---|---|
| <<toolname>> | The tool name (with toolkit prefix stripped) |
| <<sessionguid>> | The caller's session GUID |
Query string style (most common)
"toolsUrlAdapter": "?toolName=<<toolname>>&sessionGuid=<<sessionguid>>"
// Results in:
// https://your-api.example.com/api/tool?toolName=transfer_request&sessionGuid=abc123
Path style
"toolsUrlAdapter": "/<<toolname>>/<<sessionguid>>"
// Results in:
// https://your-api.example.com/api/tool/transfer_request/abc123
No adapter
If toolsUrlAdapter is null or omitted,
the tool name and session GUID are sent in the POST body as a JSON object instead of the URL.
Ready to Automate Your Phone Lines?
See Voice Nexus in action. Book a live demo with our team and we'll walk you through setup, integrations, and pricing.