generate_prd
Create comprehensive Product Requirements Documents (PRDs) from project ideas using AI analysis and industry best practices to define requirements clearly.
Instructions
Generate a comprehensive Product Requirements Document (PRD) from a project idea using AI analysis and industry best practices
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectIdea | Yes | ||
| projectName | Yes | ||
| targetUsers | No | ||
| timeline | No | ||
| complexity | Yes | ||
| author | Yes | ||
| stakeholders | No | ||
| includeResearch | Yes | ||
| industryContext | No |
Implementation Reference
- Main handler function that executes the generate_prd tool logic, calling PRDGenerationService and formatting the response.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 }); } }
- Zod schema defining input parameters for the generate_prd tool.const generatePRDSchema = z.object({ projectIdea: z.string().min(20).describe('The project idea or concept to create a PRD for'), projectName: z.string().min(3).describe('Name of the project'), targetUsers: z.array(z.string()).optional().describe('Target user groups'), timeline: z.string().optional().describe('Expected project timeline (e.g., "3 months", "Q1 2024")'), complexity: z.enum(['low', 'medium', 'high']).default('medium').describe('Expected project complexity'), author: z.string().describe('Author of the PRD'), stakeholders: z.array(z.string()).optional().describe('Project stakeholders'), includeResearch: z.boolean().default(false).describe('Whether to include market research and competitive analysis'), industryContext: z.string().optional().describe('Industry or domain context for the project') });
- src/infrastructure/tools/ToolRegistry.ts:270-270 (registration)Registration of the generatePRDTool in the central ToolRegistry during built-in tools initialization.this.registerTool(generatePRDTool);
- src/index.ts:444-445 (handler)MCP server dispatcher that routes 'generate_prd' tool calls to the executeGeneratePRD handler.case "generate_prd": return await executeGeneratePRD(args);
- src/infrastructure/tools/ai-tasks/GeneratePRDTool.ts:324-348 (registration)ToolDefinition export used for registration, including name, description, schema, and examples.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 };