create_subtasks
Generate and assign multiple subtasks to a parent task using categorized lists, streamlining task organization and management within a structured workflow.
Instructions
Create multiple subtasks for a parent task with categories.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| subtasks | Yes | ||
| task_id | Yes |
Implementation Reference
- server.py:77-80 (handler)MCP tool handler for create_subtasks, decorated with @mcp.tool() for registration. Delegates to TaskService.create_subtasks.@mcp.tool() async def create_subtasks(task_id: str, subtasks: list[dict[str, Any]]) -> dict[str, Any]: """Create multiple subtasks for a parent task with categories.""" return service.create_subtasks(task_id, subtasks)
- Core implementation of create_subtasks in TaskService. Validates parent task, sets parent_id on each subtask, adds them using add_task, and returns IDs.def create_subtasks(self, task_id: str, subtasks: List[Dict[str, Any]]) -> Dict[str, Any]: """Create subtasks for a task and return their IDs.""" # Check if parent task exists parent_task = self.repository.get_todo_by_id(task_id) if not parent_task: return {"error": "Parent task not found"} subtask_ids = [] # Create each subtask for subtask in subtasks: subtask['parent_id'] = task_id subtask_id = self._ensure_id(subtask) self.add_task(subtask) subtask_ids.append(subtask_id) return { "message": f"Created {len(subtask_ids)} subtasks", "subtask_ids": subtask_ids }