Skip to main content
Glama
VapiAI

Vapi MCP Server

Official
by VapiAI

update_tool

Modify an existing Vapi tool's configuration to update SMS, call transfer, custom functions, or API integration settings.

Instructions

Updates an existing 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
toolIdYesID of the tool to update

Implementation Reference

  • The core handler function for 'update_tool': transforms the input using transformUpdateToolInput, updates the tool via VapiClient.tools.update, and returns the transformed output.
    createToolHandler(async (data) => { const updateToolDto = transformUpdateToolInput(data); const tool = await vapiClient.tools.update(data.toolId, updateToolDto); return transformToolOutput(tool); })
  • Registers the 'update_tool' MCP tool on the server, specifying name, description, input schema, and handler.
    server.tool( 'update_tool', 'Updates an existing Vapi tool', UpdateToolInputSchema.shape, createToolHandler(async (data) => { const updateToolDto = transformUpdateToolInput(data); const tool = await vapiClient.tools.update(data.toolId, updateToolDto); return transformToolOutput(tool); }) );
  • Zod input schema definition for the update_tool, extending BaseToolConfigSchema with toolId.
    export const UpdateToolInputSchema = BaseToolConfigSchema.extend({ toolId: z.string().describe('ID of the tool to update'), });
  • Generic helper function that wraps tool handlers to provide error handling and standardize ToolResponse format.
    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); } };
  • Transformer function that converts the UpdateToolInputSchema into the Vapi UpdateToolDto format.
    export function transformUpdateToolInput( input: z.infer<typeof UpdateToolInputSchema> ): any { let updateDto: any = {}; // Add function definition if name and description are provided if (input.name || input.description) { updateDto.function = { ...(input.name && { name: input.name }), ...(input.description && { description: input.description }), }; } // Handle SMS tool configuration if (input.sms?.metadata) { updateDto.metadata = input.sms.metadata; } // Handle Transfer call tool configuration if (input.transferCall?.destinations) { updateDto.destinations = input.transferCall.destinations; } // Handle Function tool configuration if (input.function?.parameters && input.function?.server) { // For function tools, add parameters to the existing function object if (updateDto.function) { updateDto.function.parameters = input.function.parameters; } else { updateDto.function = { parameters: input.function.parameters, }; } updateDto.server = { url: input.function.server.url, ...(input.function.server.headers && { headers: input.function.server.headers }), }; } // Handle API Request tool configuration if (input.apiRequest) { if (input.apiRequest.url) updateDto.url = input.apiRequest.url; if (input.apiRequest.method) updateDto.method = input.apiRequest.method; if (input.apiRequest.headers) updateDto.headers = input.apiRequest.headers; if (input.apiRequest.body) updateDto.body = input.apiRequest.body; if (input.apiRequest.backoffPlan) updateDto.backoffPlan = input.apiRequest.backoffPlan; if (input.apiRequest.timeoutSeconds) updateDto.timeoutSeconds = input.apiRequest.timeoutSeconds; } return updateDto; }

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