create_subtasks
Break down complex tasks into manageable subtasks with categories to organize work and track progress in your task management system.
Instructions
Create multiple subtasks for a parent task with categories.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | ||
| subtasks | Yes |
Implementation Reference
- server.py:77-80 (handler)MCP tool handler function for 'create_subtasks', registered via @mcp.tool() decorator. 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 class. Validates parent task, sets parent_id on each subtask, calls add_task to create them, and returns subtask 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 }