Skip to main content
Glama
VapiAI

Vapi MCP Server

Official
by VapiAI

create_tool

Create custom tools for voice AI applications, including SMS messaging, call transfers, API integrations, and server functions.

Instructions

Creates a new Vapi tool

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoName of the function/tool
descriptionNoDescription of what the function/tool does
smsNoSMS tool configuration - to send text messages
transferCallNoTransfer call tool configuration - to transfer calls to destinations
functionNoCustom function tool configuration - for custom server-side functions
apiRequestNoAPI Request tool configuration - for HTTP API integration
typeYesType of the tool to create

Implementation Reference

  • Core handler logic: transforms input data using transformToolInput, creates new tool via VapiClient.tools.create, transforms output with transformToolOutput.
    createToolHandler(async (data) => {
      const createToolDto = transformToolInput(data);
      const tool = await vapiClient.tools.create(createToolDto);
      return transformToolOutput(tool);
    })
  • Registers the 'create_tool' tool with the MCP server inside registerToolTools function, providing name, description, input schema, and handler.
    server.tool(
      'create_tool',
      'Creates a new Vapi tool',
      CreateToolInputSchema.shape,
      createToolHandler(async (data) => {
        const createToolDto = transformToolInput(data);
        const tool = await vapiClient.tools.create(createToolDto);
        return transformToolOutput(tool);
      })
    );
  • Input validation schema for create_tool, extending BaseToolConfigSchema and requiring tool type.
    export const CreateToolInputSchema = BaseToolConfigSchema.extend({
      type: z.enum(['sms', 'transferCall', 'function', 'apiRequest'])
        .describe('Type of the tool to create'),
    });
  • Utility that wraps any handler function with error handling, success/error response formatting for MCP tools.
    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);
        }
      };
    }

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