Skip to main content
Glama

Complete TODO Task

complete_todo_task

Mark a task as completed in a TODO list to update progress, record completion timestamp, and track project status. Ensure task requirements are fully met before marking it complete.

Instructions

Mark a task as completed in a TODO list.

When to use this tool:

  • Task implementation is fully complete

  • Task requirements are met

  • Moving to next task in sequence

  • Updating progress status

  • Recording completion for tracking

Key features:

  • Marks task with completion timestamp

  • Updates TODO completion percentage

  • Preserves task content and history

  • Cannot be undone

You should:

  1. ONLY mark complete when truly finished

  2. Verify task is actually done

  3. Test/validate before marking complete

  4. Complete tasks as you finish them

  5. Don't batch completions

  6. Move to next task after completing

DO NOT use when:

  • Task is partially complete

  • Work is blocked or paused

  • Need to revisit later

  • Implementation failed

Returns: {success: bool, message: str, error?: str}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesThe project identifier
task_numberYesThe task number to complete
todo_numberYesThe TODO list number

Implementation Reference

  • Main handler implementation for complete_todo_task tool. Locates the project and TODO directory, finds the specific task file, updates its frontmatter metadata to set completed=true with timestamp, auto-commits the change to git, and returns success response.
    async completeTodoTaskAsync(params: {
      project_id: z.infer<typeof secureProjectIdSchema>;
      todo_number: z.infer<typeof secureTodoNumberSchema>;
      task_number: z.infer<typeof secureTodoNumberSchema>;
    }): Promise<string> {
      const context = this.createContext('complete_todo_task', params);
    
      try {
        const { project_id, todo_number, task_number } = params;
        const projectInfo = await getProjectDirectoryAsync(this.storagePath, project_id);
    
        if (!projectInfo) {
          throw new MCPError(MCPErrorCode.PROJECT_NOT_FOUND, `Project ${project_id} not found`, {
            project_id,
            traceId: context.traceId,
          });
        }
    
        const [, projectPath] = projectInfo;
        const todoDir = join(projectPath, 'TODO', todo_number.toString());
    
        // Check if TODO exists
        try {
          await access(todoDir);
        } catch {
          throw new MCPError(MCPErrorCode.TODO_NOT_FOUND, `TODO #${todo_number} not found`, {
            project_id,
            todo_number,
            traceId: context.traceId,
          });
        }
    
        // Find task file
        const taskFile = await this.findTaskFileAsync(todoDir, task_number);
        if (!taskFile) {
          throw new MCPError(
            MCPErrorCode.TASK_NOT_FOUND,
            `Task #${task_number} not found in TODO #${todo_number}`,
            { project_id, todo_number, task_number, traceId: context.traceId }
          );
        }
    
        // Update task metadata
        await this.updateTaskMetadataAsync(join(todoDir, taskFile), { completed: true });
    
        // Auto-commit
        await autoCommitAsync(
          this.storagePath,
          `Complete task #${task_number} in TODO #${todo_number}`
        );
    
        this.logSuccess('complete_todo_task', params, context);
        return this.formatSuccessResponse({
          message: `Marked task #${task_number} as completed in TODO #${todo_number}`,
        });
      } catch (error) {
        this.logError('complete_todo_task', params, error as MCPError, context);
        return this.formatErrorResponse(error, context);
      }
    }
  • MCP tool registration for 'complete_todo_task', defining input schema using Zod schemas, title, description from TOOL_DESCRIPTIONS, and handler that delegates to todoHandler.completeTodoTaskAsync.
      'complete_todo_task',
      {
        title: 'Complete TODO Task',
        description: TOOL_DESCRIPTIONS.complete_todo_task,
        inputSchema: {
          project_id: secureProjectIdSchema.describe('The project identifier'),
          todo_number: secureTodoNumberSchema.describe('The TODO list number'),
          task_number: secureTodoNumberSchema.describe('The task number to complete'),
        },
      },
      async ({ project_id, todo_number, task_number }) => {
        const result = await todoHandler.completeTodoTaskAsync({
          project_id,
          todo_number,
          task_number,
        });
        return {
          content: [
            {
              type: 'text',
              text: result,
            },
          ],
        };
      }
    );
  • Detailed description string for the complete_todo_task tool used in registration, providing usage guidelines, when to use, key features, and return format.
      complete_todo_task: `Mark a task as completed in a TODO list.
    
    When to use this tool:
    - Task implementation is fully complete
    - Task requirements are met
    - Moving to next task in sequence
    - Updating progress status
    - Recording completion for tracking
    
    Key features:
    - Marks task with completion timestamp
    - Updates TODO completion percentage
    - Preserves task content and history
    - Cannot be undone
    
    You should:
    1. ONLY mark complete when truly finished
    2. Verify task is actually done
    3. Test/validate before marking complete
    4. Complete tasks as you finish them
    5. Don't batch completions
    6. Move to next task after completing
    
    DO NOT use when:
    - Task is partially complete
    - Work is blocked or paused
    - Need to revisit later
    - Implementation failed
    
    Returns: {success: bool, message: str, error?: str}`,
  • Helper method called by the handler to update the task's YAML frontmatter metadata (sets completed: true and updated timestamp) while preserving the markdown body content.
    private async updateTaskMetadataAsync(
      filepath: string,
      updates: Partial<TaskMetadata>
    ): Promise<void> {
      const content = await readFile(filepath, 'utf8');
      const parsed = fm<TaskMetadata>(content);
    
      // Update metadata
      const updatedMetadata: TaskMetadata = {
        ...parsed.attributes,
        ...updates,
        updated: new Date().toISOString(),
      };
    
      // Write back with updated metadata
      const frontmatter = yaml.dump(updatedMetadata);
      const updatedContent = `---\n${frontmatter}---\n${parsed.body}`;
      await writeFile(filepath, updatedContent);
    }
Behavior5/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 effectively describes key behavioral traits: marks task with completion timestamp, updates TODO completion percentage, preserves task content and history, and explicitly states 'Cannot be undone'. This provides crucial context about the tool's effects beyond basic functionality.

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 well-structured with clear sections (purpose, when to use, key features, guidelines, exclusions, returns). While comprehensive, some sections like the numbered 'You should' list could be more concise. Overall, it's appropriately sized for the tool's complexity.

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

Completeness5/5

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

Given the mutation nature of the tool (completing tasks), no annotations, and no output schema, the description provides excellent contextual completeness. It covers purpose, usage scenarios, behavioral effects, guidelines, exclusions, and return format. This is comprehensive for a tool with this level of complexity.

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 all three parameters. The description doesn't add any additional parameter-specific information beyond what's in the schema. It focuses on usage guidelines and behavioral context rather than parameter semantics.

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

Purpose5/5

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

The description clearly states the specific action ('Mark a task as completed') and resource ('in a TODO list'), distinguishing it from sibling tools like 'add_todo_task', 'remove_todo_task', or 'get_todo_tasks'. It goes beyond the tool name/title by specifying the exact operation.

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

Usage Guidelines5/5

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

The description provides explicit 'When to use this tool' and 'DO NOT use when' sections with detailed scenarios, including alternatives (e.g., not using when task is partially complete). It gives clear context for when this tool is appropriate versus when it should be avoided.

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/sven-borkert/knowledge-mcp'

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