Skip to main content
Glama

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
NameRequiredDescriptionDefault
file_pathYesPath to the file to inspect (relative to project root).

Implementation Reference

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

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/ForLoopCodes/contextplus'

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