peek_context
View parent tasks and previous siblings to understand the context and purpose of the current task without losing focus. Enhances clarity in hierarchical task management systems like Aidderall MCP Server.
Instructions
Look at parent task and previous sibling without changing focus (understand WHY you're doing current task)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_body | No | Include task body content |
Implementation Reference
- src/handlers.py:175-197 (handler)The main handler function that executes the peek_context tool, calling task_manager.peek_context and formatting the output.async def handle_peek_context(self, include_body: bool = False) -> Dict[str, Any]: parent, immediate = self.task_manager.peek_context() def format_task(task: Optional[Task]) -> Optional[Dict[str, Any]]: if not task: return None result = { "id": task.id, "title": task.title, "status": task.status.value, "created_at": task.created_at.isoformat(), } if include_body: result["body"] = task.body if task.completed_at: result["completed_at"] = task.completed_at.isoformat() return result return { "parent_context": format_task(parent), "immediate_context": format_task(immediate), }
- src/handlers.py:330-343 (schema)The input schema definition for the peek_context tool within the Tool object.Tool( name="peek_context", description="Look at parent task and previous sibling without changing focus (understand WHY you're doing current task)", inputSchema={ "type": "object", "properties": { "include_body": { "type": "boolean", "description": "Include task body content", "default": False, } }, }, ),
- src/server.py:67-69 (registration)Registration of the peek_context handler in the server's call_tool dispatcher."peek_context": lambda: handlers.handle_peek_context( arguments.get("include_body", False) ),
- src/task_manager.py:359-379 (helper)Helper method in TaskManager that retrieves the parent and immediate previous task without changing focus.def peek_context(self) -> Tuple[Optional[Task], Optional[Task]]: current = self.current_task if not current: return None, None if isinstance(current, SubTask): last_main_task = self.global_tasks[-1] siblings = self.get_siblings_to_left() immediate_context = siblings[-1] if siblings else None return last_main_task, immediate_context else: if len(self.global_tasks) > 1: prev_main_task = self.global_tasks[-2] prev_immediate_context: Task = ( prev_main_task.sub_tasks[-1] if prev_main_task.sub_tasks else prev_main_task ) return prev_main_task, prev_immediate_context return None, None