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', ];

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