Skip to main content
Glama

delete_task

Remove obsolete or completed tasks safely with built-in confirmation protection, maintaining a clean task environment and preventing accidental data loss.

Instructions

Streamline your workflow by safely removing obsolete or completed tasks with built-in confirmation protection. Maintain a clean, focused task environment while preventing accidental data loss through required confirmation safeguards.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
confirmYesMust be set to true to confirm deletion (safety measure)
idYesThe unique identifier of the task to delete
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

  • The factory function that creates the 'delete_task' MCP tool handler. Defines the tool name, description, input schema (id: string, confirm: boolean), and the async handler logic including validation, task lookup, deletion via storage, and formatted responses.
    export function createDeleteTaskTool(storage: Storage) {
      return {
        name: 'delete_task',
        description: 'Delete a task and all its associated subtasks. This action cannot be undone.',
        inputSchema: {
          id: z.string(),
          confirm: z.boolean()
        },
        handler: async ({ id, confirm }: { id: string; confirm: boolean }) => {
          try {
            // Validate inputs
            if (!id || id.trim().length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Task ID is required.'
                }],
                isError: true
              };
            }
    
            if (confirm !== true) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: You must set confirm to true to delete a task.'
                }],
                isError: true
              };
            }
    
            const task = await storage.getTask(id.trim());
    
            if (!task) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `Error: Task with ID "${id}" not found. Use list_tasks to see all available tasks.`
                }],
                isError: true
              };
            }
    
            // Get project information for display
            const project = await storage.getProject(task.projectId);
            const projectName = project ? project.name : 'Unknown Project';
    
            // Get count of subtasks for confirmation message
            const subtasks = await storage.getSubtasks(task.id);
    
            const deleted = await storage.deleteTask(id);
    
            if (!deleted) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `Error: Failed to delete task with ID "${id}".`
                }],
                isError: true
              };
            }
    
            return {
              content: [{
                type: 'text' as const,
                text: `✅ Task deleted successfully!
    
    **Deleted:** "${task.name}" (ID: ${task.id})
    **Project:** ${projectName}
    **Also deleted:** ${subtasks.length} subtask(s)
    
    This action cannot be undone. All data associated with this task has been permanently removed.`
              }]
            };
          } catch (error) {
            return {
              content: [{
                type: 'text' as const,
                text: `Error deleting task: ${error instanceof Error ? error.message : 'Unknown error'}`
              }],
              isError: true
            };
          }
        }
      };
    }
  • The function that creates and registers the 'delete_task' tool as part of the task management tools suite by calling createDeleteTaskTool and including it in the returned tools object.
    export function createTaskTools(storage: Storage) {
      return {
        create_task: createCreateTaskTool(storage),
        delete_task: createDeleteTaskTool(storage),
        get_task: createGetTaskTool(storage),
        list_tasks: createListTasksTool(storage),
        update_task: createUpdateTaskTool(storage),
        migrate_subtasks: createMigrateSubtasksTool(storage),
        move_task: createMoveTaskTool(storage)
      };
    }
  • Zod schema definition for the delete_task tool inputs: task ID (string) and confirmation boolean.
    inputSchema: {
      id: z.string(),
      confirm: z.boolean()
    },
  • Storage interface defining the deleteTask method used by the tool handler.
    deleteTask(id: string): Promise<boolean>;
    deleteTasksByProject(projectId: string): Promise<number>;
    deleteTasksByParent(parentId: string): Promise<number>;
    
    // Task hierarchy operations
    getTaskHierarchy(projectId?: string, parentId?: string): Promise<TaskHierarchy[]>;
    getTaskChildren(taskId: string): Promise<Task[]>;
    getTaskAncestors(taskId: string): Promise<Task[]>;
  • Concrete implementation of deleteTask in FileStorage, which recursively deletes child tasks and removes the task from storage.
    async deleteTask(id: string): Promise<boolean> {
      const index = this.data.tasks.findIndex(t => t.id === id);
      if (index === -1) return false;
    
      // Delete all child tasks recursively
      await this.deleteTasksByParent(id);
    
      this.data.tasks.splice(index, 1);
      await this.save();
      return true;
    }
Behavior4/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 traits: it's a destructive operation ('removing tasks'), includes safety mechanisms ('confirmation protection,' 'preventing accidental data loss'), and implies permanence. However, it doesn't specify error handling, response format, or whether deletions are reversible, leaving some gaps.

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

Conciseness3/5

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

The description is two sentences but includes marketing language ('Streamline your workflow,' 'Maintain a clean, focused task environment') that doesn't add operational value. It's front-loaded with the core action but could be more direct by focusing solely on functional details without the fluff.

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?

For a destructive tool with no annotations and no output schema, the description does an adequate job covering safety and purpose. However, it lacks details on error cases (e.g., what happens if the task doesn't exist), response behavior, or integration with sibling tools. Given the complexity of deletion operations, more completeness would be beneficial.

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 parameters (id, confirm, workingDirectory) thoroughly. The description doesn't add any meaningful parameter-specific information beyond what's in the schema, such as explaining relationships between parameters or additional constraints. 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: 'removing obsolete or completed tasks' with 'built-in confirmation protection.' It specifies the verb (removing/deleting) and resource (tasks). However, it doesn't explicitly differentiate from sibling deletion tools like delete_memory, delete_project, or delete_subtask, which prevents a perfect score.

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 when to use it ('obsolete or completed tasks') and mentions safety features, but doesn't provide explicit guidance on when to choose this over alternatives like update_task to mark as completed or other deletion tools. No clear exclusions or prerequisites are stated beyond the confirmation requirement.

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