expand_task
Break down complex tasks into smaller, actionable subtasks with AI analysis, dependency detection, and implementation recommendations for efficient project management.
Instructions
Break down a complex task into smaller, manageable subtasks with AI-powered analysis, dependency detection, and implementation recommendations
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| currentComplexity | Yes | ||
| includeAcceptanceCriteria | Yes | ||
| includeDependencies | Yes | ||
| includeEstimates | Yes | ||
| maxDepth | Yes | ||
| maxSubtasks | Yes | ||
| projectType | No | ||
| targetComplexity | Yes | ||
| taskDescription | Yes | ||
| taskTitle | Yes | ||
| teamSkills | No |
Implementation Reference
- Core handler function that executes the expand_task tool logic: creates parent task mock, generates subtasks via AI service, enhances with details/dependencies/metrics/recommendations, formats comprehensive response.async function executeExpandTask(args: ExpandTaskArgs): Promise<MCPResponse> { const taskService = new TaskGenerationService(); try { // Create a mock parent task const parentTask = { id: 'parent-task', title: args.taskTitle, description: args.taskDescription, complexity: args.currentComplexity as TaskComplexity, estimatedHours: args.currentComplexity * 4, // Simple estimation priority: TaskPriority.MEDIUM, status: TaskStatus.PENDING, dependencies: [], acceptanceCriteria: [], tags: [], aiGenerated: false, subtasks: [], createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() }; // Generate subtasks using AI const subtasks = await taskService.expandTaskIntoSubtasks({ task: parentTask, maxDepth: args.maxDepth, autoEstimate: args.includeEstimates }); // Enhance subtasks with additional details const enhancedSubtasks = enhanceSubtasks(subtasks, args); // Detect dependencies if requested const dependencies = args.includeDependencies ? detectSubtaskDependencies(enhancedSubtasks) : []; // Calculate metrics const metrics = calculateSubtaskMetrics(enhancedSubtasks, parentTask); // Generate recommendations const recommendations = generateSubtaskRecommendations(enhancedSubtasks, args, metrics); // Format response const summary = formatTaskExpansion( parentTask, enhancedSubtasks, dependencies, metrics, recommendations, args ); return ToolResultFormatter.formatSuccess('expand_task', { summary, parentTask, subtasks: enhancedSubtasks, dependencies, metrics, recommendations }); } catch (error) { process.stderr.write(`Error in expand_task tool: ${error}\n`); return ToolResultFormatter.formatSuccess('expand_task', { error: `Failed to expand task: ${error instanceof Error ? error.message : 'Unknown error'}`, success: false }); } }
- Zod input schema definition for the expand_task tool parameters.// Schema for expand_task tool const expandTaskSchema = z.object({ taskTitle: z.string().min(3).describe('Title of the task to expand'), taskDescription: z.string().min(10).describe('Detailed description of the task'), currentComplexity: z.number().min(1).max(10).describe('Current complexity score of the task'), maxSubtasks: z.number().min(2).max(15).default(8).describe('Maximum number of subtasks to create'), maxDepth: z.number().min(1).max(3).default(2).describe('Maximum depth of subtask breakdown'), targetComplexity: z.number().min(1).max(5).default(3).describe('Target complexity for each subtask'), includeEstimates: z.boolean().default(true).describe('Whether to include effort estimates for subtasks'), includeDependencies: z.boolean().default(true).describe('Whether to identify dependencies between subtasks'), includeAcceptanceCriteria: z.boolean().default(true).describe('Whether to generate acceptance criteria for subtasks'), projectType: z.string().optional().describe('Type of project (web-app, mobile-app, api, etc.)'), teamSkills: z.array(z.string()).optional().describe('Team skills to consider for subtask assignment') });
- src/infrastructure/tools/ai-tasks/ExpandTaskTool.ts:452-475 (registration)ToolDefinition export for expand_task, including name, description, schema reference, and usage example. Used for registration in ToolRegistry.export const expandTaskTool: ToolDefinition<ExpandTaskArgs> = { name: "expand_task", description: "Break down a complex task into smaller, manageable subtasks with AI-powered analysis, dependency detection, and implementation recommendations", schema: expandTaskSchema as unknown as ToolSchema<ExpandTaskArgs>, examples: [ { name: "Expand complex feature task", description: "Break down a complex feature into manageable subtasks", args: { taskTitle: "Implement user dashboard", taskDescription: "Create a comprehensive user dashboard with analytics, settings, notifications, and profile management", currentComplexity: 8, maxSubtasks: 6, maxDepth: 2, targetComplexity: 3, includeEstimates: true, includeDependencies: true, includeAcceptanceCriteria: true, projectType: "web-app", teamSkills: ["react", "typescript", "node.js"] } } ] };
- src/infrastructure/tools/ToolRegistry.ts:273-274 (registration)Registration of the expand_task tool in the central ToolRegistry during built-in tools initialization.this.registerTool(analyzeTaskComplexityTool); this.registerTool(expandTaskTool);
- src/index.ts:456-457 (handler)Dispatch handler in main server that routes call_tool requests for 'expand_task' to the executeExpandTask function.case "expand_task": return await executeExpandTask(args);