Skip to main content
Glama
aafsar

Task Manager MCP Server

by aafsar

delete_task

Remove tasks from the Task Manager MCP Server by specifying the task ID to clear completed or unwanted items and maintain an organized task list.

Instructions

Delete a task by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesTask ID (use first 8 characters)

Implementation Reference

  • The primary handler function for the 'delete_task' MCP tool. It validates the input arguments using TaskIdSchema, loads the task storage, finds the task by prefix-matching the ID, removes it from the array using splice, persists the changes, and returns a formatted text response indicating success or failure.
    export async function deleteTask(args: unknown) {
      // Validate input
      const validated = TaskIdSchema.parse(args);
    
      // Load tasks
      const storage = await loadTasks();
    
      // Find task index
      const taskIndex = storage.tasks.findIndex((t) =>
        t.id.startsWith(validated.taskId)
      );
    
      if (taskIndex === -1) {
        return {
          content: [
            {
              type: "text",
              text: `❌ Task with ID ${validated.taskId} not found.`,
            },
          ],
        };
      }
    
      // Remove task
      const deletedTask = storage.tasks.splice(taskIndex, 1)[0]!;
      await saveTasks(storage);
    
      return {
        content: [
          {
            type: "text",
            text: `🗑️ Task "${deletedTask.title}" deleted successfully.`,
          },
        ],
      };
    }
  • Zod schema (TaskIdSchema) used for input validation within the delete_task handler.
    export const TaskIdSchema = z.object({
      taskId: z.string().min(8, "Task ID must be at least 8 characters"),
    });
  • JSON Schema definition for the 'delete_task' tool provided to MCP clients via the tools list.
    name: "delete_task",
    description: "Delete a task by ID",
    inputSchema: {
      type: "object",
      properties: {
        taskId: {
          type: "string",
          description: "Task ID (use first 8 characters)",
          minLength: 8,
        },
      },
      required: ["taskId"],
    },
  • src/index.ts:224-225 (registration)
    Dispatch logic in the MCP CallToolRequest handler that routes 'delete_task' calls to the deleteTask function.
    case "delete_task":
      return await deleteTask(args);
  • src/index.ts:13-21 (registration)
    Import statement registering the deleteTask handler function from tools.ts into the main index module.
      createTask,
      listTasks,
      updateTask,
      deleteTask,
      completeTask,
      searchTasks,
      getTaskStats,
      clearCompleted,
    } from "./tools.js";
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Delete' implies a destructive mutation, it doesn't specify whether deletion is permanent or reversible, what permissions are required, or what happens to associated data. For a destructive tool with zero annotation coverage, this leaves critical behavioral traits undocumented.

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 maximally concise with a single, direct sentence that states exactly what the tool does. There's no wasted language or unnecessary elaboration, making it immediately scannable and front-loaded with the essential information.

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?

For a destructive operation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't address critical context like whether deletion is permanent, what confirmation or warnings might apply, what happens on success/failure, or how this differs from other task-modification tools in the sibling set.

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%, with the single parameter 'taskId' fully documented in the schema (including format guidance to 'use first 8 characters'). The description adds no additional parameter semantics beyond what the schema already provides, meeting the baseline expectation when schema coverage is complete.

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 action ('Delete') and target resource ('a task by ID'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'clear_completed' or 'complete_task' that also affect task state, missing an opportunity to clarify its specific role in the task management system.

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?

No guidance is provided about when to use this tool versus alternatives. With siblings like 'clear_completed' (which might delete multiple tasks) and 'complete_task' (which changes status rather than removing), the description offers no context about appropriate use cases, prerequisites, or warnings about this destructive operation.

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/aafsar/task-manager-mcp-server'

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