Skip to main content
Glama

retell_import_phone_number

Import an existing phone number from external providers via SIP to connect it with AI agents 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

  • The handler case in the executeTool switch statement that invokes the Retell API to import a phone number via POST to /import-phone-number with the tool arguments.
    case "retell_import_phone_number": return retellRequest("/import-phone-number", "POST", args);
  • Tool schema definition including name, description, and input validation schema in the tools array.
    { 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)
    Registers the handler for listing all tools, returning the tools array that includes retell_import_phone_number.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
  • src/index.ts:1287-1291 (registration)
    Registers the generic CallToolRequestSchema handler that dispatches to executeTool based on tool name, enabling execution of retell_import_phone_number.
    // Register tool execution handler server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try {
  • Generic helper function used by all Retell tool handlers to make authenticated API requests to the Retell service.
    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