get_call
Retrieve detailed information about a specific call by providing its call ID. This tool accesses call data including status, duration, and transcripts through the Vapi API.
Instructions
Gets details of a specific call
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| callId | Yes | ID of the call to get |
Implementation Reference
- src/tools/call.ts:36-44 (handler)The handler function for the 'get_call' tool. It receives data with a callId, calls vapiClient.calls.get(data.callId), and transforms the output via transformCallOutput.
server.tool( 'get_call', 'Gets details of a specific call', GetCallInputSchema.shape, createToolHandler(async (data) => { const call = await vapiClient.calls.get(data.callId); return transformCallOutput(call); }) ); - src/tools/call.ts:11-45 (registration)The registerCallTools function that registers 'get_call' (and other call tools) on the MCP server using server.tool().
export const registerCallTools = ( server: McpServer, vapiClient: VapiClient ) => { server.tool( 'list_calls', 'Lists all Vapi calls', {}, createToolHandler(async () => { const calls = await vapiClient.calls.list({ limit: 10 }); return calls.map(transformCallOutput); }) ); server.tool( 'create_call', 'Creates a outbound call', CallInputSchema.shape, createToolHandler(async (data) => { const createCallDto = transformCallInput(data); const call = await vapiClient.calls.create(createCallDto); return transformCallOutput(call as unknown as Vapi.Call); }) ); server.tool( 'get_call', 'Gets details of a specific call', GetCallInputSchema.shape, createToolHandler(async (data) => { const call = await vapiClient.calls.get(data.callId); return transformCallOutput(call); }) ); }; - src/schemas/index.ts:303-305 (schema)The GetCallInputSchema Zod schema for the 'get_call' tool input, defining a required 'callId' string parameter.
export const GetCallInputSchema = z.object({ callId: z.string().describe('ID of the call to get'), }); - src/tools/utils.ts:44-72 (helper)The createToolHandler utility that wraps the handler with authentication checks and error handling.
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/tools/index.ts:9-14 (registration)The registerAllTools function that calls registerCallTools, which registers the 'get_call' tool.
export const registerAllTools = (server: McpServer, vapiClient: VapiClient) => { registerAssistantTools(server, vapiClient); registerCallTools(server, vapiClient); registerPhoneNumberTools(server, vapiClient); registerToolTools(server, vapiClient); };