Skip to main content
Glama

delete_task

Remove uncompleted tasks from TaskFlow MCP requests to manage workflows. Displays remaining tasks in a progress table after deletion.

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

  • The MCP tool handler function for 'delete_task' that extracts requestId and taskId from arguments and delegates to TaskFlowService.deleteTask.
    async delete_task(args: any) {
      const { requestId, taskId } = args ?? {};
      return service.deleteTask(String(requestId), String(taskId));
    },
  • Core implementation in TaskFlowService: loads task data, verifies request and task exist and task not done, removes task from array, saves file, generates progress table.
    public async deleteTask(requestId: string, taskId: string) {
      await this.loadTasks();
      const req = this.getRequest(requestId);
      if (!req) return { status: "error", message: "Request not found" };
    
      const taskIndex = req.tasks.findIndex((t) => t.id === taskId);
      if (taskIndex === -1) return { status: "error", message: "Task not found" };
      if (req.tasks[taskIndex].done) return { status: "error", message: "Cannot delete completed task" };
    
      req.tasks.splice(taskIndex, 1);
      await this.saveTasks();
    
      const progressTable = formatTaskProgressTableForRequest(req);
      return { status: "task_deleted", message: `Task ${taskId} has been deleted.\n${progressTable}` };
    }
  • JSON Schema definition for delete_task input parameters: requires requestId and taskId.
    delete_task: {
      type: "object",
      properties: {
        requestId: { type: "string" },
        taskId: { type: "string" },
      },
      required: ["requestId", "taskId"],
    },
  • Tool metadata registration: defines name, description, and inputSchema for the delete_task tool.
    export const DELETE_TASK_TOOL: Tool = {
      name: "delete_task",
      description:
        "Delete a specific task from a request. Only uncompleted tasks can be deleted.\n\n" +
        "A progress table will be displayed showing the remaining tasks after deletion.",
      inputSchema: {
        type: "object",
        properties: {
          requestId: { type: "string" },
          taskId: { type: "string" },
        },
        required: ["requestId", "taskId"],
      },
    };
  • Server registration: DELETE_TASK_TOOL included in the tools list returned by ListToolsRequest handler.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        PLAN_TASK_TOOL,
        GET_NEXT_TASK_TOOL,
        MARK_TASK_DONE_TOOL,
        OPEN_TASK_DETAILS_TOOL,
        LIST_REQUESTS_TOOL,
        ADD_TASKS_TO_REQUEST_TOOL,
        UPDATE_TASK_TOOL,
        DELETE_TASK_TOOL,
        ADD_SUBTASKS_TOOL,
        MARK_SUBTASK_DONE_TOOL,
        UPDATE_SUBTASK_TOOL,
        DELETE_SUBTASK_TOOL,
        EXPORT_TASK_STATUS_TOOL,
        ADD_NOTE_TOOL,
        UPDATE_NOTE_TOOL,
        DELETE_NOTE_TOOL,
        ADD_DEPENDENCY_TOOL,
        GET_PROMPTS_TOOL,
        SET_PROMPTS_TOOL,
        UPDATE_PROMPTS_TOOL,
        REMOVE_PROMPTS_TOOL,
        ARCHIVE_COMPLETED_REQUESTS_TOOL,
        LIST_ARCHIVED_REQUESTS_TOOL,
        RESTORE_ARCHIVED_REQUEST_TOOL,
      ],
    }));

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/pinkpixel-dev/taskflow-mcp'

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