add_feature
Enhance project workflows by integrating new features into PRDs, analyzing their impact, and converting them into actionable tasks with full lifecycle management in GitHub Projects.
Instructions
Add a new feature to an existing PRD or project, analyze its impact, and expand it into actionable tasks with complete lifecycle management
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| autoApprove | Yes | ||
| businessJustification | No | ||
| createLifecycle | Yes | ||
| description | Yes | ||
| expandToTasks | Yes | ||
| featureIdea | Yes | ||
| requestedBy | Yes | ||
| targetPRD | No | ||
| targetProject | No | ||
| targetUsers | No |
Implementation Reference
- Main handler function that executes the add_feature tool logic, calling FeatureManagementService to create feature lifecycle and formatting the response.async function executeAddFeature(args: AddFeatureArgs): Promise<MCPResponse> { const featureService = new FeatureManagementService(); try { // For now, we'll create a simplified implementation // In a full implementation, you'd integrate with ResourceManager // Create complete feature lifecycle const result = await featureService.createCompleteFeatureLifecycle({ featureIdea: args.featureIdea, description: args.description, targetPRD: undefined, // Would get from ResourceManager targetProject: args.targetProject, requestedBy: args.requestedBy, businessJustification: args.businessJustification, autoApprove: args.autoApprove }); // Format response const summary = formatFeatureAdditionSummary(result); return ToolResultFormatter.formatSuccess('add_feature', { summary, featureRequest: result.featureRequest, tasksCreated: result.expansionResult?.tasks.length || 0, estimatedEffort: result.expansionResult?.estimatedEffort || 0 }); } catch (error) { process.stderr.write(`Error in add_feature tool: ${error}\n`); return ToolResultFormatter.formatSuccess('add_feature', { error: `Failed to add feature: ${error instanceof Error ? error.message : 'Unknown error'}`, success: false }); } }
- Zod schema defining the input parameters for the add_feature tool.// Schema for add_feature tool const addFeatureSchema = z.object({ featureIdea: z.string().min(10).describe('The feature idea or title'), description: z.string().min(20).describe('Detailed description of the feature'), targetPRD: z.string().optional().describe('ID of the PRD to add the feature to'), targetProject: z.string().optional().describe('GitHub project ID to add tasks to'), businessJustification: z.string().optional().describe('Business justification for the feature'), targetUsers: z.array(z.string()).optional().describe('Target user groups for this feature'), requestedBy: z.string().describe('Person requesting the feature'), autoApprove: z.boolean().default(false).describe('Whether to auto-approve the feature without manual review'), expandToTasks: z.boolean().default(true).describe('Whether to immediately expand the feature into tasks'), createLifecycle: z.boolean().default(true).describe('Whether to create complete task lifecycle management') });
- src/infrastructure/tools/ToolRegistry.ts:268-276 (registration)Registration of the add_feature tool (addFeatureTool) in the central ToolRegistry during built-in tools initialization.// 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:441-442 (registration)Dispatch handler in main server that routes 'add_feature' tool calls to the executeAddFeature function.case "add_feature": return await executeAddFeature(args);
- Helper function that formats the detailed markdown summary of the feature addition result for the tool response.function formatFeatureAdditionSummary(result: any): string { const sections = [ '# Feature Addition Complete', '', `## Feature: ${result.featureRequest.featureIdea}`, `**Status:** ${result.featureRequest.status}`, `**Requested by:** ${result.featureRequest.requestedBy}`, `**Created:** ${new Date(result.featureRequest.createdAt).toLocaleString()}`, '' ]; // Analysis summary if (result.analysis) { sections.push( '## Analysis Summary', `**Recommendation:** ${result.analysis.recommendation}`, `**Priority:** ${result.analysis.priority}`, `**Complexity:** ${result.analysis.complexity}/10`, `**Estimated Effort:** ${result.analysis.estimatedEffort} hours`, '' ); if (result.analysis.risks.length > 0) { sections.push( '**Key Risks:**', ...result.analysis.risks.map((risk: string) => `- ${risk}`), '' ); } } // PRD update if (result.updatedPRD) { sections.push( '## PRD Updated', `**PRD:** ${result.updatedPRD.title}`, `**Version:** ${result.updatedPRD.version}`, `**Total Features:** ${result.updatedPRD.features.length}`, '' ); } // Task breakdown if (result.expansionResult) { sections.push( '## Task Breakdown', `**Total Tasks:** ${result.expansionResult.tasks.length}`, `**Estimated Effort:** ${result.expansionResult.estimatedEffort} hours`, `**Risk Level:** ${result.expansionResult.riskAssessment.level}`, `**Suggested Milestone:** ${result.expansionResult.suggestedMilestone}`, '' ); // Task summary by priority const tasksByPriority = result.expansionResult.tasks.reduce((acc: any, task: any) => { acc[task.priority] = (acc[task.priority] || 0) + 1; return acc; }, {}); sections.push( '**Tasks by Priority:**', ...Object.entries(tasksByPriority).map(([priority, count]) => `- ${priority}: ${count} tasks` ), '' ); // High-priority tasks const highPriorityTasks = result.expansionResult.tasks .filter((task: any) => task.priority === 'critical' || task.priority === 'high') .slice(0, 5); if (highPriorityTasks.length > 0) { sections.push( '**High-Priority Tasks:**', ...highPriorityTasks.map((task: any) => `- ${task.title} (${task.complexity}/10, ${task.estimatedHours}h)` ), '' ); } } // Lifecycle management if (result.lifecycleStates) { sections.push( '## Lifecycle Management', `**Tasks with Lifecycle Tracking:** ${result.lifecycleStates.length}`, `**Current Phase:** Planning (all tasks start in planning phase)`, '' ); } // Roadmap update if (result.roadmapUpdate) { sections.push( '## Roadmap Impact', `**Project:** ${result.roadmapUpdate.projectId}`, `**Planned Features:** ${result.roadmapUpdate.features.planned.length}`, '' ); } // Next steps sections.push( '## Next Steps', '1. Review the generated tasks and adjust priorities if needed', '2. Assign tasks to team members', '3. Start with planning phase for high-priority tasks', '4. Use `get_next_task` to get recommendations for what to work on first', '5. Use `update_task_lifecycle` to track progress through phases', '' ); // Related commands sections.push( '## Related Commands', '- `get_next_task` - Get next recommended task to work on', '- `update_task_lifecycle` - Update task progress and phase', '- `expand_task` - Further break down complex tasks', '- `analyze_task_complexity` - Get detailed complexity analysis', '- `list_ai_tasks` - View all tasks for this feature' ); return sections.join('\n'); }