Skip to main content
Glama

retell_import_phone_number

Import an existing phone number via SIP to connect it with Retell AI's voice agent platform for handling inbound and outbound calls.

Instructions

Import an existing phone number from an external provider via SIP.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
phone_numberYesThe phone number to import in E.164 format
termination_uriYesSIP termination URI for the phone number
inbound_agent_idNoOptional: Agent ID for inbound calls
outbound_agent_idNoOptional: Agent ID for outbound calls

Implementation Reference

  • Handler implementation for the retell_import_phone_number tool. Proxies the tool arguments as POST body to the Retell API endpoint /import-phone-number.
    case "retell_import_phone_number": return retellRequest("/import-phone-number", "POST", args);
  • Input schema definition and tool metadata for retell_import_phone_number, registered in the tools list.
    { name: "retell_import_phone_number", description: "Import an existing phone number from an external provider via SIP.", inputSchema: { type: "object", properties: { phone_number: { type: "string", description: "The phone number to import in E.164 format" }, termination_uri: { type: "string", description: "SIP termination URI for the phone number" }, inbound_agent_id: { type: "string", description: "Optional: Agent ID for inbound calls" }, outbound_agent_id: { type: "string", description: "Optional: Agent ID for outbound calls" } }, required: ["phone_number", "termination_uri"] } },
  • src/index.ts:1283-1285 (registration)
    MCP ListToolsRequestHandler registration that returns the full tools array including retell_import_phone_number.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
  • src/index.ts:1287-1313 (registration)
    MCP CallToolRequestHandler registration that dispatches tool execution to executeTool switch based on name.
    // Register tool execution handler 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, }; } });
  • Generic retellRequest helper function that makes authenticated HTTP requests to Retell API endpoints, 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(); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/itsanamune/retellsimp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server