Skip to main content
Glama
VapiAI

Vapi MCP Server

Official
by VapiAI

create_assistant

Create a new AI assistant with custom name, instructions, voice, and LLM configuration for conversational applications.

Instructions

Creates a new Vapi assistant

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the assistant
instructionsNoInstructions for the assistantYou are a helpful assistant.
llmNoLLM configuration
toolIdsNoIDs of tools to use with this assistant
transcriberNoTranscription configuration
voiceNoVoice configuration
firstMessageNoFirst message to say to the userHello, how can I help you today?
firstMessageModeNoThis determines who speaks first, either assistant or userassistant-speaks-first

Implementation Reference

  • Registers the 'create_assistant' MCP tool with server.tool(), including name, description, input schema, and inline handler function that transforms input and creates the assistant via Vapi SDK.
    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); }) );
  • Core handler logic wrapped by createToolHandler: transforms input using transformAssistantInput, calls vapiClient.assistants.create, and transforms output.
    createToolHandler(async (data) => { // console.log('create_assistant', data); const createAssistantDto = transformAssistantInput(data); const assistant = await vapiClient.assistants.create(createAssistantDto); return transformAssistantOutput(assistant); })
  • Zod schema defining the input parameters for the create_assistant tool, including name, instructions, llm, toolIds, transcriber, voice, firstMessage, and firstMessageMode.
    export const CreateAssistantInputSchema = z.object({ name: z.string().describe('Name of the assistant'), instructions: z .string() .optional() .default('You are a helpful assistant.') .describe('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}`); } }), ]) .default(DEFAULT_LLM) .describe('LLM configuration'), toolIds: z .array(z.string()) .optional() .describe('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'), }) .default(DEFAULT_TRANSCRIBER) .describe('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'), }) .default(DEFAULT_VOICE) .describe('Voice configuration'), firstMessage: z .string() .optional() .default('Hello, how can I help you today?') .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', ]) .default('assistant-speaks-first') .optional() .describe('This determines who speaks first, either assistant or user'), });
  • Helper function that transforms the Zod-validated input into the Vapi.CreateAssistantDto format required by the Vapi SDK.
    export function transformAssistantInput( input: z.infer<typeof CreateAssistantInputSchema> ): Vapi.CreateAssistantDto { const assistantDto: any = { name: input.name, }; assistantDto.model = { provider: input.llm.provider as any, model: input.llm.model, }; if (input.toolIds && input.toolIds.length > 0) { assistantDto.model.toolIds = input.toolIds; } if (input.instructions) { assistantDto.model.messages = [ { role: 'system', content: input.instructions, }, ]; } assistantDto.transcriber = { provider: input.transcriber.provider, ...(input.transcriber.model ? { model: input.transcriber.model } : {}), }; assistantDto.voice = { provider: input.voice.provider as any, voiceId: input.voice.voiceId, ...(input.voice.model ? { model: input.voice.model } : {}), }; if (input.firstMessage) { assistantDto.firstMessage = input.firstMessage; } if (input.firstMessageMode) { assistantDto.firstMessageMode = input.firstMessageMode; } return assistantDto as Vapi.CreateAssistantDto; }

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