Skip to main content
TurnCall agents can call tools during conversations. Tools let the AI take actions — transfer calls, look up customer data, book appointments, and more.

Built-in Tools

These work out of the box with no server needed:

Call transfer (cold / warm)

transfer_call moves a live Twilio call to a human:
  • transfer_mode: cold (blind — bridge immediately) or warm (brief the operator first).
  • transfer_message: spoken to the caller before the dial (“Connecting you…”).
  • briefing (warm only): spoken to the operator before bridging — a string, or {"from_summary": true} to summarize the transcript on the fly.
  • fallback_message: spoken to the caller if the operator doesn’t answer, then the call ends.
The same parameters work via the control API: POST /v1/calls/{call_id}/transfer. Warm transfer and fallback_message require PUBLIC_BASE_URL to be set (Twilio calls back to TurnCall for the operator briefing and the no-answer fallback). If the operator’s line goes to voicemail, the caller is still connected (and can leave a message); a transfer.answered event reports answered_by (human/machine). See the call-transfer example.
Transfers redirect the call’s PSTN leg, so they work on Twilio calls — a WebRTC or WhatsApp session has no phone leg to bridge.

Choosing the transfer target

target_number is an argument the LLM supplies, so where the number comes from is a design choice. Rule of thumb: prompt = policy (when to transfer, what to say), code = facts that change (who’s on call, at what number). For the lookup-tool pattern, three rules keep transfers reliable: always return a number (bake in a fallback line — an error mid-transfer strands a frustrated caller), answer fast (the caller waits in silence; the default tool timeout is 10s), and return E.164. Avoid putting schedules or rota tables in the prompt itself — the LLM has no reliable clock and can mistranscribe digits; that logic belongs in the tool.

Custom Webhook Tools

Define tools with a webhook_url — TurnCall POSTs to your server when the LLM invokes the tool:

Webhook Payload

Your server receives:
Return any JSON — it’s passed back to the LLM as the tool result.

Signed Tool Webhooks

Set webhook_secret (min 16 chars) on a tool and TurnCall HMAC-signs every POST so your endpoint can verify it really came from TurnCall:
Each request then carries X-TurnCall-Signature: v1=<hex> and X-TurnCall-Timestamp — HMAC-SHA256 over "{timestamp}.{raw_body}", the same scheme as event webhooks. Verify with:
Unset secret = unsigned POST (backward compatible).

Tool Invocation Recording

All tool calls (webhook + MCP + built-in) are recorded in the tool_invocations table with:
  • Input arguments
  • Output result
  • Status (success/error)
  • Latency (ms)
Query invocations via the API:

Validate Tool Schema

Test your tool definition before adding it to an agent: