complete_current_task
Mark the current task as completed while keeping it visible for reference, then automatically shift focus to the next incomplete task to maintain workflow continuity.
Instructions
Mark current task as COMPLETED. Task remains visible in structure (living document approach). Focus automatically moves to a nearby incomplete task. Creates permanent record in history. You can use switch_focus to work on any specific task instead. Use remove_task to clean up workspace later.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/handlers.py:114-137 (handler)The main handler function for the 'complete_current_task' tool. It calls the task_manager to complete the task and returns a structured response with details about the completed task and new current task.async def handle_complete_current_task(self) -> Dict[str, Any]: completed = self.task_manager.complete_current_task() if not completed: return {"error": "No current task to complete"} new_current = self.task_manager.current_task response = { "completed_task_id": completed.id, "completed_task_title": completed.title, "new_current_task_id": new_current.id if new_current else None, "new_current_task_title": ( new_current.title if new_current else "No active tasks (zen state)" ), } # Add focus path if there's a new current task if new_current: response["focus_path"] = self.task_manager.get_focus_path() response["navigation_hint"] = ( f"Focus moved to '{new_current.title}'. Use switch_focus to work on any other task." ) return response
- src/handlers.py:291-295 (schema)The input schema and description for the 'complete_current_task' tool, defined in get_tool_definitions().Tool( name="complete_current_task", description="Mark current task as COMPLETED. Task remains visible in structure (living document approach). Focus automatically moves to a nearby incomplete task. Creates permanent record in history. You can use switch_focus to work on any specific task instead. Use remove_task to clean up workspace later.", inputSchema={"type": "object", "properties": {}}, ),
- src/server.py:59-59 (registration)Registration of the tool handler in the call_tool dispatcher map."complete_current_task": handlers.handle_complete_current_task,
- src/task_manager.py:118-153 (helper)The core logic method in TaskManager that marks the current task as completed and manages focus shifting to the next appropriate task.def complete_current_task(self) -> Optional[Task]: current = self.current_task if not current: return None current.status = TaskStatus.COMPLETED current.completed_at = datetime.now() self.completed_tasks.append(current) self._manual_current_task = None # Clear manual focus # Find the next incomplete task to focus on # First, look for incomplete siblings to the left if isinstance(current, SubTask): # Find which main task contains this subtask for main_task in self.global_tasks: if current in main_task.sub_tasks: # Look for incomplete subtasks to the left current_index = main_task.sub_tasks.index(current) for i in range(current_index - 1, -1, -1): if main_task.sub_tasks[i].status != TaskStatus.COMPLETED: main_task.sub_tasks[i].status = TaskStatus.CURRENT return current # No incomplete siblings, make parent current if incomplete if main_task.status != TaskStatus.COMPLETED: main_task.status = TaskStatus.CURRENT else: # Parent is also complete, find previous incomplete main task self._find_and_focus_previous_incomplete_task() break else: # Current is a main task, find previous incomplete main task self._find_and_focus_previous_incomplete_task() return current