retell_register_phone_call
Register inbound calls from custom telephony providers to route them to AI agents for handling.
Instructions
Register an inbound call from a custom telephony provider.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | The agent ID to handle the call | |
| from_number | Yes | The caller's phone number | |
| to_number | Yes | The called number | |
| metadata | No | Optional metadata for the call |
Implementation Reference
- src/index.ts:1261-1262 (handler)The handler logic within the executeTool switch statement that invokes the Retell API to register an inbound phone call from a custom telephony provider.case "retell_register_phone_call": return retellRequest("/register-phone-call", "POST", args);
- src/index.ts:1091-1116 (registration)Tool registration in the tools array, including name, description, and input schema for MCP tool listing.{ name: "retell_register_phone_call", description: "Register an inbound call from a custom telephony provider.", inputSchema: { type: "object", properties: { agent_id: { type: "string", description: "The agent ID to handle the call" }, from_number: { type: "string", description: "The caller's phone number" }, to_number: { type: "string", description: "The called number" }, metadata: { type: "object", description: "Optional metadata for the call" } }, required: ["agent_id", "from_number", "to_number"] } }
- src/index.ts:1094-1115 (schema)Input schema defining parameters for registering a phone call: agent_id, from_number, to_number (required), and optional metadata.inputSchema: { type: "object", properties: { agent_id: { type: "string", description: "The agent ID to handle the call" }, from_number: { type: "string", description: "The caller's phone number" }, to_number: { type: "string", description: "The called number" }, metadata: { type: "object", description: "Optional metadata for the call" } }, required: ["agent_id", "from_number", "to_number"] }
- src/index.ts:23-57 (helper)Generic helper function that performs authenticated API requests to Retell AI backend, handling headers, body, errors, and JSON responses. Used by the tool handler.async function retellRequest( endpoint: string, method: string = "GET", body?: Record<string, unknown> ): Promise<unknown> { const apiKey = getApiKey(); const headers: Record<string, string> = { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json", }; const options: RequestInit = { method, headers, }; if (body && method !== "GET") { options.body = JSON.stringify(body); } const response = await fetch(`${RETELL_API_BASE}${endpoint}`, options); if (!response.ok) { const errorText = await response.text(); throw new Error(`Retell API error (${response.status}): ${errorText}`); } // Handle 204 No Content if (response.status === 204) { return { success: true }; } return response.json(); }