Skip to main content
Glama

peek_context

View parent tasks and previous steps to understand the current task's purpose and maintain context in hierarchical task management systems.

Instructions

Look at parent task and previous sibling without changing focus (understand WHY you're doing current task)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_bodyNoInclude task body content

Implementation Reference

  • Main handler function that peeks at parent and immediate context tasks, formats them optionally including body, and returns as dict.
    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),
        }
  • Tool schema definition including input schema for include_body parameter.
    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 tool in the server handler map, mapping to the handlers.handle_peek_context method.
    "peek_context": lambda: handlers.handle_peek_context(
        arguments.get("include_body", False)
    ),
  • Helper method in TaskManager that returns the parent task and immediate previous context (sibling or previous main task).
    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
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively communicates the non-destructive nature ('without changing focus') and the tool's purpose for understanding context. However, it doesn't address potential limitations like what happens if there's no parent/previous sibling, performance characteristics, or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise with zero wasted words - a single sentence that front-loads the core functionality ('Look at parent task and previous sibling') followed by clarifying context. Every element earns its place, making it highly efficient for agent comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (context inspection without mutation), no annotations, and no output schema, the description provides good contextual coverage. It clearly explains what the tool does and its purpose, though it could benefit from mentioning what information is returned or how results are structured since there's no output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage for the single parameter, the description adds no additional parameter information beyond what's already documented in the schema. The baseline score of 3 reflects adequate but minimal value addition, as the schema already fully describes the 'include_body' parameter with its type, description, and default value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Look at') and resources ('parent task and previous sibling'), while distinguishing it from siblings by emphasizing it doesn't change focus. The 'understand WHY you're doing current task' clause adds valuable context about the tool's intent beyond basic functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('understand WHY you're doing current task'), which implicitly suggests it's for contextual understanding rather than task manipulation. However, it doesn't explicitly state when NOT to use it or name specific alternative tools from the sibling list that might serve similar purposes.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cheezcake/aidderall_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server