Skip to main content
Glama

delete_task

Remove uncompleted tasks from the MCP TaskManager queue to maintain an organized workflow and track remaining tasks.

Instructions

Delete a specific task from a request. Only uncompleted tasks can be deleted.

A progress table will be displayed showing the remaining tasks after deletion.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestIdYes
taskIdYes

Implementation Reference

  • Zod input schema for the delete_task tool, requiring requestId and taskId.
    const DeleteTaskSchema = z.object({
      requestId: z.string(),
      taskId: z.string(),
    });
  • index.ts:190-194 (registration)
    Registration of the delete_task tool in the listTools method, including name, description, and schema reference.
    {
      name: "delete_task",
      description: "Delete a task from a request.",
      inputSchema: DeleteTaskSchema,
    },
  • Dispatcher case in callTool method that parses input using the schema and delegates to the deleteTask handler.
    case "delete_task": {
      const parsed = DeleteTaskSchema.safeParse(parameters);
      if (!parsed.success) {
        throw new Error(`Invalid parameters: ${parsed.error}`);
      }
      return this.deleteTask(parsed.data.requestId, parsed.data.taskId);
    }
  • Core handler implementation: finds the request and task, validates task is not done/approved, removes the task, saves data, returns success message with updated progress.
    public async deleteTask(requestId: string, taskId: string) {
      const request = this.data.requests.find((r) => r.requestId === requestId);
      if (!request) {
        throw new Error("Request not found");
      }
    
      const taskIndex = request.tasks.findIndex((t) => t.id === taskId);
      if (taskIndex === -1) {
        throw new Error("Task not found");
      }
    
      const task = request.tasks[taskIndex];
      if (task.done || task.approved) {
        throw new Error("Cannot delete completed or approved tasks");
      }
    
      request.tasks.splice(taskIndex, 1);
    
      await this.saveTasks();
    
      return {
        message:
          "Task deleted successfully.\n" + this.formatTaskProgressTable(requestId),
      };
    }

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/Rudra-ravi/mcp-taskmanager'

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