Skip to main content
Glama

delete_subtask

Remove an uncompleted subtask from a task to update progress and manage workflow effectively.

Instructions

Delete a subtask from a task. Provide 'requestId', 'taskId', and 'subtaskId'.

Only uncompleted subtasks can be deleted.

A progress table will be displayed showing the updated task with its remaining subtasks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestIdYes
taskIdYes
subtaskIdYes

Implementation Reference

  • MCP tool handler function that parses arguments and delegates to the TaskFlowService.deleteSubtask method.
    async delete_subtask(args: any) {
      const { requestId, taskId, subtaskId } = args ?? {};
      return service.deleteSubtask(String(requestId), String(taskId), String(subtaskId));
    },
  • Core implementation of subtask deletion in TaskFlowService: loads tasks, validates existence and incompletion, removes subtask, saves, and returns progress table.
    public async deleteSubtask(requestId: string, taskId: string, subtaskId: string) {
      await this.loadTasks();
      const req = this.getRequest(requestId);
      if (!req) return { status: "error", message: "Request not found" };
    
      const task = req.tasks.find((t) => t.id === taskId);
      if (!task) return { status: "error", message: "Task not found" };
    
      const subtaskIndex = task.subtasks.findIndex((s) => s.id === subtaskId);
      if (subtaskIndex === -1) return { status: "error", message: "Subtask not found" };
      if (task.subtasks[subtaskIndex].done) return { status: "error", message: "Cannot delete completed subtask" };
    
      task.subtasks.splice(subtaskIndex, 1);
      await this.saveTasks();
    
      const progressTable = formatTaskProgressTableForRequest(req);
      return { status: "subtask_deleted", message: `Subtask ${subtaskId} has been deleted.\n${progressTable}` };
    }
  • Input schema definition for the delete_subtask tool parameters.
    delete_subtask: {
      type: "object",
      properties: {
        requestId: { type: "string" },
        taskId: { type: "string" },
        subtaskId: { type: "string" },
      },
      required: ["requestId", "taskId", "subtaskId"],
    },
  • Tool registration: exports the DELETE_SUBTASK_TOOL object with name, description, and inputSchema used by the MCP server.
    export const DELETE_SUBTASK_TOOL: Tool = {
      name: "delete_subtask",
      description:
        "Delete a subtask from a task. Provide 'requestId', 'taskId', and 'subtaskId'.\n\n" +
        "Only uncompleted subtasks can be deleted.\n\n" +
        "A progress table will be displayed showing the updated task with its remaining subtasks.",
      inputSchema: {
        type: "object",
        properties: {
          requestId: { type: "string" },
          taskId: { type: "string" },
          subtaskId: { type: "string" },
        },
        required: ["requestId", "taskId", "subtaskId"],
      },
    };
  • Tool registration in the MCP server's listTools response, including DELETE_SUBTASK_TOOL in the available tools array.
    DELETE_SUBTASK_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