Skip to main content
Glama

get_next_task_recommendation

Retrieve prioritized task suggestions by analyzing project status, dependencies, complexity, and preferences to enhance workflow efficiency and decision-making.

Instructions

Get intelligent recommendations for the next task to work on based on dependencies, priorities, complexity, and current project status. Smart task recommendation engine for optimal workflow management and productivity.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
considerComplexityNoWhether to factor in task complexity for recommendations
excludeBlockedNoWhether to exclude blocked tasks from recommendations
maxRecommendationsNoMaximum number of task recommendations to return
preferredTagsNoPreferred task tags to prioritize in recommendations
projectIdNoFilter recommendations to a specific project
workingDirectoryYesThe full absolute path to the working directory where data is stored. MUST be an absolute path, never relative. Windows: "C:\Users\username\project" or "D:\projects\my-app". Unix/Linux/macOS: "/home/username/project" or "/Users/username/project". Do NOT use: ".", "..", "~", "./folder", "../folder" or any relative paths. Ensure the path exists and is accessible before calling this tool. NOTE: When server is started with --claude flag, this parameter is ignored and a global user directory is used instead.

Implementation Reference

  • Factory function createNextTaskRecommendationTool that defines the tool with name 'get_next_task_recommendation', description, input schema, and handler. This is where the tool is created/registered.
    export function createNextTaskRecommendationTool(storage: Storage, getWorkingDirectoryDescription: (config: any) => string, config: any) {
      return {
        name: 'get_next_task_recommendation',
        description: 'Get intelligent recommendations for the next task to work on based on dependencies, priorities, complexity, and current project status. Smart task recommendation engine for optimal workflow management.',
        inputSchema: z.object({
          workingDirectory: z.string().describe(getWorkingDirectoryDescription(config)),
          projectId: z.string().optional().describe('Filter recommendations to a specific project'),
          maxRecommendations: z.number().min(1).max(10).optional().default(3).describe('Maximum number of task recommendations to return'),
          considerComplexity: z.boolean().optional().default(true).describe('Whether to factor in task complexity for recommendations'),
          preferredTags: z.array(z.string()).optional().describe('Preferred task tags to prioritize in recommendations'),
          excludeBlocked: z.boolean().optional().default(true).describe('Whether to exclude blocked tasks from recommendations')
        }),
        handler: async (args: any) => {
          try {
            const {
              workingDirectory,
              projectId,
              maxRecommendations,
              considerComplexity,
              preferredTags,
              excludeBlocked
            } = args;
    
            // Get all tasks, optionally filtered by project
            const allTasks = projectId
              ? await storage.getTasks(projectId)
              : await getAllTasksAcrossProjects(storage);
    
            if (allTasks.length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: projectId
                    ? `No tasks found in the specified project.`
                    : `No tasks found. Create some tasks first using \`create_task\` or \`parse_prd\`.`
                }]
              };
            }
    
            // Filter and analyze tasks
            const readyTasks = await findReadyTasks(allTasks, excludeBlocked);
    
            if (readyTasks.length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `🚫 No tasks are currently ready to work on. All tasks are either completed, blocked, or waiting for dependencies.
    
    📊 **Task Status Summary:**
    ${generateTaskStatusSummary(allTasks)}
    
    💡 **Suggestions:**
    1. Check if any blocked tasks can be unblocked
    2. Review task dependencies for circular references
    3. Create new tasks if all current tasks are completed`
                }]
              };
            }
    
            // Score and rank tasks
            const scoredTasks = await scoreAndRankTasks(
              readyTasks,
              allTasks,
              considerComplexity,
              preferredTags
            );
    
            // Get top recommendations
            const recommendations = scoredTasks.slice(0, maxRecommendations);
    
            // Generate recommendation report
            const report = generateRecommendationReport(recommendations, allTasks);
    
            return {
              content: [{
                type: 'text' as const,
                text: report
              }]
            };
    
          } catch (error) {
            return {
              content: [{
                type: 'text' as const,
                text: `Error generating task recommendations: ${error instanceof Error ? error.message : 'Unknown error'}`
              }],
              isError: true
            };
          }
        }
      };
    }
  • Zod inputSchema defining parameters for the tool: workingDirectory, projectId, maxRecommendations, etc.
    inputSchema: z.object({
      workingDirectory: z.string().describe(getWorkingDirectoryDescription(config)),
      projectId: z.string().optional().describe('Filter recommendations to a specific project'),
      maxRecommendations: z.number().min(1).max(10).optional().default(3).describe('Maximum number of task recommendations to return'),
      considerComplexity: z.boolean().optional().default(true).describe('Whether to factor in task complexity for recommendations'),
      preferredTags: z.array(z.string()).optional().describe('Preferred task tags to prioritize in recommendations'),
      excludeBlocked: z.boolean().optional().default(true).describe('Whether to exclude blocked tasks from recommendations')
    }),
  • The async handler function implementing the core logic: fetches tasks, filters ready tasks, scores and ranks them based on priority/complexity/tags/dependencies, generates recommendation report.
        handler: async (args: any) => {
          try {
            const {
              workingDirectory,
              projectId,
              maxRecommendations,
              considerComplexity,
              preferredTags,
              excludeBlocked
            } = args;
    
            // Get all tasks, optionally filtered by project
            const allTasks = projectId
              ? await storage.getTasks(projectId)
              : await getAllTasksAcrossProjects(storage);
    
            if (allTasks.length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: projectId
                    ? `No tasks found in the specified project.`
                    : `No tasks found. Create some tasks first using \`create_task\` or \`parse_prd\`.`
                }]
              };
            }
    
            // Filter and analyze tasks
            const readyTasks = await findReadyTasks(allTasks, excludeBlocked);
    
            if (readyTasks.length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `🚫 No tasks are currently ready to work on. All tasks are either completed, blocked, or waiting for dependencies.
    
    📊 **Task Status Summary:**
    ${generateTaskStatusSummary(allTasks)}
    
    💡 **Suggestions:**
    1. Check if any blocked tasks can be unblocked
    2. Review task dependencies for circular references
    3. Create new tasks if all current tasks are completed`
                }]
              };
            }
    
            // Score and rank tasks
            const scoredTasks = await scoreAndRankTasks(
              readyTasks,
              allTasks,
              considerComplexity,
              preferredTags
            );
    
            // Get top recommendations
            const recommendations = scoredTasks.slice(0, maxRecommendations);
    
            // Generate recommendation report
            const report = generateRecommendationReport(recommendations, allTasks);
    
            return {
              content: [{
                type: 'text' as const,
                text: report
              }]
            };
    
          } catch (error) {
            return {
              content: [{
                type: 'text' as const,
                text: `Error generating task recommendations: ${error instanceof Error ? error.message : 'Unknown error'}`
              }],
              isError: true
            };
          }
        }
  • findReadyTasks helper: identifies tasks ready to work on by checking dependencies are completed and not blocked.
    async function findReadyTasks(allTasks: Task[], excludeBlocked: boolean): Promise<Task[]> {
      const readyTasks: Task[] = [];
    
      for (const task of allTasks) {
        // Skip completed tasks
        if (task.completed || task.status === 'done') {
          continue;
        }
    
        // Skip blocked tasks if requested
        if (excludeBlocked && task.status === 'blocked') {
          continue;
        }
    
        // Check if all dependencies are completed
        if (task.dependsOn && task.dependsOn.length > 0) {
          const dependenciesMet = task.dependsOn.every(depId => {
            const depTask = allTasks.find(t => t.id === depId);
            return depTask && (depTask.completed || depTask.status === 'done');
          });
    
          if (!dependenciesMet) {
            continue;
          }
        }
    
        readyTasks.push(task);
      }
    
      return readyTasks;
    }
  • scoreAndRankTasks helper: computes scores for ready tasks based on priority, complexity, tags, status, enabler bonus, and sorts them.
    async function scoreAndRankTasks(
      readyTasks: Task[],
      allTasks: Task[],
      considerComplexity: boolean,
      preferredTags?: string[]
    ): Promise<Array<Task & { score: number; reasoning: string }>> {
    
      const scoredTasks = readyTasks.map(task => {
        let score = 0;
        const reasoningParts: string[] = [];
    
        // Priority score (40% weight)
        const priorityScore = (task.priority || 5) * 4;
        score += priorityScore;
        reasoningParts.push(`Priority: ${task.priority || 5}/10 (+${priorityScore})`);
    
        // Complexity consideration (20% weight)
        if (considerComplexity && task.complexity) {
          // Lower complexity gets higher score for "quick wins"
          const complexityScore = (11 - task.complexity) * 2;
          score += complexityScore;
          reasoningParts.push(`Complexity: ${task.complexity}/10 (+${complexityScore} for lower complexity)`);
        }
    
        // Tag preference bonus (15% weight)
        if (preferredTags && preferredTags.length > 0 && task.tags) {
          const tagMatches = task.tags.filter(tag => preferredTags.includes(tag)).length;
          const tagScore = tagMatches * 5;
          score += tagScore;
          if (tagScore > 0) {
            reasoningParts.push(`Tag matches: ${tagMatches} (+${tagScore})`);
          }
        }
    
        // Status bonus (10% weight)
        if (task.status === 'in-progress') {
          score += 10;
          reasoningParts.push(`In progress (+10)`);
        }
    
        // Dependency enabler bonus (15% weight)
        const dependentTasks = allTasks.filter(t =>
          t.dependsOn && t.dependsOn.includes(task.id) && !t.completed && t.status !== 'done'
        );
        if (dependentTasks.length > 0) {
          const enablerScore = dependentTasks.length * 3;
          score += enablerScore;
          reasoningParts.push(`Enables ${dependentTasks.length} other tasks (+${enablerScore})`);
        }
    
        return {
          ...task,
          score,
          reasoning: reasoningParts.join(', ')
        };
      });
    
      // Sort by score (highest first)
      return scoredTasks.sort((a, b) => b.score - a.score);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the tool is 'intelligent' and a 'smart task recommendation engine' but doesn't specify what that means operationally—no details on algorithm, data sources, performance characteristics, rate limits, or authentication needs. The description adds minimal value beyond the basic purpose.

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 efficiently structured in two sentences: the first states the purpose with key criteria, the second adds context about being a 'smart engine' for workflow management. It's front-loaded with essential information and avoids unnecessary fluff, though the second sentence could be more specific.

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 tool with 6 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the recommendations look like (e.g., format, fields), how they're generated, or any behavioral constraints. The agent lacks crucial context to use this tool effectively beyond basic parameter passing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema—it doesn't explain how parameters like 'considerComplexity' or 'preferredTags' influence the recommendation logic. Baseline 3 is appropriate when schema does the heavy lifting.

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 as 'Get intelligent recommendations for the next task to work on' with specific criteria (dependencies, priorities, complexity, project status). It distinguishes from siblings like get_task or list_tasks by focusing on recommendations rather than retrieval, though it doesn't explicitly contrast with analyze_task_complexity or infer_task_progress 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 like analyze_task_complexity or infer_task_progress. It mentions 'optimal workflow management and productivity' but gives no explicit when/when-not instructions or prerequisites. The agent must infer usage from the purpose alone.

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

Related 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/Pimzino/agentic-tools-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server