Skip to main content
Glama
VapiAI

Vapi MCP Server

Official
by VapiAI

list_phone_numbers

Retrieve all available phone numbers from the Vapi MCP Server to enable voice API integration and communication setup.

Instructions

Lists all Vapi phone numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that fetches the list of phone numbers from the Vapi API (limited to 10) and transforms each using transformPhoneNumberOutput.
    createToolHandler(async () => { const phoneNumbers = await vapiClient.phoneNumbers.list({ limit: 10 }); return phoneNumbers.map(transformPhoneNumberOutput); })
  • Registers the 'list_phone_numbers' tool with the MCP server, providing description, empty input schema, and the wrapped handler.
    server.tool( 'list_phone_numbers', 'Lists all Vapi phone numbers', {}, createToolHandler(async () => { const phoneNumbers = await vapiClient.phoneNumbers.list({ limit: 10 }); return phoneNumbers.map(transformPhoneNumberOutput); }) );
  • Helper function that transforms raw Vapi phone number objects to the standardized PhoneNumberOutputSchema format.
    export function transformPhoneNumberOutput( phoneNumber: any ): z.infer<typeof PhoneNumberOutputSchema> { return { id: phoneNumber.id, name: phoneNumber.name, createdAt: phoneNumber.createdAt, updatedAt: phoneNumber.updatedAt, phoneNumber: phoneNumber.number, status: phoneNumber.status, }; }
  • Zod schema defining the structure of phone number output objects used by the tool.
    export const PhoneNumberOutputSchema = BaseResponseSchema.extend({ name: z.string().optional(), phoneNumber: z.string(), status: z.string(), capabilities: z .object({ sms: z.boolean().optional(), voice: z.boolean().optional(), }) .optional(), });
  • Generic utility that wraps the raw handler function with try-catch error handling and standardizes the response format for MCP tools.
    export function createToolHandler<T>( handler: (params: T) => Promise<any> ): (params: T) => Promise<ToolResponse> { return async (params: T) => { try { const result = await handler(params); return createSuccessResponse(result); } catch (error) { return createErrorResponse(error); } }; }

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/VapiAI/mcp-server'

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