Skip to main content
Glama
PWalaGov

Enhanced Directory Context MCP Server

by PWalaGov

analyze_project_context

Analyze project structure to generate intelligent context summaries, including code complexity and dependency analysis.

Instructions

Analyze the project structure and provide intelligent context summary

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_code_analysisNoInclude code complexity and dependency analysis
focus_filesNoSpecific files to focus analysis on

Implementation Reference

  • Main handler function that executes the core logic of analyzing the project context, including directory structure, package.json parsing, README preview, file statistics, and listing important files.
    async analyzeProjectContext(includeCodeAnalysis, focusFiles) {
      const structure = await this.getDirectoryStructure(this.workingDirectory, 5);
      const packageJsonPath = path.join(this.workingDirectory, 'package.json');
      const readmePath = path.join(this.workingDirectory, 'README.md');
      
      let analysis = `# Project Context Analysis\n\n`;
      analysis += `**Working Directory:** ${this.workingDirectory}\n\n`;
      
      // Project type detection
      const projectType = await this.detectProjectType();
      analysis += `**Project Type:** ${projectType}\n\n`;
      
      // Package.json analysis
      try {
        const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
        analysis += `**Project Name:** ${packageJson.name || 'Unnamed'}\n`;
        analysis += `**Version:** ${packageJson.version || 'No version'}\n`;
        analysis += `**Description:** ${packageJson.description || 'No description'}\n\n`;
        
        if (packageJson.dependencies) {
          analysis += `**Dependencies:** ${Object.keys(packageJson.dependencies).length}\n`;
        }
        if (packageJson.devDependencies) {
          analysis += `**Dev Dependencies:** ${Object.keys(packageJson.devDependencies).length}\n`;
        }
        analysis += '\n';
      } catch (error) {
        // No package.json found
      }
      
      // README analysis
      try {
        const readme = await fs.readFile(readmePath, 'utf8');
        const lines = readme.split('\n').slice(0, 10);
        analysis += `**README Preview:**\n${lines.join('\n')}\n\n`;
      } catch (error) {
        // No README found
      }
      
      // File statistics
      const stats = this.calculateFileStats(structure);
      analysis += `**File Statistics:**\n`;
      analysis += `- Total Files: ${stats.totalFiles}\n`;
      analysis += `- Total Directories: ${stats.totalDirectories}\n`;
      analysis += `- File Types: ${Object.keys(stats.fileTypes).join(', ')}\n\n`;
      
      // Important files
      const importantFiles = this.identifyImportantFiles(structure);
      if (importantFiles.length > 0) {
        analysis += `**Important Files:**\n`;
        importantFiles.slice(0, 10).forEach(file => {
          analysis += `- ${file.path}\n`;
        });
        analysis += '\n';
      }
      
      return analysis;
  • Input schema defining parameters for the tool: include_code_analysis (boolean, default true) and focus_files (array of strings).
    inputSchema: {
      type: 'object',
      properties: {
        include_code_analysis: {
          type: 'boolean',
          description: 'Include code complexity and dependency analysis',
          default: true,
        },
        focus_files: {
          type: 'array',
          description: 'Specific files to focus analysis on',
          items: { type: 'string' },
        },
      },
    },
  • server.js:138-156 (registration)
    Tool registration object defining name, description, and input schema, added to the tools list for MCP server.
    {
      name: 'analyze_project_context',
      description: 'Analyze the project structure and provide intelligent context summary',
      inputSchema: {
        type: 'object',
        properties: {
          include_code_analysis: {
            type: 'boolean',
            description: 'Include code complexity and dependency analysis',
            default: true,
          },
          focus_files: {
            type: 'array',
            description: 'Specific files to focus analysis on',
            items: { type: 'string' },
          },
        },
      },
    },
  • server.js:466-467 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes tool calls to handleAnalyzeProjectContext.
    case 'analyze_project_context':
      return await this.handleAnalyzeProjectContext(args);
  • Wrapper handler that parses tool arguments and formats the response from the core analyzeProjectContext function.
    async handleAnalyzeProjectContext(args) {
      const { include_code_analysis = true, focus_files } = args;
      const analysis = await this.analyzeProjectContext(include_code_analysis, focus_files);
      
      return {
        content: [
          {
            type: 'text',
            text: analysis,
          },
        ],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'intelligent context summary' but doesn't explain what that means in practice - what kind of analysis is performed, what the output format looks like, whether it's computationally intensive, or what permissions might be required. This leaves significant gaps for a tool that presumably performs complex analysis.

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 a single, efficient sentence that gets straight to the point. It's appropriately sized for a tool with two parameters and no annotations, though it could potentially be more specific about what 'intelligent context summary' entails.

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?

For a tool that performs project analysis with no annotations and no output schema, the description is insufficient. It doesn't explain what 'intelligent context summary' means, what kind of analysis is performed, or what the output looks like. Given the complexity implied by 'analyze' and 'intelligent,' more behavioral context is needed.

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 schema already documents both parameters thoroughly. The description adds no additional parameter information beyond what's in the schema. The baseline score of 3 reflects adequate parameter documentation through the schema alone.

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 with a specific verb ('analyze') and resource ('project structure'), and specifies the output ('intelligent context summary'). However, it doesn't explicitly differentiate from sibling tools like 'get_directory_structure' or 'get_git_context' that might provide related but different functionality.

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 no guidance on when to use this tool versus alternatives. With sibling tools like 'get_directory_structure' and 'get_git_context' available, there's no indication of when this analysis tool is preferable or what specific context it provides that others don't.

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/PWalaGov/File-Control-MCP'

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