Skip to main content
Glama
108yen

task-orchestrator-mcp

by 108yen

completeTask

Mark a task as completed with resolution details and retrieve the next task to execute in the task orchestration workflow.

Instructions

Complete a task and get the next task to execute. To start the next task, execute startTask.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesTask ID
resolutionYesTask completion resolution/details

Implementation Reference

  • Core handler function that executes the completeTask tool: validates parameters, marks task as done, auto-completes parents if all subtasks done, generates progress summary and next task recommendation.
    export function completeTask(params: { id: string; resolution: string }): {
      message: string
      next_task_id?: string
      progress_summary: ProgressSummary
    } {
      const { id, resolution } = params
    
      // Validate input parameters
      validateCompleteTaskParams(id, resolution)
    
      // Load tasks and find task to complete
      const tasks = readTasks()
      const taskToComplete = findAndValidateTaskToComplete(id, tasks)
    
      // Validate that task has no incomplete subtasks
      validateNoIncompleteSubtasks(taskToComplete)
    
      // Complete task and handle auto-completion of parents
      const { autoCompletedParents, updatedTask } =
        completeTaskAndAutoCompleteParents(id, resolution, tasks)
    
      // Save changes
      writeTasks(tasks)
    
      // Generate progress summary with updated tasks and changed task IDs
      const changedTaskIds = new Set<string>([
        updatedTask.id,
        ...autoCompletedParents.map((p) => p.id),
      ])
      const progress_summary = generateProgressSummary(tasks, changedTaskIds)
    
      // Find next task to execute
      const nextTask = findNextTask(tasks, updatedTask)
    
      // Generate completion message
      const message = generateCompletionMessage(
        taskToComplete,
        autoCompletedParents,
        nextTask,
      )
    
      return {
        message,
        next_task_id: nextTask?.id,
        progress_summary,
      }
    }
  • src/tools.ts:375-419 (registration)
    Registration of the completeTask tool with the MCP server, including description, Zod input schema, and error-handling wrapper that calls the core completeTask function.
    server.registerTool(
      "completeTask",
      {
        description:
          "Complete a task and get the next task to execute.\n" +
          "To start the next task, execute `startTask`.",
        inputSchema: {
          id: z.string().describe("Task ID"),
          resolution: z.string().describe("Task completion resolution/details"),
        },
      },
      (args) => {
        try {
          const result = completeTask(args as { id: string; resolution: string })
          return {
            content: [
              {
                text: JSON.stringify(result, null, 2),
                type: "text",
              },
            ],
          }
        } catch (error) {
          return {
            content: [
              {
                text: JSON.stringify(
                  {
                    error: {
                      code: "TASK_COMPLETE_ERROR",
                      message:
                        error instanceof Error ? error.message : "Unknown error",
                    },
                  },
                  null,
                  2,
                ),
                type: "text",
              },
            ],
            isError: true,
          }
        }
      },
    )
  • Zod input schema defining parameters for completeTask: task ID (string) and resolution (string).
    inputSchema: {
      id: z.string().describe("Task ID"),
      resolution: z.string().describe("Task completion resolution/details"),
    },
  • Helper function to validate completeTask input parameters: ensures id and resolution are non-empty strings.
    export function validateCompleteTaskParams(
      id: string,
      resolution: string,
    ): void {
      if (!id || typeof id !== "string") {
        throw new Error("Task ID is required and must be a string")
      }
    
      if (
        !resolution ||
        typeof resolution !== "string" ||
        resolution.trim() === ""
      ) {
        throw new Error("Resolution is required and must be a non-empty string")
      }
    }
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 'complete a task and get the next task,' implying a mutation (completion) and a read operation (getting next task), but doesn't disclose behavioral traits like whether completion is irreversible, what permissions are needed, if it triggers side effects, or how the next task is determined. This leaves critical gaps for a mutation 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 a usage tip. Every sentence earns its place by providing essential information without waste, making it highly concise and well-structured.

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 of a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on what 'complete' means behaviorally, how the next task is returned, error conditions, or output format. For a tool that modifies state and provides a result, this leaves significant gaps for an AI agent.

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?

The input schema has 100% description coverage, with 'id' and 'resolution' clearly documented in the schema. The description adds no additional meaning beyond what the schema provides (e.g., no examples or constraints for 'resolution'), so it meets the baseline of 3 for high schema coverage without compensating value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'Complete[s] a task and get[s] the next task to execute,' which provides a clear verb ('complete') and resource ('task'), but it's vague about what 'complete' entails (e.g., marking as done, resolving, closing) and doesn't differentiate from siblings like 'updateTask' or 'deleteTask' that might also affect task status. It's not tautological but lacks specificity.

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

Usage Guidelines4/5

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

The description explicitly states 'To start the next task, execute `startTask`,' providing a clear alternative and context for usage. However, it doesn't specify when to use this tool versus other siblings like 'updateTask' for partial completions or 'deleteTask' for removal, nor does it mention prerequisites (e.g., task must be in progress). The guidance is helpful but incomplete.

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/108yen/task-orchestrator-mcp'

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