Skip to main content
Glama

analyze-project

Scan a project directory to identify and recommend specialized sub-agents for optimal team composition and task execution.

Instructions

Analyze a project directory and recommend suitable sub-agents

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the project directory to analyze

Implementation Reference

  • Core handler function that performs static analysis of project structure using glob patterns and package.json dependencies to detect project types, technologies, and recommend agents.
    async analyzeProject(projectPath: string): Promise<ProjectAnalysis> {
      const detectedTypes: string[] = [];
      const detectedTechnologies: string[] = [];
      const recommendedAgents = new Set<string>();
      let confidence = 0;
    
      // Analyze file structure
      for (const [type, pattern] of Object.entries(this.patterns)) {
        let typeScore = 0;
        
        // Check for pattern files
        for (const filePattern of pattern.files) {
          const files = await glob(filePattern, { 
            cwd: projectPath,
            ignore: ['node_modules/**', 'dist/**', 'build/**']
          });
          
          if (files.length > 0) {
            typeScore += files.length;
          }
        }
    
        // Check package.json for keywords
        const packageJsonPath = path.join(projectPath, 'package.json');
        try {
          const packageContent = await fs.readFile(packageJsonPath, 'utf-8');
          const packageJson = JSON.parse(packageContent);
          
          const deps = {
            ...packageJson.dependencies || {},
            ...packageJson.devDependencies || {}
          };
    
          for (const keyword of pattern.keywords) {
            if (Object.keys(deps).some(dep => dep.includes(keyword))) {
              typeScore += 2;
              detectedTechnologies.push(keyword);
            }
          }
        } catch (e) {
          // Not a Node.js project, check other files
        }
    
        if (typeScore > 0) {
          detectedTypes.push(type);
          pattern.agents.forEach(agent => recommendedAgents.add(agent));
          confidence += typeScore * 10;
        }
      }
    
      // Add general agents based on project complexity
      if (detectedTypes.length > 2) {
        recommendedAgents.add('project-manager');
        recommendedAgents.add('architect');
      }
    
      // Add QA for any development project
      if (detectedTypes.includes('frontend') || detectedTypes.includes('backend')) {
        recommendedAgents.add('qa-engineer');
      }
    
      // Normalize confidence to 0-100
      confidence = Math.min(confidence, 100);
    
      return {
        projectType: detectedTypes,
        technologies: detectedTechnologies,
        recommendedAgents: Array.from(recommendedAgents),
        confidence
      };
    }
  • src/index.ts:1387-1400 (registration)
    MCP tool registration including name, description, and input schema definition in the ListToolsRequestSchema handler.
    {
      name: 'analyze-project',
      description: 'Analyze a project directory and recommend suitable sub-agents',
      inputSchema: {
        type: 'object',
        properties: {
          projectPath: {
            type: 'string',
            description: 'Path to the project directory to analyze',
          },
        },
        required: ['projectPath'],
      },
    },
  • MCP CallToolRequestSchema handler that extracts projectPath argument, calls projectAnalyzer.analyzeProject, tracks analytics, and returns formatted JSON response.
    case 'analyze-project': {
      const { projectPath } = args as { projectPath: string };
      const analysis = await projectAnalyzer.analyzeProject(projectPath);
      
      // Track project analysis
      trackEvent(AnalyticsEvents.PROJECT_ANALYZED, {
        project_types: analysis.projectType,
        technologies: analysis.technologies,
        recommended_count: analysis.recommendedAgents.length,
        confidence: analysis.confidence,
      });
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              analysis,
              message: `Analyzed project at ${projectPath}. Found ${analysis.projectType.length} project types and recommended ${analysis.recommendedAgents.length} agents.`,
            }, null, 2),
          },
        ],
      };
  • Pattern definitions used by analyzeProject for matching project types via files, keywords, and associated agent recommendations.
    private patterns = {
      frontend: {
        files: ['package.json', 'index.html', '*.jsx', '*.tsx', '*.vue'],
        keywords: ['react', 'vue', 'angular', 'svelte', 'next', 'nuxt'],
        agents: ['frontend-developer', 'ux-designer', 'ui-designer']
      },
      backend: {
        files: ['server.js', 'app.py', 'main.go', 'api/*'],
        keywords: ['express', 'fastapi', 'django', 'spring', 'nest'],
        agents: ['backend-engineer', 'devops-engineer', 'security-engineer']
      },
      mobile: {
        files: ['*.swift', '*.kt', '*.java', 'pubspec.yaml', 'Info.plist'],
        keywords: ['react-native', 'flutter', 'ionic', 'xamarin'],
        agents: ['mobile-developer', 'ui-designer', 'qa-engineer']
      },
      data: {
        files: ['*.ipynb', 'requirements.txt', '*.sql', 'dbt_project.yml'],
        keywords: ['pandas', 'numpy', 'tensorflow', 'scikit-learn', 'jupyter'],
        agents: ['data-scientist', 'data-analyst', 'data-engineer']
      },
      infrastructure: {
        files: ['Dockerfile', 'docker-compose.yml', '*.tf', '.github/workflows/*'],
        keywords: ['kubernetes', 'terraform', 'ansible', 'jenkins'],
        agents: ['devops-engineer', 'cloud-architect', 'security-engineer']
      },
      documentation: {
        files: ['README.md', 'docs/*', '*.rst', 'mkdocs.yml'],
        keywords: ['documentation', 'api-docs', 'user-guide'],
        agents: ['technical-writer', 'content-creator', 'scribe']
      }
    };
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 mentions analysis and recommendation but does not describe how the analysis is performed (e.g., scanning files, detecting dependencies), what the output looks like (e.g., list of agents with reasons), or any constraints like performance impact or permissions needed. This is a significant gap for a tool with no annotations.

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 a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It is front-loaded and every part of the sentence contributes to understanding the tool's function, making it highly concise and well-structured.

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 complexity of analyzing a project and recommending agents, the description is incomplete. It lacks details on the analysis method, output format (no output schema provided), and behavioral traits. With no annotations and an output schema missing, the description does not provide enough context for the agent to understand the full scope and implications of using this tool.

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 description coverage is 100%, with the single parameter 'projectPath' clearly documented in the schema as 'Path to the project directory to analyze'. The description does not add any additional meaning beyond this, such as format examples or constraints, so it meets the baseline of 3 where the schema handles the parameter documentation adequately.

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 action ('analyze a project directory') and the outcome ('recommend suitable sub-agents'), which is specific and actionable. However, it does not explicitly differentiate this tool from sibling tools like 'recommend-by-keywords' or 'search-agents', which might have overlapping functionality, preventing a score of 5.

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. For example, it does not specify if this is for initial project setup, ongoing analysis, or how it differs from 'recommend-by-keywords' or 'search-agents'. This lack of context leaves the agent without clear usage instructions.

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

Related 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/hongsw/claude-agents-power-mcp-server'

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