Skip to main content
Glama

add_subtasks

Break down tasks into manageable subtasks by providing 'requestId', 'taskId', and 'subtasks' array. Track progress through an updated task table in TaskFlow MCP.

Instructions

Add subtasks to an existing task. Provide 'requestId', 'taskId', and 'subtasks' array.

Subtasks are smaller units of work that make up a task. All subtasks must be completed before a task can be marked as done.

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

Input Schema

NameRequiredDescriptionDefault
requestIdYes
subtasksYes
taskIdYes

Input Schema (JSON Schema)

{ "properties": { "requestId": { "type": "string" }, "subtasks": { "items": { "properties": { "description": { "type": "string" }, "title": { "type": "string" } }, "required": [ "title", "description" ], "type": "object" }, "type": "array" }, "taskId": { "type": "string" } }, "required": [ "requestId", "taskId", "subtasks" ], "type": "object" }

Implementation Reference

  • The MCP tool handler function 'add_subtasks' that extracts parameters from args and delegates execution to TaskFlowService.addSubtasks
    async add_subtasks(args: any) { const { requestId, taskId, subtasks } = args ?? {}; return service.addSubtasks(String(requestId), String(taskId), subtasks ?? []); },
  • JSON Schema definition for the 'add_subtasks' tool input validation, referencing the shared subtaskJson schema
    add_subtasks: { type: "object", properties: { requestId: { type: "string" }, taskId: { type: "string" }, subtasks: { type: "array", items: subtaskJson }, }, required: ["requestId", "taskId", "subtasks"], },
  • Registration of the 'add_subtasks' tool: ADD_SUBTASKS_TOOL is included in the tools list returned by the server's listTools 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, ], }));
  • Core service method implementing the logic to add subtasks to a task: validates inputs, generates IDs, persists to file, generates progress table
    public async addSubtasks( requestId: string, taskId: string, subtasks: { title: string; description: 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" }; if (task.done) return { status: "error", message: "Cannot add subtasks to completed task" }; const factory = new TaskFactory({ value: this.globalIdCounter }); const newSubtasks = subtasks.map((s) => factory.createSubtask(s)); this.globalIdCounter = factory["counterRef"].value; task.subtasks.push(...newSubtasks); await this.saveTasks(); const progressTable = formatTaskProgressTableForRequest(req); return { status: "subtasks_added", message: `Added ${newSubtasks.length} new subtasks to task ${taskId}.\n${progressTable}`, newSubtasks: newSubtasks.map((s) => ({ id: s.id, title: s.title, description: s.description })), }; }

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

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