Skip to main content
Glama
VapiAI

Vapi MCP Server

Official
by VapiAI

update_assistant

Update an existing Vapi assistant by modifying its name, instructions, LLM configuration, tools, transcriber, voice, or first message. Provide the assistant ID and the fields to change.

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

  • The handler function that executes the 'update_assistant' tool logic. It validates the assistant exists, transforms input data, calls the Vapi API to update, and returns the transformed output.
    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;
        }
      })
    );
  • The Zod schema for UpdateAssistantInputSchema, defining all input fields accepted by the 'update_assistant' tool: assistantId (required), name, instructions, llm, toolIds, transcriber, voice, firstMessage, and firstMessageMode (all optional).
    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'),
    });
  • The transformUpdateAssistantInput helper function that converts user-provided input into the Vapi.UpdateAssistantDto format. It conditionally builds the DTO object based on which fields were provided by the user.
    export function transformUpdateAssistantInput(
      input: z.infer<typeof UpdateAssistantInputSchema>
    ): Vapi.UpdateAssistantDto {
      const updateDto: any = {};
    
      if (input.name) {
        updateDto.name = input.name;
      }
    
      if (input.llm) {
        updateDto.model = {
          provider: input.llm.provider as any,
          model: input.llm.model,
        };
    
        if (input.toolIds && input.toolIds.length > 0) {
          updateDto.model.toolIds = input.toolIds;
        }
    
        if (input.instructions) {
          updateDto.model.messages = [
            {
              role: 'system',
              content: input.instructions,
            },
          ];
        }
      } else {
        if (input.toolIds && input.toolIds.length > 0) {
          updateDto.model = { toolIds: input.toolIds };
        }
    
        if (input.instructions) {
          if (!updateDto.model) updateDto.model = {};
          updateDto.model.messages = [
            {
              role: 'system',
              content: input.instructions,
            },
          ];
        }
      }
    
      if (input.transcriber) {
        updateDto.transcriber = {
          provider: input.transcriber.provider,
          ...(input.transcriber.model ? { model: input.transcriber.model } : {}),
        };
      }
    
      if (input.voice) {
        updateDto.voice = {
          provider: input.voice.provider as any,
          voiceId: input.voice.voiceId,
          ...(input.voice.model ? { model: input.voice.model } : {}),
        };
      }
    
      if (input.firstMessage) {
        updateDto.firstMessage = input.firstMessage;
      }
    
      if (input.firstMessageMode) {
        updateDto.firstMessageMode = input.firstMessageMode;
      }
    
      return updateDto as Vapi.UpdateAssistantDto;
    }
  • The registerAssistantTools function that registers the 'update_assistant' tool (along with list_assistants, create_assistant, get_assistant) with the MCP server via server.tool().
    export const registerAssistantTools = (
      server: McpServer,
      vapiClient: VapiClient
    ) => {
      server.tool(
        'list_assistants',
        'Lists all Vapi assistants',
        {},
        createToolHandler(async () => {
          //   console.log('list_assistants');
          const assistants = await vapiClient.assistants.list({ limit: 10 });
          //   console.log('assistants', assistants);
          return assistants.map(transformAssistantOutput);
        })
      );
    
      server.tool(
        'create_assistant',
        'Creates a new Vapi assistant',
        CreateAssistantInputSchema.shape,
        createToolHandler(async (data) => {
          //   console.log('create_assistant', data);
          const createAssistantDto = transformAssistantInput(data);
          const assistant = await vapiClient.assistants.create(createAssistantDto);
          return transformAssistantOutput(assistant);
        })
      );
    
      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;
          }
        })
      );
    
      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;
          }
        })
      );
    };
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavioral traits but only states 'Updates an existing Vapi assistant'. It omits side effects, idempotency, partial update behavior, error conditions, and required permissions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no waste, but it lacks structure or additional context such as usage notes.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (9 parameters, nested objects, no output schema, no annotations), the description provides insufficient context about behavior, return values, or how updates are applied.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The tool description adds no extra meaning beyond the schema's property descriptions (e.g., 'New name', 'New IDs').

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Updates') and the resource ('an existing Vapi assistant'), distinguishing it from siblings like create_assistant, get_assistant, and list_assistants.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like create_assistant or get_assistant, nor are there prerequisites or exclusions mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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