retell_create_phone_call
Initiate outbound phone calls using AI agents. Connect registered numbers to target recipients with configurable conversation flows and tracking.
Instructions
Create a new outbound phone call using Retell AI. Initiates a call from a registered phone number to a target number using a configured AI agent.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from_number | Yes | The caller's phone number in E.164 format (e.g., +14157774444). Must be a number registered with Retell. | |
| to_number | Yes | The recipient's phone number in E.164 format (e.g., +12137774445) | |
| override_agent_id | No | Optional: Specific agent ID to use for this call instead of the number's default agent | |
| metadata | No | Optional: Custom metadata to attach to the call for tracking purposes | |
| retell_llm_dynamic_variables | No | Optional: Dynamic variables to pass to the LLM for personalized responses |
Implementation Reference
- src/index.ts:1123-1124 (handler)The handler case in the executeTool switch statement that executes the tool by calling retellRequest to POST the arguments to Retell's /v2/create-phone-call API endpoint.case "retell_create_phone_call": return retellRequest("/v2/create-phone-call", "POST", args);
- src/index.ts:62-90 (schema)Tool definition including name, description, and detailed input schema for parameters.{ name: "retell_create_phone_call", description: "Create a new outbound phone call using Retell AI. Initiates a call from a registered phone number to a target number using a configured AI agent.", inputSchema: { type: "object", properties: { from_number: { type: "string", description: "The caller's phone number in E.164 format (e.g., +14157774444). Must be a number registered with Retell." }, to_number: { type: "string", description: "The recipient's phone number in E.164 format (e.g., +12137774445)" }, override_agent_id: { type: "string", description: "Optional: Specific agent ID to use for this call instead of the number's default agent" }, metadata: { type: "object", description: "Optional: Custom metadata to attach to the call for tracking purposes" }, retell_llm_dynamic_variables: { type: "object", description: "Optional: Dynamic variables to pass to the LLM for personalized responses" } }, required: ["from_number", "to_number"] }
- src/index.ts:1283-1285 (registration)Registers the tool by including it in the tools array returned for ListToolsRequest, making the schema available to MCP clients.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
- src/index.ts:23-57 (helper)Shared helper function that performs the actual API call to Retell AI, handling authentication, request formatting, error handling, and response parsing. 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(); }
- src/index.ts:1288-1313 (registration)MCP server request handler for CallToolRequest that dispatches to executeTool based on tool name, formats the result or error as MCP content.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const result = await executeTool(name, args as Record<string, unknown>); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `Error: ${errorMessage}`, }, ], isError: true, }; } });