Skip to main content
Glama

get_next_task

Recommends the next task to work on based on priorities, dependencies, team capacity, and current project state for efficient project management.

Instructions

Get AI-powered recommendations for the next task to work on based on priorities, dependencies, team capacity, and current project state

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNo
featureIdNo
assigneeNo
teamSkillsNo
sprintCapacityNo
currentPhaseNo
excludeBlockedYes
maxComplexityNo
includeAnalysisYes
limitYes

Implementation Reference

  • Main handler function that executes the get_next_task tool logic: processes arguments, generates mock tasks, applies filters, sorts by priority/complexity, generates AI analysis, and returns formatted recommendations.
    async function executeGetNextTask(args: GetNextTaskArgs): Promise<MCPResponse> {
      const taskService = new TaskGenerationService();
      
      try {
        // For now, create mock tasks for demonstration
        // In a full implementation, this would integrate with ResourceManager
        const mockTasks = [
          {
            id: 'task-1',
            title: 'Set up project infrastructure',
            description: 'Initialize project structure, CI/CD, and development environment',
            priority: 'high',
            complexity: 4,
            estimatedHours: 8,
            status: 'pending',
            dependencies: [],
            tags: ['setup', 'infrastructure']
          },
          {
            id: 'task-2', 
            title: 'Implement user authentication',
            description: 'Create login, registration, and password reset functionality',
            priority: 'critical',
            complexity: 6,
            estimatedHours: 16,
            status: 'pending',
            dependencies: ['task-1'],
            tags: ['auth', 'security']
          },
          {
            id: 'task-3',
            title: 'Design database schema',
            description: 'Create database tables and relationships for core entities',
            priority: 'high',
            complexity: 5,
            estimatedHours: 12,
            status: 'pending',
            dependencies: ['task-1'],
            tags: ['database', 'design']
          }
        ];
    
        // Apply filters
        let filteredTasks = mockTasks;
        
        if (args.maxComplexity) {
          filteredTasks = filteredTasks.filter(task => task.complexity <= args.maxComplexity!);
        }
        
        if (args.assignee) {
          // Would filter by assignee in real implementation
        }
    
        // Get recommendations (simplified)
        const recommendations = filteredTasks
          .sort((a, b) => {
            // Sort by priority first, then complexity
            const priorityOrder = { critical: 4, high: 3, medium: 2, low: 1 };
            const priorityDiff = (priorityOrder[b.priority as keyof typeof priorityOrder] || 0) - 
                               (priorityOrder[a.priority as keyof typeof priorityOrder] || 0);
            if (priorityDiff !== 0) return priorityDiff;
            return a.complexity - b.complexity; // Prefer lower complexity
          })
          .slice(0, args.limit);
    
        // Calculate sprint fit
        const totalHours = recommendations.reduce((sum, task) => sum + task.estimatedHours, 0);
        const sprintCapacity = args.sprintCapacity || 40;
        const sprintFit = totalHours <= sprintCapacity;
    
        // Generate AI analysis
        const analysis = args.includeAnalysis ? generateTaskAnalysis(recommendations, args) : null;
    
        // Format response
        const summary = formatNextTaskRecommendations(recommendations, analysis, {
          totalHours,
          sprintCapacity,
          sprintFit,
          filtersApplied: getAppliedFilters(args)
        });
        
        return ToolResultFormatter.formatSuccess('get_next_task', {
          summary,
          recommendations,
          analysis,
          metrics: {
            totalTasks: recommendations.length,
            totalHours,
            sprintCapacity,
            sprintFit
          }
        });
    
      } catch (error) {
        process.stderr.write(`Error in get_next_task tool: ${error}\n`);
        return ToolResultFormatter.formatSuccess('get_next_task', {
          error: `Failed to get task recommendations: ${error instanceof Error ? error.message : 'Unknown error'}`,
          success: false
        });
      }
    }
  • Zod schema defining the input parameters for the get_next_task tool, including optional filters like projectId, assignee, sprintCapacity, etc.
    const getNextTaskSchema = z.object({
      projectId: z.string().optional().describe('Filter tasks by specific project ID'),
      featureId: z.string().optional().describe('Filter tasks by specific feature ID'),
      assignee: z.string().optional().describe('Filter tasks for specific team member'),
      teamSkills: z.array(z.string()).optional().describe('Team skills to match against task requirements'),
      sprintCapacity: z.number().optional().describe('Available hours in current sprint (default: 40)'),
      currentPhase: z.enum(['planning', 'development', 'testing', 'review', 'deployment']).optional()
        .describe('Focus on tasks in specific phase'),
      excludeBlocked: z.boolean().default(true).describe('Whether to exclude blocked tasks'),
      maxComplexity: z.number().min(1).max(10).optional().describe('Maximum task complexity to consider'),
      includeAnalysis: z.boolean().default(true).describe('Whether to include detailed AI analysis'),
      limit: z.number().min(1).max(20).default(5).describe('Maximum number of tasks to recommend')
    });
  • Registration of the getNextTaskTool in the central ToolRegistry singleton during initialization of built-in 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:368-369 (registration)
    Dispatch case in the MCP server request handler that routes 'call_tool' requests for get_next_task to the executeGetNextTask function.
    case "get_next_task":
      return await executeGetNextTask(args);
  • ToolDefinition object for get_next_task including name, description, schema reference, and usage examples.
    export const getNextTaskTool: ToolDefinition<GetNextTaskArgs> = {
      name: "get_next_task",
      description: "Get AI-powered recommendations for the next task to work on based on priorities, dependencies, team capacity, and current project state",
      schema: getNextTaskSchema as unknown as ToolSchema<GetNextTaskArgs>,
      examples: [
        {
          name: "Get next task for development",
          description: "Get the next recommended task for a developer with specific skills",
          args: {
            teamSkills: ["typescript", "react", "node.js"],
            sprintCapacity: 40,
            maxComplexity: 7,
            excludeBlocked: true,
            includeAnalysis: true,
            limit: 3
          }
        }
      ]
    };
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. It mentions 'AI-powered recommendations' which hints at algorithmic behavior, but doesn't disclose critical traits like whether this is a read-only operation, what permissions are needed, how recommendations are generated, rate limits, or what the output format looks like. For a tool with 10 parameters and no annotations, this is a significant gap.

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 purpose. It's front-loaded with the main action and includes key criteria without unnecessary elaboration. However, it could be slightly more concise by removing redundant phrasing like 'to work on'.

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 (10 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain the tool's behavior, parameter usage, or output format. For a recommendation tool with many inputs and no structured documentation, this leaves too many gaps for an AI agent to use it effectively.

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%, so the schema provides no parameter documentation. The description mentions general criteria like 'priorities, dependencies, team capacity, and current project state' which loosely map to some parameters (e.g., 'teamSkills', 'sprintCapacity', 'currentPhase'), but it doesn't explain what any of the 10 parameters actually mean, their formats, or how they influence recommendations. This fails to compensate for the lack of schema descriptions.

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: 'Get AI-powered recommendations for the next task to work on' with specific criteria like priorities, dependencies, team capacity, and project state. It uses a specific verb ('Get') and resource ('recommendations'), but doesn't explicitly distinguish it from siblings like 'analyze_task_complexity' or 'plan_sprint' which might have overlapping functionality.

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, exclusions, or compare it to sibling tools like 'get_current_sprint' or 'list_issues' that might provide related information. Usage is implied by the purpose but not explicitly stated.

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