Skip to main content
Glama

delete_task

Remove unfinished tasks from the mcp-chain-of-thought server by specifying their unique task ID, ensuring completed tasks remain intact for record integrity.

Instructions

Delete unfinished tasks, but does not allow deleting completed tasks, ensuring the integrity of system records

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesUnique identifier of the task to delete, must be an existing unfinished task ID in the system

Implementation Reference

  • Main handler function for the delete_task tool. Validates input, checks task existence and status, calls the model delete function, and returns a formatted response with prompts.
    export async function deleteTask({ taskId }: z.infer<typeof deleteTaskSchema>) {
      const task = await getTaskById(taskId);
    
      if (!task) {
        return {
          content: [
            {
              type: "text" as const,
              text: getDeleteTaskPrompt({ taskId }),
            },
          ],
          isError: true,
        };
      }
    
      if (task.status === TaskStatus.COMPLETED) {
        return {
          content: [
            {
              type: "text" as const,
              text: getDeleteTaskPrompt({ taskId, task, isTaskCompleted: true }),
            },
          ],
          isError: true,
        };
      }
    
      const result = await modelDeleteTask(taskId);
    
      return {
        content: [
          {
            type: "text" as const,
            text: getDeleteTaskPrompt({
              taskId,
              task,
              success: result.success,
              message: result.message,
            }),
          },
        ],
        isError: !result.success,
      };
    }
  • Zod schema for validating the input to the delete_task tool, requiring a valid UUID taskId.
    export const deleteTaskSchema = z.object({
      taskId: z
        .string()
        .uuid({ message: "Invalid task ID format, please provide a valid UUID format" })
        .describe("Unique identifier of the task to delete, must be an existing unfinished task ID in the system"),
    });
  • src/index.ts:284-289 (registration)
    Registration of the delete_task tool in the MCP server's list of tools, including name, description from MD file, and input schema.
      name: "delete_task",
      description: loadPromptFromTemplate(
        "toolsDescription/deleteTask.md"
      ),
      inputSchema: zodToJsonSchema(deleteTaskSchema),
    },
  • Underlying model function (deleteTask, aliased as modelDeleteTask) that performs the actual task deletion from the JSON file, with checks for dependencies and status.
    export async function deleteTask(
      taskId: string
    ): Promise<{ success: boolean; message: string }> {
      const tasks = await readTasks();
      const taskIndex = tasks.findIndex((task) => task.id === taskId);
    
      if (taskIndex === -1) {
        return { success: false, message: "Task not found" };
      }
    
      // Check task status, completed tasks cannot be deleted
      if (tasks[taskIndex].status === TaskStatus.COMPLETED) {
        return { success: false, message: "Cannot delete completed tasks" };
      }
    
      // Check if other tasks depend on this task
      const allTasks = tasks.filter((_, index) => index !== taskIndex);
      const dependentTasks = allTasks.filter((task) =>
        task.dependencies.some((dep) => dep.taskId === taskId)
      );
    
      if (dependentTasks.length > 0) {
        const dependentTaskNames = dependentTasks
          .map((task) => `"${task.name}" (ID: ${task.id})`)
          .join(", ");
        return {
          success: false,
          message: `Cannot delete this task, because the following tasks depend on it: ${dependentTaskNames}`,
        };
      }
    
      // Execute delete operation
      tasks.splice(taskIndex, 1);
      await writeTasks(tasks);
    
      return { success: true, message: "Task deleted successfully" };
    }
  • src/index.ts:489-499 (registration)
    Dispatch handler in the CallToolRequest that parses arguments with the schema and calls the deleteTask handler.
    case "delete_task":
      parsedArgs = await deleteTaskSchema.safeParseAsync(
        request.params.arguments
      );
      if (!parsedArgs.success) {
        throw new Error(
          `Invalid arguments for tool ${request.params.name}: ${parsedArgs.error.message}`
        );
      }
      result = await deleteTask(parsedArgs.data);
      return result;
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 communicates that this is a destructive operation (delete), specifies constraints (only unfinished tasks), and mentions a system integrity consideration. However, it doesn't address potential side effects, error conditions, or what happens to related data.

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 perfectly concise with two clear, focused sentences that each earn their place. The first sentence states the core functionality with constraints, and the second sentence explains the rationale, with no wasted words or redundant information.

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

Completeness4/5

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

For a destructive operation with no annotations and no output schema, the description does well by specifying constraints and rationale. However, it doesn't mention what happens after deletion (confirmation? error messages?) or potential dependencies, leaving some gaps in completeness for a mutation tool.

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 100% description coverage, so the baseline is 3. The description adds value by reinforcing the parameter constraint ('must be an existing unfinished task ID'), which provides additional context beyond the schema's technical description of the taskId parameter as a UUID.

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 ('Delete') and resource ('unfinished tasks'), distinguishing it from siblings like 'complete_task' or 'update_task' by specifying it only works on unfinished tasks. It provides a precise verb+resource combination with explicit scope limitations.

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 explicitly states when to use this tool ('Delete unfinished tasks') and when not to use it ('does not allow deleting completed tasks'), providing clear exclusion criteria. It distinguishes this from potential alternatives like 'clear_all_tasks' by specifying it works on individual tasks only.

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