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
| Name | Required | Description | Default |
|---|---|---|---|
| toolId | Yes | ID of the tool to get |
Implementation Reference
- src/tools/tool.ts:22-30 (registration)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); }) );
- src/schemas/index.ts:327-329 (schema)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'), });
- src/tools/utils.ts:30-41 (helper)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); } }; }
- src/transformers/index.ts:367-383 (helper)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> || {}, } }; }
- src/tools/index.ts:9-14 (registration)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); };