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 }),
      }],
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Strong disclosure of scope limitations given no annotations: explicitly clarifies this extracts only API surface (signatures, line ranges) versus full content. Could mention if results are cached or any performance characteristics, but clearly defines the lightweight/skeleton nature of the return data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences with zero waste. Front-loaded with the core value proposition (signatures without body), followed by specific return contents, and closing with the use case. No repetition of tool name or tautology.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Compensates well for missing output schema by enumerating specific return elements (function names, parameters, return types, line ranges). Given single-parameter simplicity and no annotations, provides sufficient context for an agent to understand the tool's contract, though response format structure (JSON vs text) isn't specified.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with 'file_path' fully documented. The description references 'specific file' which aligns with the parameter semantics but doesn't add syntax details, format constraints, or examples beyond the schema's 'relative to project root' specification.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Excellent specificity with 'Get detailed function signatures, class methods, and type definitions' defining the exact resource extracted. The 'WITHOUT reading the full body' clause effectively distinguishes this from full-content retrieval tools in the sibling set (like retrieve_with_traversal).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear contextual guidance: 'Perfect for understanding how to use code without loading it all' defines the efficiency use case. The 'WITHOUT reading the full body' phrase implicitly indicates when not to use it (when you need implementation details), though it doesn't explicitly name the alternative tool for that case.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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