retell_delete_phone_number
Remove a phone number from your Retell AI account to stop using it for AI voice agents and conversation flows.
Instructions
Delete/release a phone number from your account.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| phone_number | Yes | The phone number in E.164 format to delete |
Implementation Reference
- src/index.ts:1163-1164 (handler)The switch case handler in executeTool function that performs the DELETE API request to Retell to delete the specified phone number.case "retell_delete_phone_number": return retellRequest(`/delete-phone-number/${encodeURIComponent(args.phone_number as string)}`, "DELETE");
- src/index.ts:387-400 (schema)Tool definition in the tools array, including name, description, and input schema for validation.{ name: "retell_delete_phone_number", description: "Delete/release a phone number from your account.", inputSchema: { type: "object", properties: { phone_number: { type: "string", description: "The phone number in E.164 format to delete" } }, required: ["phone_number"] } },
- src/index.ts:1283-1285 (registration)Registers the handler for listing tools, which returns the tools array containing this tool's schema and metadata.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
- src/index.ts:1288-1313 (registration)Registers the main tool execution handler that dispatches to executeTool based on tool name.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, }; } });
- src/index.ts:23-57 (helper)Generic HTTP client helper that makes authenticated requests to the Retell AI API, used by all tool handlers.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(); }