Skip to main content
Glama

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
NameRequiredDescriptionDefault
serverNameYesName of the MCP server containing the tool
toolNameYesExact name of the tool to retrieve

Implementation Reference

  • 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}`, }, ], }; } }
  • 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}`, }, ], }; } } );
  • 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; }

Other Tools

Related Tools

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/warpdev/mcp-hub-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server