Skip to main content
Glama
emmron
by emmron

mcp__gemini__analyze_intelligence

Analyze code for performance prediction, business impact, and trends. Generate quality metrics and assess project insights using comprehensive AI-powered code intelligence.

Instructions

Deep code analysis with performance prediction, business impact assessment, and trend analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analysis_typeNoAnalysis typecomprehensive
generate_metricsNoGenerate quality metrics
include_business_impactNoInclude business impact analysis
performance_predictionNoEnable performance prediction
targetYesCode/project to analyze

Implementation Reference

  • The main handler function implementing the tool's logic: multi-layered AI analysis including architecture, code quality, security, optional business impact, performance prediction, and metrics storage.
        handler: async (args) => {
          const { target, analysis_type = 'comprehensive', include_business_impact = true, performance_prediction = true, generate_metrics = true } = args;
          validateString(target, 'target');
          
          const timer = performanceMonitor.startTimer('analyze_intelligence');
          
          // Multi-layered analysis
          const analysisPrompt = `Perform ${analysis_type} intelligence analysis:
    
    Target: ${target}
    
    Provide comprehensive analysis covering:
    
    1. **Architecture Assessment**
       - Design patterns and principles
       - Structural quality and organization
       - Scalability considerations
       - Technology stack evaluation
    
    2. **Code Quality Analysis**
       - Maintainability index
       - Complexity metrics
       - Technical debt assessment
       - Best practices compliance
    
    3. **Security Posture**
       - Vulnerability assessment
       - Security pattern usage
       - Risk exposure areas
       - Compliance readiness
    
    ${performance_prediction ? `4. **Performance Intelligence**
       - Performance bottleneck prediction
       - Scalability limits
       - Resource utilization patterns
       - Optimization opportunities` : ''}
    
    ${generate_metrics ? `5. **Quality Metrics**
       - Quantitative quality scores
       - Trend analysis
       - Benchmark comparisons
       - Improvement vectors` : ''}
    
    Be specific with actionable insights and recommendations.`;
    
          const coreAnalysis = await aiClient.call(analysisPrompt, 'analysis', { 
            complexity: 'complex',
            maxTokens: 4000 
          });
          
          let result = `📊 **Intelligence Analysis** (${analysis_type})
    
    ${coreAnalysis}`;
    
          // Business impact analysis
          if (include_business_impact) {
            const businessPrompt = `Analyze business impact for this technical assessment:
    
    ${coreAnalysis}
    
    Provide:
    1. **Financial Impact**
       - Development cost implications
       - Maintenance cost projections
       - Risk mitigation costs
       - ROI of improvements
    
    2. **Operational Impact**
       - Performance implications
       - Reliability considerations
       - Scalability requirements
       - Support overhead
    
    3. **Strategic Considerations**
       - Technology advancement alignment
       - Competitive positioning
       - Future-proofing assessment
       - Innovation opportunities
    
    4. **Executive Summary**
       - Key business risks
       - Investment priorities
       - Timeline recommendations
       - Success metrics
    
    Quantify impacts where possible with dollar estimates and timelines.`;
    
            const businessAnalysis = await aiClient.call(businessPrompt, 'analysis');
            
            result += `
    
    ---
    
    💼 **Business Impact Analysis**
    
    ${businessAnalysis}`;
          }
          
          // Performance prediction
          if (performance_prediction) {
            const performancePrompt = `Create performance prediction model based on analysis:
    
    ${coreAnalysis}
    
    Predict:
    1. **Performance Bottlenecks**
       - Current performance issues
       - Future scalability limits
       - Resource constraints
    
    2. **Load Scenarios**
       - Expected performance under load
       - Breaking points
       - Degradation patterns
    
    3. **Optimization Impact**
       - Potential improvements
       - Implementation effort vs gain
       - Performance ROI
    
    4. **Monitoring Strategy**
       - Key performance indicators
       - Early warning signals
       - Optimization triggers
    
    Provide specific metrics and thresholds.`;
    
            const performancePrediction = await aiClient.call(performancePrompt, 'analysis');
            
            result += `
    
    ---
    
    🚀 **Performance Prediction Model**
    
    ${performancePrediction}`;
          }
          
          // Save analysis to storage for trend tracking
          if (generate_metrics) {
            const analysisData = {
              id: Date.now().toString(),
              target,
              analysis_type,
              timestamp: new Date().toISOString(),
              analysis: coreAnalysis,
              business_impact: include_business_impact,
              performance_prediction: performance_prediction
            };
            
            const storageData = await storage.read('analyses');
            if (!storageData.analyses) storageData.analyses = [];
            storageData.analyses.push(analysisData);
            
            // Keep only last 100 analyses
            if (storageData.analyses.length > 100) {
              storageData.analyses = storageData.analyses.slice(-100);
            }
            
            await storage.write('analyses', storageData);
            
            result += `
    
    **Analysis ID**: ${analysisData.id} (saved for trend tracking)`;
          }
          
          timer.end();
          return result;
        }
  • Input parameters schema defining the tool's expected arguments and their types/descriptions.
    parameters: {
      target: { type: 'string', description: 'Code/project to analyze', required: true },
      analysis_type: { type: 'string', description: 'Analysis type', default: 'comprehensive' },
      include_business_impact: { type: 'boolean', description: 'Include business impact analysis', default: true },
      performance_prediction: { type: 'boolean', description: 'Enable performance prediction', default: true },
      generate_metrics: { type: 'boolean', description: 'Generate quality metrics', default: true }
    },
  • The tool registration entry in the enhanced-tools object, including name, description, schema, and handler reference.
      'mcp__gemini__analyze_intelligence': {
        description: 'Deep code analysis with performance prediction, business impact assessment, and trend analysis',
        parameters: {
          target: { type: 'string', description: 'Code/project to analyze', required: true },
          analysis_type: { type: 'string', description: 'Analysis type', default: 'comprehensive' },
          include_business_impact: { type: 'boolean', description: 'Include business impact analysis', default: true },
          performance_prediction: { type: 'boolean', description: 'Enable performance prediction', default: true },
          generate_metrics: { type: 'boolean', description: 'Generate quality metrics', default: true }
        },
        handler: async (args) => {
          const { target, analysis_type = 'comprehensive', include_business_impact = true, performance_prediction = true, generate_metrics = true } = args;
          validateString(target, 'target');
          
          const timer = performanceMonitor.startTimer('analyze_intelligence');
          
          // Multi-layered analysis
          const analysisPrompt = `Perform ${analysis_type} intelligence analysis:
    
    Target: ${target}
    
    Provide comprehensive analysis covering:
    
    1. **Architecture Assessment**
       - Design patterns and principles
       - Structural quality and organization
       - Scalability considerations
       - Technology stack evaluation
    
    2. **Code Quality Analysis**
       - Maintainability index
       - Complexity metrics
       - Technical debt assessment
       - Best practices compliance
    
    3. **Security Posture**
       - Vulnerability assessment
       - Security pattern usage
       - Risk exposure areas
       - Compliance readiness
    
    ${performance_prediction ? `4. **Performance Intelligence**
       - Performance bottleneck prediction
       - Scalability limits
       - Resource utilization patterns
       - Optimization opportunities` : ''}
    
    ${generate_metrics ? `5. **Quality Metrics**
       - Quantitative quality scores
       - Trend analysis
       - Benchmark comparisons
       - Improvement vectors` : ''}
    
    Be specific with actionable insights and recommendations.`;
    
          const coreAnalysis = await aiClient.call(analysisPrompt, 'analysis', { 
            complexity: 'complex',
            maxTokens: 4000 
          });
          
          let result = `📊 **Intelligence Analysis** (${analysis_type})
    
    ${coreAnalysis}`;
    
          // Business impact analysis
          if (include_business_impact) {
            const businessPrompt = `Analyze business impact for this technical assessment:
    
    ${coreAnalysis}
    
    Provide:
    1. **Financial Impact**
       - Development cost implications
       - Maintenance cost projections
       - Risk mitigation costs
       - ROI of improvements
    
    2. **Operational Impact**
       - Performance implications
       - Reliability considerations
       - Scalability requirements
       - Support overhead
    
    3. **Strategic Considerations**
       - Technology advancement alignment
       - Competitive positioning
       - Future-proofing assessment
       - Innovation opportunities
    
    4. **Executive Summary**
       - Key business risks
       - Investment priorities
       - Timeline recommendations
       - Success metrics
    
    Quantify impacts where possible with dollar estimates and timelines.`;
    
            const businessAnalysis = await aiClient.call(businessPrompt, 'analysis');
            
            result += `
    
    ---
    
    💼 **Business Impact Analysis**
    
    ${businessAnalysis}`;
          }
          
          // Performance prediction
          if (performance_prediction) {
            const performancePrompt = `Create performance prediction model based on analysis:
    
    ${coreAnalysis}
    
    Predict:
    1. **Performance Bottlenecks**
       - Current performance issues
       - Future scalability limits
       - Resource constraints
    
    2. **Load Scenarios**
       - Expected performance under load
       - Breaking points
       - Degradation patterns
    
    3. **Optimization Impact**
       - Potential improvements
       - Implementation effort vs gain
       - Performance ROI
    
    4. **Monitoring Strategy**
       - Key performance indicators
       - Early warning signals
       - Optimization triggers
    
    Provide specific metrics and thresholds.`;
    
            const performancePrediction = await aiClient.call(performancePrompt, 'analysis');
            
            result += `
    
    ---
    
    🚀 **Performance Prediction Model**
    
    ${performancePrediction}`;
          }
          
          // Save analysis to storage for trend tracking
          if (generate_metrics) {
            const analysisData = {
              id: Date.now().toString(),
              target,
              analysis_type,
              timestamp: new Date().toISOString(),
              analysis: coreAnalysis,
              business_impact: include_business_impact,
              performance_prediction: performance_prediction
            };
            
            const storageData = await storage.read('analyses');
            if (!storageData.analyses) storageData.analyses = [];
            storageData.analyses.push(analysisData);
            
            // Keep only last 100 analyses
            if (storageData.analyses.length > 100) {
              storageData.analyses = storageData.analyses.slice(-100);
            }
            
            await storage.write('analyses', storageData);
            
            result += `
    
    **Analysis ID**: ${analysisData.id} (saved for trend tracking)`;
          }
          
          timer.end();
          return result;
        }
      },
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. While it lists three analysis capabilities, it doesn't describe what 'deep code analysis' entails, what format the output takes, whether this is a read-only operation, what permissions might be required, or any limitations. The description is insufficient for understanding the tool's behavior beyond its stated capabilities.

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 - a single phrase that efficiently communicates the core capabilities. Every word earns its place by specifying the analysis type and three key features. No wasted words or unnecessary elaboration.

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 with 5 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what 'deep code analysis' means in practice, what the output format is, or how the three mentioned capabilities relate to the parameters. The agent would need to guess about the tool's behavior and output structure.

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%, so the schema already documents all five parameters with descriptions. The description mentions 'performance prediction' and 'business impact assessment' which map to two of the boolean parameters, but doesn't add meaningful semantic context beyond what's already in the schema. Baseline 3 is appropriate when schema does the heavy lifting.

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 performs 'deep code analysis' with three specific capabilities: performance prediction, business impact assessment, and trend analysis. It provides a specific verb ('analyze') and resource ('code'), though it doesn't explicitly differentiate from sibling tools like 'analyze_codebase' or 'code_analyze' which appear to have overlapping purposes.

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 multiple sibling tools that appear related to code analysis (analyze_codebase, code_analyze, codereview_expert, etc.), there's no indication of what makes this tool distinct or when it should be preferred over those alternatives.

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/emmron/gemini-mcp'

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