Skip to main content
Glama

generate_adrs_from_prd

Convert Product Requirements Documents into Architectural Decision Records using advanced AI prompting techniques for optimized technical documentation.

Instructions

Generate Architectural Decision Records from a Product Requirements Document with advanced prompting techniques (APE + Knowledge Generation)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
prdPathYesPath to the PRD.md file
outputDirectoryNoDirectory to output generated ADRs (optional, uses configured ADR_DIRECTORY if not provided)
enhancedModeNoEnable advanced prompting features (APE + Knowledge Generation)
promptOptimizationNoEnable Automatic Prompt Engineering for optimized ADR generation
knowledgeEnhancementNoEnable Knowledge Generation for domain-specific insights
prdTypeNoType of PRD for optimized knowledge generationgeneral
conversationContextNoRich context from the calling LLM about user goals and discussion history

Implementation Reference

  • The main handler function implementing 'generate_adrs_from_prd' as a CE-MCP StateMachineDirective. Orchestrates sandbox operations: read PRD, load ADR template, extract decisions, generate ADRs, and validate output.
    export function createGenerateAdrsFromPrdDirective(
      args: CEMCPGenerateAdrsFromPrdArgs
    ): StateMachineDirective {
      const { prdPath, outputDirectory = 'docs/adrs', maxAdrs = 10, focusAreas = [] } = args;
    
      return {
        type: 'state_machine_directive',
        version: '1.0',
        initial_state: {
          prdPath,
          outputDirectory,
          maxAdrs,
          focusAreas,
          generatedAdrs: [],
        },
        transitions: [
          {
            name: 'read_prd',
            from: 'initial',
            operation: {
              op: 'analyzeFiles',
              args: {
                patterns: [prdPath],
                maxFiles: 1,
              },
              store: 'prdContent',
            },
            next_state: 'prd_loaded',
          },
          {
            name: 'load_adr_template',
            from: 'prd_loaded',
            operation: {
              op: 'loadPrompt',
              args: {
                name: 'adr-suggestion',
                section: 'recommendation_template',
              },
              store: 'adrTemplate',
            },
            next_state: 'template_loaded',
          },
          {
            name: 'extract_decisions',
            from: 'template_loaded',
            operation: {
              op: 'generateContext',
              args: {
                type: 'prd-decision-extraction',
                maxAdrs,
                focusAreas,
              },
              inputs: ['prdContent', 'adrTemplate'],
              store: 'extractedDecisions',
            },
            next_state: 'decisions_extracted',
          },
          {
            name: 'generate_adrs',
            from: 'decisions_extracted',
            operation: {
              op: 'generateContext',
              args: {
                type: 'adr-generation',
                outputDirectory,
              },
              inputs: ['extractedDecisions', 'adrTemplate'],
              store: 'generatedAdrs',
            },
            next_state: 'adrs_generated',
          },
          {
            name: 'validate_adrs',
            from: 'adrs_generated',
            operation: {
              op: 'validateOutput',
              args: {
                schema: {
                  type: 'array',
                  items: { type: 'object' },
                },
              },
              input: 'generatedAdrs',
              store: 'validatedAdrs',
            },
            next_state: 'done',
            on_error: 'skip',
          },
        ],
        final_state: 'done',
      };
    }
  • TypeScript interface defining the input arguments/schema for the generate_adrs_from_prd tool.
    export interface CEMCPGenerateAdrsFromPrdArgs {
      prdPath: string;
      outputDirectory?: string;
      maxAdrs?: number;
      focusAreas?: string[];
    }
  • Registration in getCEMCPDirective switch statement that maps the tool name to its directive creator.
    case 'generate_adrs_from_prd':
      return createGenerateAdrsFromPrdDirective(args as unknown as CEMCPGenerateAdrsFromPrdArgs);
  • Central tool catalog registration including metadata, schema, category, and CE-MCP flag.
    TOOL_CATALOG.set('generate_adrs_from_prd', {
      name: 'generate_adrs_from_prd',
      shortDescription: 'Generate ADRs from PRD document',
      fullDescription:
        'Analyzes a Product Requirements Document and generates relevant Architecture Decision Records.',
      category: 'adr',
      complexity: 'complex',
      tokenCost: { min: 4000, max: 8000 },
      hasCEMCPDirective: true, // Phase 4.2: CE-MCP directive added
      relatedTools: ['suggest_adrs', 'generate_adr_from_decision'],
      keywords: ['adr', 'prd', 'requirements', 'generate'],
      requiresAI: true,
      inputSchema: {
        type: 'object',
        properties: {
          prdPath: { type: 'string', description: 'Path to PRD document' },
          outputDirectory: { type: 'string', description: 'Where to save ADRs' },
        },
        required: ['prdPath'],
      },
    });
  • Listed in cemcpTools array for shouldUseCEMCPDirective check.
      'generate_adrs_from_prd',
      'interactive_adr_planning',
      'mcp_planning',
      'troubleshoot_guided_workflow',
      // Phase 5: OpenRouter Elimination
      'tool_chain_orchestrator',
    ];
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'advanced prompting techniques' but does not explain what these entail operationally, such as processing time, potential side effects, error handling, or output format. For a complex tool with 7 parameters, this leaves significant gaps in understanding how it behaves.

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 front-loads the core purpose. However, it could be more structured by separating the main functionality from the advanced techniques, but it avoids unnecessary verbosity and earns its place by specifying unique features.

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 tool's complexity (7 parameters, nested objects, no output schema, and no annotations), the description is incomplete. It does not address behavioral aspects, output expectations, or usage context, leaving the agent with insufficient information to effectively invoke this tool beyond basic parameter passing.

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?

The schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional parameter semantics beyond what the schema provides, such as explaining interactions between parameters like 'enhancedMode', 'promptOptimization', and 'knowledgeEnhancement'. Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose5/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: 'Generate Architectural Decision Records from a Product Requirements Document with advanced prompting techniques (APE + Knowledge Generation)'. It specifies the verb ('Generate'), resource ('Architectural Decision Records'), source ('Product Requirements Document'), and distinguishes itself from siblings by mentioning unique advanced techniques.

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. It does not mention sibling tools like 'generate_adr_bootstrap' or 'generate_adr_from_decision', nor does it specify prerequisites, constraints, or appropriate contexts for usage beyond the basic functionality.

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

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