Skip to main content
Glama
VapiAI

Vapi MCP Server

Official
by VapiAI

update_assistant

Modify an existing Vapi assistant's configuration, including its name, instructions, AI model, voice settings, and tools to adapt its behavior.

Instructions

Updates an existing Vapi assistant

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assistantIdYesID of the assistant to update
nameNoNew name for the assistant
instructionsNoNew instructions for the assistant
llmNoNew LLM configuration
toolIdsNoNew IDs of tools to use with this assistant
transcriberNoNew transcription configuration
voiceNoNew voice configuration
firstMessageNoFirst message to say to the user
firstMessageModeNoThis determines who speaks first, either assistant or user

Implementation Reference

  • Core execution logic for the update_assistant tool: validates assistant existence, transforms input parameters, performs the Vapi API update, handles errors, and returns transformed output.
    createToolHandler(async (data) => { const assistantId = data.assistantId; try { // First check if the assistant exists const existingAssistant = await vapiClient.assistants.get(assistantId); if (!existingAssistant) { throw new Error(`Assistant with ID ${assistantId} not found`); } // Transform the update data const updateAssistantDto = transformUpdateAssistantInput(data); // Update the assistant const updatedAssistant = await vapiClient.assistants.update( assistantId, updateAssistantDto ); return transformAssistantOutput(updatedAssistant); } catch (error: any) { console.error(`Error updating assistant: ${error.message}`); throw error; } })
  • Zod schema defining the input parameters for the update_assistant tool, including assistantId (required) and optional fields for name, instructions, LLM, tools, transcriber, voice, firstMessage, and firstMessageMode.
    export const UpdateAssistantInputSchema = z.object({ assistantId: z.string().describe('ID of the assistant to update'), name: z.string().optional().describe('New name for the assistant'), instructions: z .string() .optional() .describe('New instructions for the assistant'), llm: z .union([ LLMSchema, z.string().transform((str) => { try { return JSON.parse(str); } catch (e) { throw new Error(`Invalid LLM JSON string: ${str}`); } }), ]) .optional() .describe('New LLM configuration'), toolIds: z .array(z.string()) .optional() .describe('New IDs of tools to use with this assistant'), transcriber: z .object({ provider: z.string().describe('Provider to use for transcription'), model: z.string().describe('Transcription model to use'), }) .optional() .describe('New transcription configuration'), voice: z .object({ provider: VoiceProviderSchema.describe('Provider to use for voice'), voiceId: z.string().describe('Voice ID to use'), model: z.string().optional().describe('Voice model to use'), }) .optional() .describe('New voice configuration'), firstMessage: z .string() .optional() .describe('First message to say to the user'), firstMessageMode: z .enum([ 'assistant-speaks-first', 'assistant-waits-for-user', 'assistant-speaks-first-with-model-generated-message', ]) .optional() .describe('This determines who speaks first, either assistant or user'), });
  • Registers the 'update_assistant' MCP tool with server.tool, providing name, description, input schema shape, and wrapped handler function within registerAssistantTools.
    server.tool( 'update_assistant', 'Updates an existing Vapi assistant', UpdateAssistantInputSchema.shape, createToolHandler(async (data) => { const assistantId = data.assistantId; try { // First check if the assistant exists const existingAssistant = await vapiClient.assistants.get(assistantId); if (!existingAssistant) { throw new Error(`Assistant with ID ${assistantId} not found`); } // Transform the update data const updateAssistantDto = transformUpdateAssistantInput(data); // Update the assistant const updatedAssistant = await vapiClient.assistants.update( assistantId, updateAssistantDto ); return transformAssistantOutput(updatedAssistant); } catch (error: any) { console.error(`Error updating assistant: ${error.message}`); throw error; } }) );
  • Helper function to transform the tool's input parameters (z.infer<typeof UpdateAssistantInputSchema>) into the Vapi SDK's UpdateAssistantDto format for the API update call.
    'update_assistant', 'Updates an existing Vapi assistant', UpdateAssistantInputSchema.shape, createToolHandler(async (data) => { const assistantId = data.assistantId; try { // First check if the assistant exists const existingAssistant = await vapiClient.assistants.get(assistantId); if (!existingAssistant) { throw new Error(`Assistant with ID ${assistantId} not found`); } // Transform the update data const updateAssistantDto = transformUpdateAssistantInput(data); // Update the assistant const updatedAssistant = await vapiClient.assistants.update( assistantId, updateAssistantDto ); return transformAssistantOutput(updatedAssistant); } catch (error: any) { console.error(`Error updating assistant: ${error.message}`); throw error; } }) ); };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/VapiAI/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server