Skip to main content
Glama
bsmi021

MCP File Context Server

by bsmi021

generate_outline

Analyze code files to generate structural outlines showing classes, functions, and imports for TypeScript, JavaScript, and Python.

Instructions

Generate a code outline for a file, showing its structure (classes, functions, imports, etc). Supports TypeScript/JavaScript and Python files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the file to analyze

Implementation Reference

  • The primary handler function for the 'generate_outline' MCP tool. It validates the file path and returns a basic outline containing the file name, type (extension), full path, and timestamp.
        private async handleGenerateOutline(args: any) {
            const { path: filePath } = args;
            await this.loggingService.debug('Generating outline for file', {
                filePath,
                operation: 'generate_outline'
            });
    
            try {
                await this.validateAccess(filePath);
                const outline = `File: ${path.basename(filePath)}
    Type: ${path.extname(filePath) || 'unknown'}
    Path: ${filePath}`;
    
                return this.createJsonResponse({
                    path: filePath,
                    outline,
                    timestamp: new Date().toISOString()
                });
            } catch (error) {
                throw this.handleFileOperationError(error, 'generate outline', filePath);
            }
        }
  • Input schema definition for the generate_outline tool in the MCP server capabilities, specifying the required 'path' parameter.
    generate_outline: {
        description: 'Generate a code outline for a file, showing its structure (classes, functions, imports, etc). Supports TypeScript/JavaScript and Python files.',
        inputSchema: {
            type: 'object',
            properties: {
                path: {
                    type: 'string',
                    description: 'Path to the file to analyze'
                }
            },
            required: ['path']
        }
    }
  • src/index.ts:1546-1558 (registration)
    Tool registration in the ListToolsRequestSchema handler, listing generate_outline with its description and input schema.
        name: 'generate_outline',
        description: 'Generate a code outline for a file, showing its structure (classes, functions, imports, etc). Supports TypeScript/JavaScript and Python files.',
        inputSchema: {
            type: 'object',
            properties: {
                path: {
                    type: 'string',
                    description: 'Path to the file to analyze'
                }
            },
            required: ['path']
        }
    },
  • Routing logic in the main CallToolRequestSchema handler that dispatches generate_outline tool calls to the specific handleGenerateOutline method.
    case 'generate_outline':
        return await this.handleGenerateOutline(request.params.arguments);
  • Supporting helper method in CodeAnalysisService that generates a detailed outline (imports, classes, functions, metrics) matching the tool's description, called by analyzeCode method.
    private async generateOutline(content: string, language: string): Promise<string> {
        const metrics = await this.calculateMetrics(content, language);
    
        const sections: string[] = [];
    
        // Add imports section
        if (metrics.imports.length > 0) {
            sections.push('Imports:', ...metrics.imports.map(imp => `  - ${imp}`));
        }
    
        // Add definitions section
        if (metrics.definitions.classes.length > 0) {
            sections.push('\nClasses:', ...metrics.definitions.classes.map(cls => `  - ${cls}`));
        }
    
        if (metrics.definitions.functions.length > 0) {
            sections.push('\nFunctions:', ...metrics.definitions.functions.map(func => `  - ${func}`));
        }
    
        // Add metrics section
        sections.push('\nMetrics:',
            `  Lines: ${metrics.lineCount.total} (${metrics.lineCount.code} code, ${metrics.lineCount.comment} comments, ${metrics.lineCount.blank} blank)`,
            `  Complexity: ${metrics.complexity}`,
            `  Quality Issues:`,
            `    - ${metrics.quality.longLines} long lines`,
            `    - ${metrics.quality.duplicateLines} duplicate lines`,
            `    - ${metrics.quality.complexFunctions} complex functions`
        );
    
        return sections.join('\n');
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool generates an outline and supports specific languages, but it doesn't describe key behavioral traits such as what the output format looks like (e.g., structured data, text), whether it handles errors for unsupported files, or if there are performance considerations. For a tool with no annotation coverage, this leaves significant gaps in understanding how it behaves.

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

Conciseness4/5

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

The description is concise and well-structured in two sentences: the first states the core purpose, and the second adds language support. There's no wasted text, and it's front-loaded with the main function. However, it could be slightly more efficient by integrating the language support into the first sentence, but it's still highly effective.

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

Completeness2/5

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

Given the tool's complexity (analyzing code structure) and the lack of annotations and output schema, the description is incomplete. It doesn't explain what the generated outline includes (e.g., depth, formatting) or how errors are handled, which are crucial for an AI agent to use it correctly. With no structured data to fill these gaps, the description should provide more context to be fully helpful.

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?

The input schema has 100% description coverage, with the 'path' parameter fully documented in the schema. The description doesn't add any parameter-specific information beyond what's in the schema (e.g., it doesn't clarify path formats or constraints). Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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

Purpose4/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: 'Generate a code outline for a file, showing its structure (classes, functions, imports, etc).' It specifies the verb ('generate'), resource ('code outline'), and scope ('file'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'getFiles' or 'read_context', which might also involve file operations, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

The description provides minimal usage guidance: it mentions supported languages (TypeScript/JavaScript and Python), which implies when to use it for those file types. However, it doesn't offer explicit guidance on when to choose this tool over alternatives like 'getFiles' (which might list files) or 'read_context' (which might read file contents), nor does it mention prerequisites or exclusions. This lack of comparative context limits its helpfulness.

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/bsmi021/mcp-file-context-server'

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