Skip to main content
Glama

analyze_requirements

Analyze project requirements to identify essential features, prioritize needs based on stakeholders and constraints, and select appropriate analysis methods for effective planning.

Instructions

requirements analysis|what we need|requirements analysis|what we need|analyze requirements|essential features - Analyze project requirements

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requirementsYesList of requirements to analyze
stakeholdersNoProject stakeholders (e.g., users, admins, developers, ...)
constraintsNoProject constraints (timeline, budget, technical, ...)
analysisMethodNoAnalysis methodmoscow

Implementation Reference

  • Main handler function that performs requirements analysis: parses input list, applies MoSCoW prioritization, assesses type/complexity/risk/effort/stakeholders, generates breakdowns and formatted Markdown report with recommendations.
    export async function analyzeRequirements(args: {
      requirements: string;
      stakeholders?: string;
      constraints?: string;
      analysisMethod?: string;
    }): Promise<ToolResult> {
      const {
        requirements,
        stakeholders = 'end users, product owner, development team',
        constraints = 'standard timeline and budget constraints',
        analysisMethod = 'moscow'
      } = args;
    
      // Parse requirements
      const requirementList = requirements.split(/[,\n]/).map(r => r.trim()).filter(r => r.length > 0);
      const stakeholderList = stakeholders.split(',').map(s => s.trim());
    
      const analyzedRequirements: Requirement[] = requirementList.map((req, index) => {
        const reqId = `REQ-${String(index + 1).padStart(3, '0')}`;
        
        // Determine requirement type
        let type: 'functional' | 'non-functional' | 'business' | 'technical' = 'functional';
        if (req.toLowerCase().includes('performance') || req.toLowerCase().includes('security') || req.toLowerCase().includes('scalability')) {
          type = 'non-functional';
        } else if (req.toLowerCase().includes('business') || req.toLowerCase().includes('revenue') || req.toLowerCase().includes('cost')) {
          type = 'business';
        } else if (req.toLowerCase().includes('infrastructure') || req.toLowerCase().includes('architecture') || req.toLowerCase().includes('database')) {
          type = 'technical';
        }
    
        // Determine priority using MoSCoW
        let priority: 'must-have' | 'should-have' | 'could-have' | 'wont-have' = 'should-have';
        if (req.toLowerCase().includes('critical') || req.toLowerCase().includes('essential') || req.toLowerCase().includes('required')) {
          priority = 'must-have';
        } else if (req.toLowerCase().includes('important') || req.toLowerCase().includes('needed')) {
          priority = 'should-have';
        } else if (req.toLowerCase().includes('nice') || req.toLowerCase().includes('optional') || req.toLowerCase().includes('enhancement')) {
          priority = 'could-have';
        } else if (req.toLowerCase().includes('future') || req.toLowerCase().includes('later') || req.toLowerCase().includes('v2')) {
          priority = 'wont-have';
        }
    
        // Assess complexity
        let complexity: 'low' | 'medium' | 'high' = 'medium';
        if (req.length > 100 || req.toLowerCase().includes('complex') || req.toLowerCase().includes('integration') || req.toLowerCase().includes('advanced')) {
          complexity = 'high';
        } else if (req.length < 50 || req.toLowerCase().includes('simple') || req.toLowerCase().includes('basic')) {
          complexity = 'low';
        }
    
        // Assess risk
        let risk: 'low' | 'medium' | 'high' = 'low';
        if (req.toLowerCase().includes('external') || req.toLowerCase().includes('third-party') || req.toLowerCase().includes('new technology')) {
          risk = 'high';
        } else if (req.toLowerCase().includes('integration') || req.toLowerCase().includes('performance') || complexity === 'high') {
          risk = 'medium';
        }
    
        // Estimate effort
        let estimatedEffort = '1-5 days';
        if (complexity === 'high') {
          estimatedEffort = '1-3 weeks';
        } else if (complexity === 'low') {
          estimatedEffort = '1-2 days';
        }
    
        // Determine relevant stakeholders
        const relevantStakeholders = stakeholderList.filter(stakeholder => {
          if (type === 'business' && stakeholder.toLowerCase().includes('owner')) return true;
          if (type === 'technical' && stakeholder.toLowerCase().includes('developer')) return true;
          if (type === 'functional' && stakeholder.toLowerCase().includes('user')) return true;
          return true; // Include all by default
        });
    
        return {
          id: reqId,
          title: req.length > 50 ? req.substring(0, 47) + '...' : req,
          description: req,
          type,
          priority,
          complexity,
          risk,
          dependencies: [],
          estimatedEffort,
          stakeholders: relevantStakeholders
        };
      });
    
      const analysis = {
        action: 'analyze_requirements',
        method: analysisMethod,
        totalRequirements: analyzedRequirements.length,
        requirements: analyzedRequirements,
        priorityBreakdown: {
          mustHave: analyzedRequirements.filter(r => r.priority === 'must-have').length,
          shouldHave: analyzedRequirements.filter(r => r.priority === 'should-have').length,
          couldHave: analyzedRequirements.filter(r => r.priority === 'could-have').length,
          wontHave: analyzedRequirements.filter(r => r.priority === 'wont-have').length
        },
        typeBreakdown: {
          functional: analyzedRequirements.filter(r => r.type === 'functional').length,
          nonFunctional: analyzedRequirements.filter(r => r.type === 'non-functional').length,
          business: analyzedRequirements.filter(r => r.type === 'business').length,
          technical: analyzedRequirements.filter(r => r.type === 'technical').length
        },
        riskAssessment: {
          high: analyzedRequirements.filter(r => r.risk === 'high').length,
          medium: analyzedRequirements.filter(r => r.risk === 'medium').length,
          low: analyzedRequirements.filter(r => r.risk === 'low').length
        },
        recommendations: [
          'Focus on Must-Have requirements for MVP',
          'Validate high-risk requirements early',
          'Consider Should-Have items for post-MVP releases',
          'Review Could-Have items based on resource availability',
          'Plan technical requirements to support functional ones'
        ],
        constraints: constraints,
        status: 'success'
      };
    
      // Format output
      let formattedOutput = `# Requirements Analysis\n\n`;
      formattedOutput += `**Analysis Method:** ${analysisMethod.toUpperCase()}  \n`;
      formattedOutput += `**Total Requirements:** ${analysis.totalRequirements}  \n`;
      formattedOutput += `**Constraints:** ${constraints}\n\n`;
    
      formattedOutput += `## Priority Breakdown (MoSCoW)\n`;
      formattedOutput += `- **Must Have:** ${analysis.priorityBreakdown.mustHave}\n`;
      formattedOutput += `- **Should Have:** ${analysis.priorityBreakdown.shouldHave}\n`;
      formattedOutput += `- **Could Have:** ${analysis.priorityBreakdown.couldHave}\n`;
      formattedOutput += `- **Won't Have:** ${analysis.priorityBreakdown.wontHave}\n\n`;
    
      formattedOutput += `## Risk Assessment\n`;
      formattedOutput += `- **High Risk:** ${analysis.riskAssessment.high} requirements\n`;
      formattedOutput += `- **Medium Risk:** ${analysis.riskAssessment.medium} requirements\n`;
      formattedOutput += `- **Low Risk:** ${analysis.riskAssessment.low} requirements\n\n`;
    
      formattedOutput += `## Detailed Requirements\n\n`;
    
      // Group by priority
      const priorities = ['must-have', 'should-have', 'could-have', 'wont-have'] as const;
      priorities.forEach(priority => {
        const reqsForPriority = analyzedRequirements.filter(r => r.priority === priority);
        if (reqsForPriority.length > 0) {
          formattedOutput += `### ${priority.toUpperCase().replace('-', ' ')} (${reqsForPriority.length})\n\n`;
          reqsForPriority.forEach(req => {
            formattedOutput += `**${req.id}:** ${req.title}  \n`;
            formattedOutput += `*Type:* ${req.type} | *Complexity:* ${req.complexity} | *Risk:* ${req.risk} | *Effort:* ${req.estimatedEffort}  \n`;
            formattedOutput += `*Stakeholders:* ${req.stakeholders.join(', ')}\n\n`;
          });
        }
      });
    
      formattedOutput += `## Recommendations\n`;
      analysis.recommendations.forEach(rec => {
        formattedOutput += `- ${rec}\n`;
      });
    
      return {
        content: [{ type: 'text', text: formattedOutput }]
      };
    }
  • Input/output schema definition for the tool, defining parameters like requirements (required), stakeholders, constraints, analysisMethod (default 'moscow').
    export const analyzeRequirementsDefinition: ToolDefinition = {
      name: 'analyze_requirements',
      description: 'requirements analysis|what we need|requirements analysis|what we need|analyze requirements|essential features - Analyze project requirements',
      inputSchema: {
        type: 'object',
        properties: {
          requirements: { type: 'string', description: 'List of requirements to analyze' },
          stakeholders: { type: 'string', description: 'Project stakeholders (e.g., users, admins, developers, ...)' },
          constraints: { type: 'string', description: 'Project constraints (timeline, budget, technical, ...)' },
          analysisMethod: { type: 'string', description: 'Analysis method', enum: ['moscow', 'kano', 'value-effort'], default: 'moscow' }
        },
        required: ['requirements']
      },
      annotations: {
        title: 'Analyze Requirements',
        audience: ['user', 'assistant']
      }
    };
  • src/index.ts:104-160 (registration)
    Tool is registered by including analyzeRequirementsDefinition in the main tools array used for ListTools endpoint.
    const tools: ToolDefinition[] = [
      // Time Utility Tools
      getCurrentTimeDefinition,
    
      // Semantic Code Analysis Tools (Serena-inspired)
      findSymbolDefinition,
      findReferencesDefinition,
    
      // Sequential Thinking Tools
      createThinkingChainDefinition,
      analyzeProblemDefinition,
      stepByStepAnalysisDefinition,
      breakDownProblemDefinition,
      thinkAloudProcessDefinition,
      formatAsPlanDefinition,
    
      // Browser Development Tools
      monitorConsoleLogsDefinition,
      inspectNetworkRequestsDefinition,
    
      // Memory Management Tools
      saveMemoryDefinition,
      recallMemoryDefinition,
      listMemoriesDefinition,
      deleteMemoryDefinition,
      searchMemoriesDefinition,
      updateMemoryDefinition,
      autoSaveContextDefinition,
      restoreSessionContextDefinition,
      prioritizeMemoryDefinition,
      startSessionDefinition,
    
      // Convention Tools
      getCodingGuideDefinition,
      applyQualityRulesDefinition,
      validateCodeQualityDefinition,
      analyzeComplexityDefinition,
      checkCouplingCohesionDefinition,
      suggestImprovementsDefinition,
    
      // Planning Tools
      generatePrdDefinition,
      createUserStoriesDefinition,
      analyzeRequirementsDefinition,
      featureRoadmapDefinition,
    
      // Prompt Enhancement Tools
      enhancePromptDefinition,
      analyzePromptDefinition,
      enhancePromptGeminiDefinition,
    
      // Reasoning Tools
      applyReasoningFrameworkDefinition,
    
      // UI Preview Tools
      previewUiAsciiDefinition
    ];
  • src/index.ts:603-700 (registration)
    Dispatch registration: switch case in executeToolCall function that invokes analyzeRequirements handler for 'analyze_requirements' tool name.
    async function executeToolCall(name: string, args: unknown): Promise<CallToolResult> {
      switch (name) {
        // Time Utility Tools
        case 'get_current_time':
          return await getCurrentTime(args as any) as CallToolResult;
    
        // Semantic Code Analysis Tools
        case 'find_symbol':
          return await findSymbol(args as any) as CallToolResult;
        case 'find_references':
          return await findReferences(args as any) as CallToolResult;
    
        // Sequential Thinking Tools
        case 'create_thinking_chain':
          return await createThinkingChain(args as any) as CallToolResult;
        case 'analyze_problem':
          return await analyzeProblem(args as any) as CallToolResult;
        case 'step_by_step_analysis':
          return await stepByStepAnalysis(args as any) as CallToolResult;
        case 'break_down_problem':
          return await breakDownProblem(args as any) as CallToolResult;
        case 'think_aloud_process':
          return await thinkAloudProcess(args as any) as CallToolResult;
        case 'format_as_plan':
          return await formatAsPlan(args as any) as CallToolResult;
    
        // Browser Development Tools
        case 'monitor_console_logs':
          return await monitorConsoleLogs(args as any) as CallToolResult;
        case 'inspect_network_requests':
          return await inspectNetworkRequests(args as any) as CallToolResult;
    
        // Memory Management Tools
        case 'save_memory':
          return await saveMemory(args as any) as CallToolResult;
        case 'recall_memory':
          return await recallMemory(args as any) as CallToolResult;
        case 'list_memories':
          return await listMemories(args as any) as CallToolResult;
        case 'delete_memory':
          return await deleteMemory(args as any) as CallToolResult;
        case 'search_memories':
          return await searchMemoriesHandler(args as any) as CallToolResult;
        case 'update_memory':
          return await updateMemory(args as any) as CallToolResult;
        case 'auto_save_context':
          return await autoSaveContext(args as any) as CallToolResult;
        case 'restore_session_context':
          return await restoreSessionContext(args as any) as CallToolResult;
        case 'prioritize_memory':
          return await prioritizeMemory(args as any) as CallToolResult;
        case 'start_session':
          return await startSession(args as any) as CallToolResult;
    
        // Convention Tools
        case 'get_coding_guide':
          return await getCodingGuide(args as any) as CallToolResult;
        case 'apply_quality_rules':
          return await applyQualityRules(args as any) as CallToolResult;
        case 'validate_code_quality':
          return await validateCodeQuality(args as any) as CallToolResult;
        case 'analyze_complexity':
          return await analyzeComplexity(args as any) as CallToolResult;
        case 'check_coupling_cohesion':
          return await checkCouplingCohesion(args as any) as CallToolResult;
        case 'suggest_improvements':
          return await suggestImprovements(args as any) as CallToolResult;
    
        // Planning Tools
        case 'generate_prd':
          return await generatePrd(args as any) as CallToolResult;
        case 'create_user_stories':
          return await createUserStories(args as any) as CallToolResult;
        case 'analyze_requirements':
          return await analyzeRequirements(args as any) as CallToolResult;
        case 'feature_roadmap':
          return await featureRoadmap(args as any) as CallToolResult;
    
        // Prompt Enhancement Tools
        case 'enhance_prompt':
          return await enhancePrompt(args as any) as CallToolResult;
        case 'analyze_prompt':
          return await analyzePrompt(args as any) as CallToolResult;
        case 'enhance_prompt_gemini':
          return await enhancePromptGemini(args as any) as CallToolResult;
    
        // Reasoning Tools
        case 'apply_reasoning_framework':
          return await applyReasoningFramework(args as any) as CallToolResult;
    
        // UI Preview Tools
        case 'preview_ui_ascii':
          return await previewUiAscii(args as any) as CallToolResult;
    
        default:
          throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
      }
    }
Behavior2/5

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

Annotations only provide a title, so the description carries full burden for behavioral disclosure. It fails to describe what the analysis does (e.g., outputs prioritization, insights), any side effects, or operational constraints. No contradictions with annotations exist, but the description is insufficient for a tool with no annotation coverage.

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

Conciseness1/5

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

The description is repetitive and poorly structured, with redundant phrases ('requirements analysis|what we need|requirements analysis|what we need|analyze requirements|essential features') that add no value. It lacks front-loading of key information and wastes space without improving clarity.

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 no output schema and minimal annotations, the description is incomplete. It does not explain what the analysis produces (e.g., prioritized list, insights), leaving the agent uncertain about the tool's purpose and results. For a 4-parameter tool with behavioral ambiguity, this is inadequate.

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%, providing clear parameter documentation. The description adds no parameter-specific information beyond what the schema already states. Baseline score of 3 applies as the schema adequately covers parameter semantics without additional value from the description.

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

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description is tautological, repeating the tool name ('analyze requirements') without specifying what analysis entails. It adds redundant phrases ('requirements analysis', 'what we need', 'essential features') but fails to articulate the actual function or output. No distinction from sibling tools like 'analyze_complexity' or 'analyze_problem' is provided.

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

Usage Guidelines1/5

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

No guidance on when to use this tool versus alternatives is given. The description does not mention context, prerequisites, or exclusions. With sibling tools like 'analyze_complexity' and 'analyze_problem', the lack of differentiation leaves the agent without direction on tool selection.

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/ssdeanx/ssd-ai'

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