list_calls
Retrieve a comprehensive list of all Vapi calls to review call history, analyze interactions, and manage records efficiently.
Instructions
Lists all Vapi calls
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/call.ts:19-22 (handler)The main handler for the 'list_calls' tool. It calls vapiClient.calls.list({ limit: 10 }) and transforms the output using transformCallOutput.
createToolHandler(async () => { const calls = await vapiClient.calls.list({ limit: 10 }); return calls.map(transformCallOutput); }) - src/tools/call.ts:15-23 (registration)Registration of the 'list_calls' tool via server.tool(), which registers it with name 'list_calls', description 'Lists all Vapi calls', an empty schema (no input params), and the handler.
server.tool( 'list_calls', 'Lists all Vapi calls', {}, createToolHandler(async () => { const calls = await vapiClient.calls.list({ limit: 10 }); return calls.map(transformCallOutput); }) ); - src/tools/utils.ts:44-72 (helper)The createToolHandler wrapper used by list_calls. It handles auth checking (valid token, auth flow), calls the actual handler, and wraps results in success/error responses.
export function createToolHandler<T>( handler: (params: T) => Promise<any> ): (params: T) => Promise<ToolResponse> { return async (params: T) => { // Check auth first if (!hasValidToken()) { // Start auth if not already in progress if (!isAuthInProgress()) { try { await startAuthFlow(); } catch (error) { // Ignore - we'll show the auth URL below } } const url = getAuthUrl(); if (url) { return createAuthRequiredResponse(url); } return createErrorResponse('Authentication required. Please use vapi_login tool first.'); } try { const result = await handler(params); return createSuccessResponse(result); } catch (error) { return createErrorResponse(error); } }; } - src/schemas/index.ts:290-301 (schema)The CallOutputSchema used by transformCallOutput to validate the structure of call data returned from list_calls.
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/index.ts:9-14 (registration)The registerAllTools function that calls registerCallTools, which in turn registers the list_calls tool on the MCP server.
export const registerAllTools = (server: McpServer, vapiClient: VapiClient) => { registerAssistantTools(server, vapiClient); registerCallTools(server, vapiClient); registerPhoneNumberTools(server, vapiClient); registerToolTools(server, vapiClient); };