Skip to main content
Glama

analyze_project_ecosystem

Analyze project ecosystems to generate architectural decision records by examining codebases, dependencies, and technologies with recursive analysis.

Instructions

Comprehensive recursive project ecosystem analysis with advanced prompting techniques (Knowledge Generation + Reflexion)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathNoPath to the project directory to analyze (optional, uses configured PROJECT_PATH if not provided)
includePatternsNoFile patterns to include in analysis
enhancedModeNoEnable advanced prompting features (Knowledge Generation + Reflexion)
knowledgeEnhancementNoEnable Knowledge Generation for technology-specific insights
learningEnabledNoEnable Reflexion learning from past analysis outcomes
technologyFocusNoSpecific technologies to focus analysis on (auto-detected if not provided)
analysisDepthNoDepth of ecosystem analysiscomprehensive
includeEnvironmentNoAutomatically include comprehensive environment analysis (default: true)
recursiveDepthNoDepth of recursive project analysiscomprehensive
analysisScopeNoSpecific analysis areas to focus on (e.g., ["security", "performance", "architecture", "dependencies"])
conversationContextNoRich context from the calling LLM about user goals and discussion history

Implementation Reference

  • Core handler function that creates the CE-MCP OrchestrationDirective for comprehensive project ecosystem analysis. Defines sandbox operations for phased analysis including file scanning, environment config, knowledge enhancement, and context assembly.
    export function createAnalyzeProjectEcosystemDirective(
      args: CEMCPAnalyzeProjectEcosystemArgs
    ): OrchestrationDirective {
      const {
        projectPath,
        analysisDepth = 'comprehensive',
        includeEnvironment = true,
        knowledgeEnhancement = getKnowledgeEnhancementDefault(), // Environment-aware default
        // learningEnabled is used for future reflexion integration
        learningEnabled: _learningEnabled = true,
        technologyFocus = [],
        analysisScope = [],
      } = args;
      void _learningEnabled; // Mark as intentionally unused for now
    
      const operations: SandboxOperation[] = [
        // Phase 1: Load project structure
        {
          op: 'analyzeFiles',
          args: {
            patterns: ['**/*.ts', '**/*.js', '**/*.json', '**/*.yaml', '**/*.yml'],
            maxFiles: analysisDepth === 'basic' ? 50 : analysisDepth === 'standard' ? 100 : 200,
          },
          store: 'projectFiles',
        },
    
        // Phase 2: Scan environment configuration
        {
          op: 'scanEnvironment',
          store: 'environmentConfig',
        },
    
        // Phase 3: Load architectural knowledge (conditional on knowledgeEnhancement)
        ...(knowledgeEnhancement
          ? [
              {
                op: 'loadKnowledge' as const,
                args: {
                  domain: 'architecture',
                  scope: 'project',
                  technologies: technologyFocus,
                },
                store: 'architecturalKnowledge',
              },
            ]
          : []),
    
        // Phase 4: Load analysis prompt (lazy loading)
        {
          op: 'loadPrompt',
          args: {
            name: 'analysis',
            section: 'project_analysis',
          },
          store: 'analysisPrompt',
        },
    
        // Phase 5: Generate combined context
        {
          op: 'generateContext',
          args: {
            type: 'ecosystem-analysis',
            depth: analysisDepth,
            includeEnvironment,
            technologyFocus,
            analysisScope,
          },
          inputs: ['projectFiles', 'environmentConfig', 'architecturalKnowledge', 'analysisPrompt'],
          store: 'analysisContext',
        },
    
        // Phase 6: Cache the context for potential reuse
        {
          op: 'cacheResult',
          args: {
            key: `ecosystem-analysis:${projectPath}:${analysisDepth}`,
            ttl: 3600, // 1 hour cache
          },
          input: 'analysisContext',
        },
    
        // Phase 7: Compose final result
        {
          op: 'composeResult',
          inputs: ['projectFiles', 'environmentConfig', 'architecturalKnowledge', 'analysisContext'],
          return: true,
        },
      ];
    
      return {
        type: 'orchestration_directive',
        version: '1.0',
        tool: 'analyze_project_ecosystem',
        description: `Comprehensive ecosystem analysis for ${projectPath} with ${analysisDepth} depth`,
        sandbox_operations: operations,
        compose: {
          sections: [
            { source: 'projectFiles', key: 'projectStructure', transform: 'summarize' },
            { source: 'environmentConfig', key: 'environment' },
            { source: 'architecturalKnowledge', key: 'knowledge', transform: 'extract' },
            { source: 'analysisContext', key: 'analysisContext' },
          ],
          template: 'ecosystem_analysis_report',
          format: 'markdown',
        },
        output_schema: {
          type: 'object',
          properties: {
            projectStructure: {
              type: 'object',
              description: 'Summary of project files and structure',
            },
            environment: {
              type: 'object',
              description: 'Environment configuration analysis',
            },
            knowledge: {
              type: 'object',
              description: 'Architectural knowledge context',
            },
            analysisContext: {
              type: 'object',
              description: 'Combined analysis context',
            },
          },
        },
        metadata: {
          estimated_tokens: 4000, // Down from ~12K
          complexity: 'high',
          cacheable: true,
          cache_key: `ecosystem-${projectPath}-${analysisDepth}`,
        },
      };
    }
  • TypeScript interface defining the input arguments/schema for the analyze_project_ecosystem tool.
    export interface CEMCPAnalyzeProjectEcosystemArgs {
      projectPath: string;
      analysisDepth?: 'basic' | 'standard' | 'comprehensive';
      includeEnvironment?: boolean;
      knowledgeEnhancement?: boolean;
      learningEnabled?: boolean;
      technologyFocus?: string[];
      analysisScope?: string[];
    }
  • Tool registration in the central TOOL_CATALOG with metadata, description, input schema, and CE-MCP flag.
    TOOL_CATALOG.set('analyze_project_ecosystem', {
      name: 'analyze_project_ecosystem',
      shortDescription: 'Comprehensive project analysis with architectural insights',
      fullDescription:
        'Analyzes the entire project ecosystem including structure, dependencies, architecture patterns, and provides actionable recommendations. Supports knowledge enhancement and reflexion learning.',
      category: 'analysis',
      complexity: 'complex',
      tokenCost: { min: 8000, max: 15000 },
      hasCEMCPDirective: true,
      relatedTools: ['get_architectural_context', 'analyze_environment', 'smart_score'],
      keywords: ['project', 'analysis', 'architecture', 'ecosystem', 'comprehensive'],
      requiresAI: true,
      inputSchema: {
        type: 'object',
        properties: {
          projectPath: { type: 'string', description: 'Path to the project to analyze' },
          analysisDepth: {
            type: 'string',
            enum: ['basic', 'standard', 'comprehensive'],
            default: 'comprehensive',
          },
          includeEnvironment: { type: 'boolean', default: true },
          knowledgeEnhancement: { type: 'boolean', default: true },
          learningEnabled: { type: 'boolean', default: true },
          technologyFocus: { type: 'array', items: { type: 'string' } },
          analysisScope: { type: 'array', items: { type: 'string' } },
        },
        required: ['projectPath'],
      },
    });
  • Tool dispatch/registration in getCEMCPDirective switch statement that routes calls to the handler function.
    case 'analyze_project_ecosystem':
      return createAnalyzeProjectEcosystemDirective(
        args as unknown as CEMCPAnalyzeProjectEcosystemArgs
      );
  • Listed as CE-MCP enabled tool in shouldUseCEMCPDirective helper function that determines directive mode.
      'analyze_project_ecosystem',
      'suggest_adrs',
      'generate_rules',
      'analyze_environment',
      'deployment_readiness',
      // Phase 4.2 tools
      'smart_score',
      'perform_research',
      'generate_adrs_from_prd',
      'interactive_adr_planning',
      'mcp_planning',
      'troubleshoot_guided_workflow',
      // Phase 5: OpenRouter Elimination
      'tool_chain_orchestrator',
    ];

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/tosin2013/mcp-adr-analysis-server'

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