describe_tool
Retrieve detailed information and input schema for any tool, enabling you to see exact parameters before calling it.
Instructions
Get detailed information about a specific tool, including its input schema. Use this to see the exact parameters a tool expects before calling it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Tool name to describe |
Implementation Reference
- The handleDescribeTool function is the main handler for the describe_tool meta-tool. It extracts the 'name' argument, calls describeTool() to look up tool info, and returns the result as a JSON response.
export async function handleDescribeTool( ctx: MCPServerContext, args: Record<string, unknown>, ): Promise<ToolResponse> { const name = args.name as string; if (!name || typeof name !== 'string') { return asTextResponse( JSON.stringify({ success: false, error: 'name must be a non-empty string' }), ); } const toolInfo = describeTool(name, ctx); if (!toolInfo) { return asTextResponse(JSON.stringify({ success: false, error: `Tool not found: ${name}` })); } return asTextResponse(JSON.stringify({ success: true, tool: toolInfo }, null, 2)); } - The describeTool() utility function looks up a tool by name using getToolInputSchema and getToolDescription, normalizing the name first. Returns the tool's name, description, and inputSchema, or null if not found.
export function describeTool( toolName: string, ctx: MCPServerContext, ): { name: string; description: string; inputSchema: Tool['inputSchema'] } | null { const canonicalName = normalizeToolName(toolName); const schema = getToolInputSchema(canonicalName, ctx); if (!schema) { return null; } return { name: canonicalName, description: getToolDescription(canonicalName, ctx), inputSchema: schema, }; } - src/server/ToolRouter.probe.ts:29-51 (helper)The getToolInputSchema() function retrieves a tool's input schema by checking built-in tools, extension tools, and meta-tools in order, used by describeTool.
export function getToolInputSchema( toolName: string, ctx: MCPServerContext, ): Tool['inputSchema'] | undefined { const canonicalName = normalizeToolName(toolName); const builtInTool = getAllToolsByName().get(canonicalName); if (builtInTool) { return builtInTool.inputSchema; } const extTool = ctx.extensionToolsByName.get(canonicalName); if (extTool) { return extTool.tool.inputSchema; } const metaTool = ctx.metaToolsByName.get(canonicalName); if (metaTool) { return metaTool.inputSchema; } return undefined; } - src/server/ToolRouter.probe.ts:53-72 (helper)The getToolDescription() function retrieves a tool's description by checking built-in tools, extension tools, and meta-tools in order, used by describeTool.
export function getToolDescription(toolName: string, ctx: MCPServerContext): string { const canonicalName = normalizeToolName(toolName); const builtInTool = getAllToolsByName().get(canonicalName); if (builtInTool?.description) { return builtInTool.description.split('\n')[0] || 'No description available'; } const extTool = ctx.extensionToolsByName.get(canonicalName); if (extTool?.tool?.description) { return extTool.tool.description.split('\n')[0] || 'No description available'; } const metaTool = ctx.metaToolsByName.get(canonicalName); if (metaTool?.description) { return metaTool.description.split('\n')[0] || 'No description available'; } return 'No description available'; } - src/server/MCPServer.search.ts:114-127 (registration)Registration of the describe_tool meta-tool with its name, description, inputSchema (requiring a 'name' string), and handler reference (handleDescribeTool).
{ name: 'describe_tool', description: 'Get detailed information about a specific tool, including its input schema. ' + 'Use this to see the exact parameters a tool expects before calling it.', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Tool name to describe' }, }, required: ['name'], }, handler: handleDescribeTool, }, - src/server/MCPServer.search.ts:241-248 (registration)Meta-tools are populated into ctx.metaToolsByName for describe_tool lookups, ensuring describe_tool can find the meta-tools' schemas.
// Populate metaToolsByName for describe_tool lookups (single source) ctx.metaToolsByName.set(def.name, { name: def.name, description: def.description.split('\n')[0] || def.description, inputSchema: def.inputSchema as Tool['inputSchema'], }); } } - The normalizeToolName() helper strips the 'mcp__' prefix if present, used by describeTool to canonicalize tool names.
export function normalizeToolName(name: string): string { const trimmed = name.trim(); if (!trimmed.startsWith('mcp__')) { return trimmed; } const parts = trimmed.split('__'); if (parts.length < 3) { return trimmed; } return parts.slice(2).join('__'); }