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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/call.ts:15-23 (registration)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); }) );
- src/tools/call.ts:19-22 (handler)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); })
- src/schemas/index.ts:290-301 (schema)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(), });
- src/tools/utils.ts:30-41 (helper)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); } }; }
- src/transformers/index.ts:211-229 (helper)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, }; }