get_file_skeleton
Extract function signatures, class methods, and type definitions from a file to understand its API surface without reading the full code.
Instructions
Get detailed function signatures, class methods, and type definitions of a specific file WITHOUT reading the full body. Shows the API surface: function names, parameters, return types, and line ranges. Perfect for understanding how to use code without loading it all.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Path to the file to inspect (relative to project root). |
Implementation Reference
- src/tools/file-skeleton.ts:36-59 (handler)The main handler function for the `get_file_skeleton` tool, which analyzes a file's structure and returns a summary of its symbols and their line ranges.
export async function getFileSkeleton(options: SkeletonOptions): Promise<string> { const fullPath = resolve(options.rootDir, options.filePath); if (!isSupportedFile(fullPath)) { const content = await readFile(fullPath, "utf-8"); const preview = content.split("\n").slice(0, 20).join("\n"); return `[Unsupported language, showing first 20 lines]\n\n${preview}`; } const analysis = await analyzeFile(fullPath); if (analysis.symbols.length === 0) { const content = await readFile(fullPath, "utf-8"); const preview = content.split("\n").slice(0, 30).join("\n"); return `[No symbols detected, showing first 30 lines]\n\n${preview}`; } return [ `File: ${options.filePath} (${analysis.lineCount} lines)`, `Symbols: ${analysis.symbols.length} top-level definitions`, "", formatSignatureBlock(analysis), ].join("\n"); } - src/tools/file-skeleton.ts:8-11 (schema)Input type definition for `getFileSkeleton`.
export interface SkeletonOptions { filePath: string; rootDir: string; } - src/index.ts:222-232 (registration)Registration of the `get_file_skeleton` tool within the MCP tool handler.
"get_file_skeleton", "Get detailed function signatures, class methods, and type definitions of a specific file WITHOUT reading the full body. " + "Shows the API surface: function names, parameters, return types, and line ranges. Perfect for understanding how to use code without loading it all.", { file_path: z.string().describe("Path to the file to inspect (relative to project root)."), }, withRequestActivity(async ({ file_path }) => ({ content: [{ type: "text" as const, text: await getFileSkeleton({ rootDir: ROOT_DIR, filePath: file_path }), }],