extend_current_task
Add subtasks to break down complex tasks into manageable steps, maintaining focus and context. Supports hierarchical task structures for organized problem-solving and flexible task switching.
Instructions
Add a subtask to organize and decompose work. Creates hierarchical structure for complex tasks. Subtasks help break down work into manageable pieces. You can work on tasks in any order using switch_focus. Example: Task A → Task B → Task C creates a nested structure, but you can jump between them freely. For unrelated work, use create_new_task.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | Full task context, notes, and details | |
| title | Yes | Brief task description (max 256 chars) |
Implementation Reference
- src/handlers.py:54-74 (handler)Main handler function that processes 'extend_current_task' tool calls, delegates to TaskManager.extend_current_task, builds response with task details, focus path, and stack warnings.async def handle_extend_current_task(self, title: str, body: str) -> Dict[str, Any]: try: task = self.task_manager.extend_current_task(title, body) response = { "task_id": task.id, "message": f"Added subtask: {task.title}", "focus_path": self.task_manager.get_focus_path(), "is_current": True, "hint": "Use switch_focus to work on any task in any order", } # Add warning if getting deep stack_depth = self.task_manager.get_stack_depth() if stack_depth >= 4: response["info"] = ( f"Stack is {stack_depth} levels deep. Consider using create_new_task for unrelated work." ) return response except ValueError as e: return {"error": str(e)}
- src/task_manager.py:99-116 (helper)Core logic for extending the current task by creating a new SubTask, appending it to the last MainTask, setting statuses appropriately, and clearing manual focus.def extend_current_task(self, title: str, body: str) -> SubTask: if self.is_zen_state: raise ValueError( "Cannot extend task in zen state. Create a new task first." ) if self.current_task: self.current_task.status = TaskStatus.PENDING new_sub_task = SubTask(title=title, body=body) new_sub_task.status = TaskStatus.CURRENT last_main_task = self.global_tasks[-1] last_main_task.add_sub_task(new_sub_task) self._manual_current_task = None # Clear manual focus return new_sub_task
- src/handlers.py:253-270 (schema)Tool schema definition for 'extend_current_task', including name, description, and input schema requiring title and body strings.Tool( name="extend_current_task", description="Add a subtask to organize and decompose work. Creates hierarchical structure for complex tasks. Subtasks help break down work into manageable pieces. You can work on tasks in any order using switch_focus. Example: Task A → Task B → Task C creates a nested structure, but you can jump between them freely. For unrelated work, use create_new_task.", inputSchema={ "type": "object", "properties": { "title": { "type": "string", "description": "Brief task description (max 256 chars)", }, "body": { "type": "string", "description": "Full task context, notes, and details", }, }, "required": ["title", "body"], }, ),
- src/server.py:40-42 (registration)MCP server registration for listing tools, which returns the tool definitions including 'extend_current_task'.@server.list_tools() async def list_tools() -> list[Any]: return handlers.get_tool_definitions()
- src/server.py:52-54 (registration)Dispatch registration in call_tool handler_map that routes 'extend_current_task' calls to the appropriate handler function."extend_current_task": lambda: handlers.handle_extend_current_task( arguments["title"], arguments["body"] ),