Skip to main content
Glama
VapiAI

Vapi MCP Server

Official
by VapiAI

list_calls

Retrieve all recorded voice calls from the Vapi platform to review conversations and analyze interactions.

Instructions

Lists all Vapi calls

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'list_calls' MCP tool. It takes no input parameters and returns a list of the 10 most recent Vapi calls, transformed using transformCallOutput.
    server.tool(
      'list_calls',
      'Lists all Vapi calls',
      {},
      createToolHandler(async () => {
        const calls = await vapiClient.calls.list({ limit: 10 });
        return calls.map(transformCallOutput);
      })
    );
  • The core handler logic for the list_calls tool: fetches the list of recent calls from Vapi API and maps each to the output format.
    createToolHandler(async () => {
      const calls = await vapiClient.calls.list({ limit: 10 });
      return calls.map(transformCallOutput);
    })
  • Zod schema defining the structure of individual call outputs returned by the list_calls tool.
    export const CallOutputSchema = BaseResponseSchema.extend({
      status: z.string(),
      endedReason: z.string().optional(),
      assistantId: z.string().optional(),
      phoneNumberId: z.string().optional(),
      customer: z
        .object({
          number: z.string(),
        })
        .optional(),
      scheduledAt: z.string().optional(),
    });
  • Utility function that wraps the raw handler with try-catch error handling and standardizes the ToolResponse format.
    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);
        }
      };
    }
  • Helper function that transforms raw Vapi.Call objects to the standardized CallOutputSchema format used in list_calls response.
    export function transformCallOutput(
      call: Vapi.Call
    ): z.infer<typeof CallOutputSchema> {
      return {
        id: call.id,
        createdAt: call.createdAt,
        updatedAt: call.updatedAt,
        status: call.status || '',
        endedReason: call.endedReason,
        assistantId: call.assistantId,
        phoneNumberId: call.phoneNumberId,
        customer: call.customer
          ? {
              number: call.customer.number || '',
            }
          : undefined,
        scheduledAt: call.schedulePlan?.earliestAt,
      };
    }

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