Skip to main content
Glama

complete_task

Mark a task as completed, generate a detailed report, and update the dependency status of related tasks to ensure workflow continuity and accountability.

Instructions

Formally mark a task as completed, generate a detailed completion report, and update the dependency status of related tasks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
summaryNoTask completion summary, concise description of implementation results and important decisions (optional, will be automatically generated if not provided)
taskIdYesUnique identifier of the task to mark as completed, must be a valid unfinished task ID in the status of "in progress"

Implementation Reference

  • The main handler function for the 'complete_task' tool. Validates the task exists and is in 'IN_PROGRESS' status, optionally generates a summary, updates the task status to 'COMPLETED', and returns a prompt summarizing the completion.
    export async function completeTask({
      taskId,
      summary,
    }: z.infer<typeof completeTaskSchema>) {
      const task = await getTaskById(taskId);
    
      if (!task) {
        return {
          content: [
            {
              type: "text" as const,
              text: `## System Error\n\nTask with ID \`${taskId}\` not found. Please use the "list_tasks" tool to confirm a valid task ID before trying again.`,
            },
          ],
          isError: true,
        };
      }
    
      if (task.status !== TaskStatus.IN_PROGRESS) {
        return {
          content: [
            {
              type: "text" as const,
              text: `## Status Error\n\nTask "${task.name}" (ID: \`${task.id}\`) current status is "${task.status}", not in progress state, cannot mark as completed.\n\nOnly tasks in "in progress" state can be marked as completed. Please use the "execute_task" tool to start task execution first.`,
            },
          ],
          isError: true,
        };
      }
    
      // Process summary information
      let taskSummary = summary;
      if (!taskSummary) {
        // Automatically generate summary
        taskSummary = generateTaskSummary(task.name, task.description);
      }
    
      // Update task status to completed and add summary
      await updateTaskStatus(taskId, TaskStatus.COMPLETED);
      await updateTaskSummary(taskId, taskSummary);
    
      // Use prompt generator to get the final prompt
      const prompt = getCompleteTaskPrompt({
        task,
        completionTime: new Date().toISOString(),
      });
    
      return {
        content: [
          {
            type: "text" as const,
            text: prompt,
          },
        ],
      };
    }
  • Zod schema defining the input parameters for the completeTask tool: taskId (required UUID) and optional summary (string min 30 chars).
    export const completeTaskSchema = z.object({
      taskId: z
        .string()
        .uuid({ message: "Invalid task ID format, please provide a valid UUID format" })
        .describe(
          "Unique identifier of the task to mark as completed, must be a valid unfinished task ID in the status of \"in progress\""
        ),
      summary: z
        .string()
        .min(30, {
          message: "Task summary too short, please provide a more detailed completion report, including implementation results and main decisions",
        })
        .optional()
        .describe(
          "Task completion summary, concise description of implementation results and important decisions (optional, will be automatically generated if not provided)"
        ),
    });
  • src/index.ts:277-282 (registration)
    Registration of the 'complete_task' tool in the MCP server's ListToolsRequestHandler, specifying name, description from template, and input schema converted to JSON schema.
      name: "complete_task",
      description: loadPromptFromTemplate(
        "toolsDescription/completeTask.md"
      ),
      inputSchema: zodToJsonSchema(completeTaskSchema),
    },
  • src/index.ts:474-487 (registration)
    Handler dispatch in the CallToolRequestHandler switch case for 'complete_task', which parses arguments with the schema and calls the completeTask function.
    case "complete_task":
      parsedArgs = await completeTaskSchema.safeParseAsync(
        request.params.arguments
      );
      if (!parsedArgs.success) {
        throw new Error(
          `Invalid arguments for tool ${request.params.name}: ${parsedArgs.error.message}`
        );
      }
      taskId = parsedArgs.data.taskId;
      await saveRequest();
      result = await completeTask(parsedArgs.data);
      await saveResponse(result);
      return result;
  • Helper function that generates the completion prompt using templates, used by the handler to format the response.
    export function getCompleteTaskPrompt(params: CompleteTaskPromptParams): string {
      const { task, summary } = params;
    
      const indexTemplate = loadPromptFromTemplate("completeTask/index.md");
    
      // Start building the base prompt
      let prompt = generatePrompt(indexTemplate, {
        taskName: task.name,
        taskId: task.id,
        taskDescription: task.description,
        summary: summary || "",
      });
    
      // Load possible custom prompt
      return loadPrompt(prompt, "COMPLETE_TASK");
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions generating a report and updating dependencies, but doesn't specify what 'formally mark' entails (e.g., irreversible state change, audit trail), whether it requires specific permissions, or what happens to related tasks. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 lists the three main actions. It's front-loaded with the primary purpose and avoids unnecessary words, though it could be slightly more concise by integrating the actions more smoothly.

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 task completion tool with mutation behavior, no annotations, and no output schema, the description is insufficient. It doesn't explain the return value (e.g., the generated report or updated task status), error conditions, or side effects on the system, leaving the agent with incomplete context for safe and effective use.

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 schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain the format of the 'detailed completion report' or how dependency updates work). This meets the baseline for high schema coverage.

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 with specific verbs ('mark as completed', 'generate a detailed completion report', 'update the dependency status') and identifies the resource ('task'). However, it doesn't explicitly differentiate from sibling tools like 'update_task' or 'verify_task', 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 'update_task' or 'verify_task'. It mentions updating dependency status, but doesn't clarify if this is the only tool for task completion or if there are prerequisites beyond the input schema's 'in progress' status.

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/liorfranko/mcp-chain-of-thought'

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