Tutorial · Offline fixture · Checked November 3, 2026
MCP Tool Call Example
Run a phone-call MCP request through scripted acceptance, status and transcript responses on your own computer. The example checks the lifecycle without credentials, network requests, carrier charges or an outbound call. Every response, ID and conversation in the download is a demonstration.
Run the example locally
The example needs Node.js 18 or newer and one downloaded file. The example has no dependencies or live mode.
node call-lifecycle-demo.mjs node call-lifecycle-demo.mjs --test
The first command prints the scripted request and evidence state. The second runs eleven offline scenarios, including permission denial, missing receipt, no-answer, bounded polling, a pending human question and protocol or tool errors. A passing fixture test checks client logic; it does not establish provider availability, audible voice quality or task completion.
1. Keep permission ahead of execution
The lifecycle function defaults to approved: false and sends no request until the caller explicitly enables the fixture. The fixture’s approval flag illustrates a control-flow check; a real client still needs actual human permission, valid account credentials and the required scopes.
await runLifecycle(fixtureTransport); // authorization_required, no request
await runLifecycle(fixtureTransport, { approved: true, maxChecks: 4 });2. Match the discovered input schema
The request uses make_call with required agent_id and to, plus optional context and idempotency_key. The request fields match the live managed schema checked November 3, 2026.
{
"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": { "name": "make_call", "arguments": {
"agent_id": "demo-agent-not-a-live-id", "to": "+12025550123",
"context": "SCRIPTED DEMO: confirm an appointment",
"idempotency_key": "offline-demo-task-001"
} }
}A real request requires calls:write; the read tools require calls:read. Do not paste this demonstration into a live transport. Discover your connection’s current schema and complete the read-only connection check before planning any authorized call.
3. Read acceptance and save the receipt
The acceptance fixture returns result.structuredContent.success: true and a call record with id: "demo-call" and status: "queued". Acceptance confirms only the scripted start branch. The workflow stops without redialing when the returned call ID is missing.
4. Bound status checks and inspect evidence
Status checks use check_call_status with { "call_id": "demo-call" }. The example stops at four checks when the status remains active, stops on an unrecognized status, and pauses for a returned pending_question.
An ended state leads to get_transcript with the same call ID. The fixture returns either evidence_available or ended_without_transcript and always leaves task_outcome: "unconfirmed". A person or application must assess the evidence against the requested task; a completed carrier status is insufficient.
5. Stop on errors without placing another call
Error handling checks both the top-level JSON-RPC error and tool-level result.isError or structuredContent.success: false. Error handling stops before the next lifecycle request. A text-only result requires manual inspection rather than pretending that structured fields exist.
// Protocol-level example
{"jsonrpc":"2.0","id":1,"error":{"code":-32001,"message":"Missing required scope: calls:write"}}
// Tool-level example, inside the JSON-RPC result
{"isError":true,"structuredContent":{"success":false,"error":"Call blocked"}}The error messages above are illustrative fixtures. Preserve the actual error message and request identifiers in a real client, keep credentials out of logs, and avoid a new make_call request as an error-recovery shortcut.
What changes for a real client?
A real client needs an MCP transport, authentication, an authorized destination and task, account readiness checks and a deliberate live-call decision. The offline file supplies none of those provider operations. Keep polling delays and an overall deadline in your real application, preserve the original idempotency key for the same task, and report uncertainty whenever the evidence is incomplete.
The phone-call MCP reference explains the scope and result fields. Review the outbound call safety guidance and operating limits before live use.
Interface source: CallMCP managed endpoint, tools/list, checked November 3, 2026. Fixture results are demonstrations, not recorded customer calls.