Skip to main content
Glama

retell_get_phone_number

Retrieve details for a specific phone number to verify availability and configuration for AI voice agents.

Instructions

Retrieve details of a specific phone number.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
phone_numberYesThe phone number in E.164 format to retrieve

Implementation Reference

  • The switch case handler that executes the tool logic by calling the Retell API's GET /get-phone-number/{phone_number} endpoint with URL-encoded phone number.
    case "retell_get_phone_number":
      return retellRequest(`/get-phone-number/${encodeURIComponent(args.phone_number as string)}`, "GET");
  • Input schema definition specifying the required 'phone_number' parameter as a string.
    inputSchema: {
      type: "object",
      properties: {
        phone_number: {
          type: "string",
          description: "The phone number in E.164 format to retrieve"
        }
      },
      required: ["phone_number"]
    }
  • src/index.ts:1283-1285 (registration)
    MCP registration of the ListToolsRequestHandler, which returns the full tools array including 'retell_get_phone_number'.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • src/index.ts:1288-1293 (registration)
    MCP registration of the CallToolRequestHandler, which dispatches tool execution to executeTool based on name, invoking the handler for 'retell_get_phone_number'.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      try {
        const result = await executeTool(name, args as Record<string, unknown>);
        return {
  • Core helper function for making authenticated API requests to Retell AI, used by the retell_get_phone_number handler and all other tools.
    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