Skip to main content
Glama

get_next_task

Retrieve the next pending task in a project from taskqueue-mcp, along with recommendations to guide its completion, ensuring structured progress.

Instructions

Get the next task to be done in a project. Returns the first non-approved task in sequence, regardless of status. The task may include toolRecommendations and ruleRecommendations fields that should be used to guide task completion.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesThe ID of the project to get the next task from (e.g., proj-1).

Implementation Reference

  • The main handler/executor for the 'get_next_task' tool. Validates the projectId input parameter and delegates to TaskManager.getNextTask() for the core logic.
    const getNextTaskToolExecutor: ToolExecutor = {
      name: "get_next_task",
      async execute(taskManager, args) {
        // 1. Argument Validation
        const projectId = validateProjectId(args.projectId);
    
        // 2. Core Logic Execution
        const resultData = await taskManager.getNextTask(projectId);
    
        // 3. Return raw success data
        return resultData;
      },
    };
  • Registers the get_next_task executor in the toolExecutorMap used by the MCP server to dispatch tool calls.
    toolExecutorMap.set(getNextTaskToolExecutor.name, getNextTaskToolExecutor);
  • Defines the Tool schema for 'get_next_task', including name, description, and inputSchema for MCP protocol compliance.
    const getNextTaskTool: Tool = {
      name: "get_next_task",
      description: "Get the next task to be done in a project. Returns the first non-approved task in sequence, regardless of status. The task may include toolRecommendations and ruleRecommendations fields that should be used to guide task completion.",
      inputSchema: {
        type: "object",
        properties: {
          projectId: {
            type: "string",
            description: "The ID of the project to get the next task from (e.g., proj-1).",
          },
        },
        required: ["projectId"],
      },
    };
  • Core helper method in TaskManager that implements the logic to find and return the next unapproved task in a project, handling edge cases like completed projects or no tasks.
    public async getNextTask(projectId: string): Promise<OpenTaskSuccessData | { message: string }> {
      await this.ensureInitialized();
      await this.reloadFromDisk();
      
      const proj = this.data.projects.find((p) => p.projectId === projectId);
      if (!proj) {
        throw new AppError(`Project ${projectId} not found`, AppErrorCode.ProjectNotFound);
      }
      if (proj.completed) {
        throw new AppError('Project is already completed', AppErrorCode.ProjectAlreadyCompleted);
      }
    
      if (!proj.tasks.length) {
        throw new AppError('Project has no tasks', AppErrorCode.TaskNotFound);
      }
    
      const nextTask = proj.tasks.find((t) => !(t.status === "done" && t.approved));
      if (!nextTask) {
        // all tasks done and approved?
        const allDoneAndApproved = proj.tasks.every((t) => t.status === "done" && t.approved);
        if (allDoneAndApproved && !proj.completed) {
          return {
            message: `All tasks have been completed and approved. Awaiting project completion approval.`
          };
        }
        throw new AppError('No incomplete or unapproved tasks found', AppErrorCode.TaskNotFound);
      }
    
      return {
        projectId: proj.projectId,
        task: { ...nextTask },
      };
    }
Behavior3/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 discloses that it returns 'the first non-approved task in sequence, regardless of status', which clarifies selection logic beyond a simple read. It also mentions optional fields like toolRecommendations and ruleRecommendations for guidance. However, it doesn't cover error handling, permissions, or response format details, leaving gaps for a mutation-free but context-sensitive tool.

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

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the core purpose and followed by behavioral details. Every sentence adds value: the first defines the tool's function and selection criteria, and the second explains optional fields for task completion. There is no wasted text or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is moderately complete. It covers the tool's purpose, selection logic, and optional fields, but lacks details on return values (e.g., task structure), error cases, or dependencies. For a tool with 1 parameter and simple behavior, this is adequate but has clear gaps in fully guiding an agent.

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

Parameters4/5

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

The schema has 1 parameter with 100% description coverage, so the baseline is 3. The description adds value by contextualizing the parameter: it specifies that projectId is used 'to get the next task from', reinforcing its purpose. This goes beyond the schema's generic description, though it doesn't provide additional syntax or format details.

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 verb 'Get' and resource 'next task to be done in a project', specifying it returns 'the first non-approved task in sequence, regardless of status'. This distinguishes it from siblings like list_tasks (which lists all tasks) or read_task (which reads a specific task). However, it doesn't explicitly contrast with all siblings, such as update_task or approve_task, which handle different operations on tasks.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when needing the next actionable task in a project, particularly for workflow progression. It mentions 'non-approved task in sequence', suggesting it's for tasks pending approval. However, it lacks explicit guidance on when to use this versus alternatives like list_tasks (for all tasks) or read_task (for a specific task ID), and doesn't specify prerequisites or exclusions.

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/chriscarrollsmith/taskqueue-mcp'

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