Skip to main content
Glama
transparentlyok

MCP Context Manager

get_file_summary

Extract file structure including exports, functions, classes, and imports to understand code organization without reading full implementation details.

Instructions

⭐ PREFERRED FOR FILE OVERVIEW: Get file structure (exports, functions, classes, imports) without reading full content. Use this INSTEAD OF Read when you need to understand what's in a file without seeing implementation details. Saves 90% tokens.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to the file relative to repository root

Implementation Reference

  • The actual implementation logic for get_file_summary tool.
    async getFileSummary(filePath: string): Promise<string> {
      const fileIndex = this.indexer.getFileIndex(filePath);
    
      if (!fileIndex) {
        return `File "${filePath}" not found in index.\nMake sure the file exists and the repository is indexed.`;
      }
    
      let summary = `File: ${filePath}\n`;
      summary += `Language: ${fileIndex.language}\n`;
      summary += `Lines: ${fileIndex.lines}\n`;
      summary += `Size: ${this.formatBytes(fileIndex.size)}\n\n`;
    
      if (fileIndex.imports.length > 0) {
        summary += `Imports (${fileIndex.imports.length}):\n`;
        summary += fileIndex.imports.slice(0, 10).map((imp) => `  - ${imp}`).join('\n');
        if (fileIndex.imports.length > 10) {
          summary += `\n  ... and ${fileIndex.imports.length - 10} more`;
        }
        summary += '\n\n';
      }
    
      if (fileIndex.exports.length > 0) {
        summary += `Exports (${fileIndex.exports.length}):\n`;
        summary += fileIndex.exports.map((exp) => `  - ${exp}`).join('\n') + '\n\n';
      }
    
      if (fileIndex.symbols.length > 0) {
        const byType = this.groupByType(fileIndex.symbols);
    
        for (const [type, symbols] of Object.entries(byType)) {
          summary += `${type}s (${symbols.length}):\n`;
          summary += symbols
            .map((s) => `  - ${s.name} (line ${s.line})${s.signature ? `: ${s.signature}` : ''}`)
            .join('\n');
  • Tool registration and schema definition for get_file_summary.
    {
      name: 'get_file_summary',
      description: '⭐ PREFERRED FOR FILE OVERVIEW: Get file structure (exports, functions, classes, imports) without reading full content. Use this INSTEAD OF Read when you need to understand what\'s in a file without seeing implementation details. Saves 90% tokens.',
      inputSchema: {
        type: 'object',
        properties: {
          filePath: {
            type: 'string',
            description: 'Path to the file relative to repository root',
          },
        },
        required: ['filePath'],
      },
    },
  • src/index.ts:485-502 (registration)
    The request handler switch-case that calls the retriever.getFileSummary function.
    case 'get_file_summary': {
      const a = args as any;
      const filePath: string = a.filePath || a.path || a.file;
      if (!filePath) {
        return {
          content: [{ type: 'text', text: 'Error: filePath is required.' }],
          isError: true,
        };
      }
      const result = await retriever.getFileSummary(filePath);
      return {
        content: [
          {
            type: 'text',
            text: result,
          },
        ],
      };
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: it's a read-only operation (implied by 'get'), it provides structured metadata rather than full content, and it offers efficiency benefits ('saves 90% tokens'). However, it doesn't mention potential limitations like file size constraints or supported file types.

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?

The description is extremely concise and front-loaded, with every sentence earning its place. The first sentence establishes purpose and value, the second provides usage guidance, and the third quantifies efficiency benefits. There's zero wasted text.

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?

Given the tool's moderate complexity (single parameter, no output schema, no annotations), the description provides excellent context about what the tool does and when to use it. It effectively compensates for the lack of annotations and output schema by clearly explaining the tool's behavior and value proposition. The only minor gap is not specifying what exactly 'file structure' includes beyond the listed elements.

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?

With 100% schema description coverage, the input schema already fully documents the single parameter. The description doesn't add any parameter-specific information beyond what's in the schema, so it meets the baseline score of 3 for adequate coverage when the schema does the heavy lifting.

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?

The description clearly states the tool's purpose with specific verbs ('get file structure') and resources ('exports, functions, classes, imports'), and explicitly distinguishes it from sibling tools by naming 'Read' as an alternative. It provides concrete value ('without reading full content', 'saves 90% tokens').

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool ('PREFERRED FOR FILE OVERVIEW', 'when you need to understand what's in a file without seeing implementation details') and when not to use it ('INSTEAD OF Read'). It clearly positions this tool against a specific alternative in the context.

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/transparentlyok/mcp-context-manager'

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