Skip to main content
Glama

generate_prd

Create comprehensive Product Requirements Documents (PRDs) from project ideas using AI analysis and industry best practices for GitHub project management.

Instructions

Generate a comprehensive Product Requirements Document (PRD) from a project idea using AI analysis and industry best practices

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdeaYes
projectNameYes
targetUsersNo
timelineNo
complexityYes
authorYes
stakeholdersNo
includeResearchYes
industryContextNo

Implementation Reference

  • Main handler function executeGeneratePRD that orchestrates PRD generation using PRDGenerationService, validates completeness, formats response, and handles AI errors gracefully.
    async function executeGeneratePRD(args: GeneratePRDArgs): Promise<MCPResponse> {
      const prdService = new PRDGenerationService();
    
      try {
        // Generate comprehensive PRD from project idea
        const prd = await prdService.generatePRDFromIdea({
          projectIdea: args.projectIdea,
          projectName: args.projectName,
          targetUsers: args.targetUsers,
          timeline: args.timeline,
          complexity: args.complexity,
          author: args.author,
          stakeholders: args.stakeholders
        });
    
        // Validate PRD completeness
        const validation = await prdService.validatePRDCompleteness(prd);
    
        // Format response
        const summary = formatPRDGenerationSummary(prd, validation);
    
        return ToolResultFormatter.formatSuccess('generate_prd', {
          summary,
          prd,
          validation,
          completenessScore: validation.score,
          isComplete: validation.isComplete
        });
    
      } catch (error) {
        process.stderr.write(`Error in generate_prd tool: ${error}\n`);
    
        // Check if this is an AI availability error
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        const isAIUnavailable = errorMessage.includes('AI service is not available') ||
                               errorMessage.includes('API key') ||
                               errorMessage.includes('provider');
    
        if (isAIUnavailable) {
          const aiErrorSummary = formatAIUnavailableMessage('generate_prd', errorMessage);
          return ToolResultFormatter.formatSuccess('generate_prd', {
            content: [{ type: 'text', text: aiErrorSummary }],
            success: false,
            aiAvailable: false
          });
        }
    
        return ToolResultFormatter.formatSuccess('generate_prd', {
          content: [{
            type: 'text',
            text: `# Failed to generate PRD\n\n**Error:** ${errorMessage}\n\nPlease check your input parameters and try again.`
          }],
          success: false
        });
      }
    }
  • Tool definition generatePRDTool including input schema (generatePRDSchema), description, and usage examples for MCP tool registration.
    export const generatePRDTool: ToolDefinition<GeneratePRDArgs> = {
      name: "generate_prd",
      description: "Generate a comprehensive Product Requirements Document (PRD) from a project idea using AI analysis and industry best practices",
      schema: generatePRDSchema as unknown as ToolSchema<GeneratePRDArgs>,
      examples: [
        {
          name: "Generate PRD for task management app",
          description: "Create a comprehensive PRD for a new task management application",
          args: {
            projectIdea: "A modern task management application with AI-powered prioritization, team collaboration features, and integration with popular development tools like GitHub and Slack",
            projectName: "TaskFlow AI",
            targetUsers: ["software developers", "project managers", "small teams"],
            timeline: "6 months",
            complexity: "medium",
            author: "product-team",
            stakeholders: ["engineering", "design", "marketing"],
            includeResearch: true,
            industryContext: "productivity software"
          }
        }
      ]
    };
    
    // Export the execution function for the tool registry
    export { executeGeneratePRD };
  • Registration of generatePRDTool in the central ToolRegistry singleton during initialization of built-in tools.
    // Register AI task management tools
    this.registerTool(addFeatureTool);
    this.registerTool(generatePRDTool);
    this.registerTool(parsePRDTool);
    this.registerTool(getNextTaskTool);
    this.registerTool(analyzeTaskComplexityTool);
    this.registerTool(expandTaskTool);
    this.registerTool(enhancePRDTool);
    this.registerTool(createTraceabilityMatrixTool);
  • src/index.ts:362-363 (registration)
    Dispatcher in main server index.ts that routes call_tool requests for 'generate_prd' directly to executeGeneratePRD.
    case "generate_prd":
      return await executeGeneratePRD(args);
  • Core helper service method generatePRDFromIdea that performs AI-powered PRD generation and validation, called by the tool handler.
    async generatePRDFromIdea(params: {
      projectIdea: string;
      projectName: string;
      targetUsers?: string[];
      timeline?: string;
      complexity?: 'low' | 'medium' | 'high';
      author: string;
      stakeholders?: string[];
    }): Promise<PRDDocument> {
      try {
        // Validate input
        if (!params.projectIdea.trim()) {
          throw new Error('Project idea is required');
        }
    
        if (!params.projectName.trim()) {
          throw new Error('Project name is required');
        }
    
        // Generate PRD using AI
        const generatedPRD = await this.aiProcessor.generatePRDFromIdea({
          projectIdea: params.projectIdea,
          targetUsers: params.targetUsers?.join(', '),
          timeline: params.timeline,
          complexity: params.complexity
        });
    
        // Enhance with provided metadata
        const enhancedPRD: PRDDocument = {
          ...generatedPRD,
          title: params.projectName,
          author: params.author,
          stakeholders: params.stakeholders || [],
          version: '1.0.0'
        };
    
        // Validate the generated PRD
        const validatedPRD = PRDDocumentSchema.parse(enhancedPRD);
    
        return validatedPRD;
      } catch (error) {
        process.stderr.write(`Error generating PRD from idea: ${error instanceof Error ? error.message : String(error)}\n`);
        throw new Error(`Failed to generate PRD: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
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 'AI analysis and industry best practices,' which hints at generative behavior, but doesn't clarify critical aspects like whether this is a read-only or mutating operation, what permissions are needed, how long it takes, or what the output format is. For a tool with 9 parameters and no annotations, this leaves significant gaps in understanding its behavior.

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, well-structured sentence that efficiently conveys the core purpose without unnecessary words. It's front-loaded with the main action ('Generate a comprehensive Product Requirements Document') and includes key details ('from a project idea using AI analysis and industry best practices') in a logical flow. Every part of the sentence earns its place.

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 (9 parameters, 5 required), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., a PRD document, a structured output), how errors are handled, or the scope of 'AI analysis.' For a generative tool with multiple inputs, more context is needed to ensure proper usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning none of the 9 parameters have descriptions in the schema. The tool description doesn't mention any parameters, so it adds no semantic information beyond what's inferred from parameter names (e.g., 'projectIdea' likely contains the idea text). This fails to compensate for the lack of schema documentation, making parameter usage unclear.

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's purpose: 'Generate a comprehensive Product Requirements Document (PRD) from a project idea using AI analysis and industry best practices.' It specifies the verb ('Generate'), resource ('Product Requirements Document'), and method ('using AI analysis and industry best practices'). However, it doesn't explicitly differentiate from sibling tools like 'enhance_prd' or 'parse_prd', which prevents a perfect score.

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 doesn't mention sibling tools like 'enhance_prd' (which might modify existing PRDs) or 'parse_prd' (which might analyze PRDs), nor does it specify prerequisites or exclusions. The only implied usage is for creating PRDs from project ideas, but this is too vague for effective 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/HarshKumarSharma/MCP'

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