Skip to main content
Glama

extend_current_task

Add subtasks to break complex work into manageable pieces, creating hierarchical structures for organized problem-solving.

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
NameRequiredDescriptionDefault
titleYesBrief task description (max 256 chars)
bodyYesFull task context, notes, and details

Implementation Reference

  • Main handler function that executes the tool: calls task_manager.extend_current_task and formats response with focus path and 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)}
  • Tool schema definition including input schema for title and body parameters.
    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:52-54 (registration)
    Registration of the tool handler in the call_tool dispatcher map.
    "extend_current_task": lambda: handlers.handle_extend_current_task(
        arguments["title"], arguments["body"]
    ),
  • Core logic method that creates and adds a new SubTask to the current main task stack.
    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

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