Skip to main content
Glama

expand_task

Break down complex GitHub tasks into manageable subtasks with AI analysis, dependency detection, and implementation recommendations for better 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
NameRequiredDescriptionDefault
taskTitleYes
taskDescriptionYes
currentComplexityYes
maxSubtasksYes
maxDepthYes
targetComplexityYes
includeEstimatesYes
includeDependenciesYes
includeAcceptanceCriteriaYes
projectTypeNo
teamSkillsNo

Implementation Reference

  • Main handler function executeExpandTask that implements the core logic of the expand_task tool, including task breakdown, enhancement, dependency detection, metrics calculation, and response formatting.
    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 schema definition for expand_task tool input validation, defining parameters like taskTitle, taskDescription, complexity scores, and various flags for subtask generation options.
    // 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')
    });
  • ToolRegistry class registers the expand_task tool (imported from ToolSchemas) among AI task management tools in the registerBuiltInTools method, making it available for list_tools and execution.
    private registerBuiltInTools(): void {
      // Register roadmap and planning tools
      this.registerTool(createRoadmapTool);
      this.registerTool(planSprintTool);
      this.registerTool(getMilestoneMetricsTool);
      this.registerTool(getSprintMetricsTool);
      this.registerTool(getOverdueMilestonesTool);
      this.registerTool(getUpcomingMilestonesTool);
    
      // Register project tools
      this.registerTool(createProjectTool);
      this.registerTool(listProjectsTool);
      this.registerTool(getProjectTool);
      this.registerTool(updateProjectTool);
      this.registerTool(deleteProjectTool);
    
      // Register milestone tools
      this.registerTool(createMilestoneTool);
      this.registerTool(listMilestonesTool);
      this.registerTool(updateMilestoneTool);
      this.registerTool(deleteMilestoneTool);
    
      // Register issue tools
      this.registerTool(createIssueTool);
      this.registerTool(listIssuesTool);
      this.registerTool(getIssueTool);
      this.registerTool(updateIssueTool);
    
      // Register sprint tools
      this.registerTool(createSprintTool);
      this.registerTool(listSprintsTool);
      this.registerTool(getCurrentSprintTool);
      this.registerTool(updateSprintTool);
      this.registerTool(addIssuesToSprintTool);
      this.registerTool(removeIssuesFromSprintTool);
    
      // Register project field tools
      this.registerTool(createProjectFieldTool);
      this.registerTool(listProjectFieldsTool);
      this.registerTool(updateProjectFieldTool);
    
      // Register project view tools
      this.registerTool(createProjectViewTool);
      this.registerTool(listProjectViewsTool);
      this.registerTool(updateProjectViewTool);
    
      // Register project item tools
      this.registerTool(addProjectItemTool);
      this.registerTool(removeProjectItemTool);
      this.registerTool(listProjectItemsTool);
    
      // Register field value tools
      this.registerTool(setFieldValueTool);
      this.registerTool(getFieldValueTool);
    
      // Register label tools
      this.registerTool(createLabelTool);
      this.registerTool(listLabelsTool);
    
      // 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:374-375 (registration)
    In the main MCP server, the executeToolHandler switch statement directly invokes executeExpandTask for the expand_task tool name.
    case "expand_task":
      return await executeExpandTask(args);
  • Helper function enhanceSubtasks called by the handler to add acceptance criteria, tags, adjust complexity, and set priorities for generated subtasks.
    function enhanceSubtasks(subtasks: any[], args: ExpandTaskArgs) {
      return subtasks.map((subtask, index) => {
        // Generate acceptance criteria if requested
        const acceptanceCriteria = args.includeAcceptanceCriteria ?
          generateAcceptanceCriteria(subtask) : [];
    
        // Assign appropriate tags
        const tags = generateSubtaskTags(subtask, args.projectType);
    
        // Adjust complexity to target if needed
        const adjustedComplexity = Math.min(subtask.complexity, args.targetComplexity);
    
        return {
          ...subtask,
          id: `subtask-${index + 1}`,
          complexity: adjustedComplexity,
          estimatedHours: adjustedComplexity * 2, // Subtasks are smaller
          acceptanceCriteria,
          tags,
          priority: index < 2 ? 'high' : 'medium', // First few subtasks are high priority
          status: 'pending'
        };
      });
    }
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-powered analysis' and 'implementation recommendations', but doesn't clarify output format, whether it's read-only or mutating, potential rate limits, or error conditions. For a tool with 11 parameters and no annotations, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/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 functionality. It's front-loaded with the main purpose and includes key features without unnecessary elaboration. However, given the complexity of the tool (11 parameters, no annotations), it might be too brief to be fully helpful.

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?

For a complex tool with 11 parameters, 0% schema coverage, no annotations, and no output schema, the description is inadequate. It explains what the tool does at a high level but provides no guidance on usage, parameter meanings, behavioral traits, or expected outputs. The agent would struggle to use this tool effectively without additional context.

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 11 parameters have descriptions in the schema. The tool description doesn't mention any parameters at all, failing to compensate for this gap. Parameters like 'currentComplexity', 'maxSubtasks', 'targetComplexity', and 'projectType' remain completely unexplained in both schema and description.

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: 'Break down a complex task into smaller, manageable subtasks with AI-powered analysis, dependency detection, and implementation recommendations.' It specifies the verb ('break down'), resource ('complex task'), and key features (AI analysis, dependency detection, recommendations). However, it doesn't explicitly distinguish this from sibling tools like 'analyze_task_complexity' or 'plan_sprint', which might have overlapping functionality in task analysis.

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 prerequisites, ideal scenarios, or exclusions. Given the many sibling tools for task/project management (e.g., 'analyze_task_complexity', 'plan_sprint', 'create_issue'), the agent lacks context on when this specific breakdown tool is appropriate.

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