get_assistant
Retrieve a Vapi assistant using its unique ID to access configuration and details for voice AI integration.
Instructions
Gets a Vapi assistant by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assistantId | Yes | ID of the assistant to get |
Implementation Reference
- src/tools/assistant.ts:47-60 (handler)Core handler function for the 'get_assistant' tool. Extracts assistantId from input, fetches the assistant using vapiClient.assistants.get(), handles not found and other errors, transforms output with transformAssistantOutput, and returns it.createToolHandler(async (data) => { // console.log('get_assistant', data); const assistantId = data.assistantId; try { const assistant = await vapiClient.assistants.get(assistantId); if (!assistant) { throw new Error(`Assistant with ID ${assistantId} not found`); } return transformAssistantOutput(assistant); } catch (error: any) { console.error(`Error getting assistant: ${error.message}`); throw error; } })
- src/schemas/index.ts:197-199 (schema)Zod input schema for the get_assistant tool, validating the required 'assistantId' parameter.export const GetAssistantInputSchema = z.object({ assistantId: z.string().describe('ID of the assistant to get'), });
- src/tools/assistant.ts:43-61 (registration)Registers the 'get_assistant' MCP tool on the server with name, description, input schema, and wrapped handler function.server.tool( 'get_assistant', 'Gets a Vapi assistant by ID', GetAssistantInputSchema.shape, createToolHandler(async (data) => { // console.log('get_assistant', data); const assistantId = data.assistantId; try { const assistant = await vapiClient.assistants.get(assistantId); if (!assistant) { throw new Error(`Assistant with ID ${assistantId} not found`); } return transformAssistantOutput(assistant); } catch (error: any) { console.error(`Error getting assistant: ${error.message}`); throw error; } }) );
- src/tools/utils.ts:30-40 (helper)Helper function that wraps the raw tool handler to provide error handling and standardize the response format as ToolResponse.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); } };