UNPKG

@vapi-ai/mcp-server

Version:
19 lines (18 loc) 1.01 kB
import { CallInputSchema, GetCallInputSchema } from '../schemas/index.js'; import { transformCallInput, transformCallOutput, } from '../transformers/index.js'; import { createToolHandler } from './utils.js'; export const registerCallTools = (server, 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); })); 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); })); };