get-tool
Retrieve the complete schema, including input details, for a specific tool on any MCP server. Ensures accurate usage by requiring server name and tool name.
Instructions
Get complete schema for a specific tool from a specific server, including inputSchema. TIP: Use find-tools first to discover the tool and get the correct serverName and toolName
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serverName | Yes | Name of the MCP server containing the tool | |
| toolName | Yes | Exact name of the tool to retrieve |
Implementation Reference
- src/index.ts:185-208 (handler)MCP tool handler for 'get-tool': extracts parameters, calls serverManager.getTool, returns formatted tool schema or error response.async (args, extra) => { try { const { serverName, toolName } = args; const tool = await serverManager.getTool(serverName, toolName); return { content: [ { type: "text", text: JSON.stringify(tool, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error getting tool: ${(error as Error).message}`, }, ], }; } }
- src/types.ts:83-94 (schema)Zod schema defining the input parameters for the 'get-tool' tool: serverName and toolName.export const GetToolParamsSchema = z.object({ serverName: z .string() .describe("Name of the MCP server containing the tool"), toolName: z .string() .describe("Exact name of the tool to retrieve"), }); export type GetToolParams = z.infer< typeof GetToolParamsSchema >;
- src/index.ts:178-209 (registration)Registration of the 'get-tool' tool on the MCP server using server.tool(), including name, description, schema reference, and handler.server.tool( "get-tool", "Get complete schema for a specific tool from a specific server, including inputSchema. TIP: Use find-tools first to discover the tool and get the correct serverName and toolName", { serverName: GetToolParamsSchema.shape.serverName, toolName: GetToolParamsSchema.shape.toolName, }, async (args, extra) => { try { const { serverName, toolName } = args; const tool = await serverManager.getTool(serverName, toolName); return { content: [ { type: "text", text: JSON.stringify(tool, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error getting tool: ${(error as Error).message}`, }, ], }; } } );
- src/server-manager.ts:239-254 (helper)Helper method in McpServerManager that implements the core logic for retrieving a specific tool's schema by listing all tools and filtering by name.async getTool(serverName: string, toolName: string): Promise<any> { const client = this.getClient(serverName); const toolsResponse = await client.listTools(); if (!toolsResponse.tools || !Array.isArray(toolsResponse.tools)) { throw new Error(`No tools found on server '${serverName}'`); } const tool = toolsResponse.tools.find((t: any) => t.name === toolName); if (!tool) { throw new Error(`Tool '${toolName}' not found on server '${serverName}'`); } return tool; }