Skip to main content
Glama
VapiAI

Vapi MCP Server

Official
by VapiAI

get_tool

Retrieve details for a specific tool by its ID to access Vapi API capabilities through the Model Context Protocol.

Instructions

Gets details of a specific tool

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toolIdYesID of the tool to get

Implementation Reference

  • Registers the MCP tool named 'get_tool'. The handler fetches the tool details from Vapi API using the provided toolId and transforms the output.
    server.tool( 'get_tool', 'Gets details of a specific tool', GetToolInputSchema.shape, createToolHandler(async (data) => { const tool = await vapiClient.tools.get(data.toolId); return transformToolOutput(tool); }) );
  • Zod input schema for the get_tool tool, defining the required 'toolId' parameter.
    export const GetToolInputSchema = z.object({ toolId: z.string().describe('ID of the tool to get'), });
  • Helper function that wraps the raw tool handler with try-catch error handling and standardizes the response format to ToolResponse.
    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); } }; }
  • Helper function that transforms the raw Vapi tool response into the standardized output schema used by the get_tool tool.
    export function transformToolOutput( tool: Vapi.ToolsGetResponse ): z.infer<typeof ToolOutputSchema> { return { id: tool.id, createdAt: tool.createdAt, updatedAt: tool.updatedAt, type: tool.type || '', name: tool.function?.name || '', description: tool.function?.description || '', parameters: tool.function?.parameters || {}, server: { url: tool.server?.url || '', headers: tool.server?.headers as Record<string, string> || {}, } }; }
  • Top-level registration function that calls registerToolTools to include the get_tool tool among all tools.
    export const registerAllTools = (server: McpServer, vapiClient: VapiClient) => { registerAssistantTools(server, vapiClient); registerCallTools(server, vapiClient); registerPhoneNumberTools(server, vapiClient); registerToolTools(server, vapiClient); };

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