createToolToken

View as MarkdownOpen in Claude

Create a per-call SWAIG token for a given tool, scoped to a specific call. The token is minted via the agent’s SessionManager. Returns an empty string on any failure. Complements validateToolToken().

Parameters

toolName
stringRequired

SWAIG function name to create a token for.

callId
stringRequired

Call ID the token is scoped to.

Returns

string — The per-call SWAIG token, or an empty string on failure.

Example

1import { AgentBase } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'support', route: '/support' });
4
5const token = agent.createToolToken('transfer_call', 'call-abc-123');
6console.log(token);