Skip to main content
Glama

remove_task

Remove tasks from your workspace structure to clean up completed or unnecessary items. This action deletes tasks and their subtasks while preserving completed items in history.

Instructions

Remove a task from the structure (cleanup your workspace). The task remains in completed_tasks history if it was completed. Can remove any task (completed or not). Removing a parent task removes all its subtasks. Use get_big_picture or get_stack_overview to see task IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesThe ID of the task to remove from the structure

Implementation Reference

  • The MCP tool handler function that executes the remove_task logic by delegating to TaskManager.remove_task.
    async def handle_remove_task(self, task_id: str) -> Dict[str, Any]:
        try:
            result = self.task_manager.remove_task(task_id)
            return result
        except ValueError as e:
            return {"error": str(e)}
  • The Tool object definition in get_tool_definitions, providing name, description, and inputSchema with task_id parameter.
    Tool(
        name="remove_task",
        description="Remove a task from the structure (cleanup your workspace). The task remains in completed_tasks history if it was completed. Can remove any task (completed or not). Removing a parent task removes all its subtasks. Use get_big_picture or get_stack_overview to see task IDs.",
        inputSchema={
            "type": "object",
            "properties": {
                "task_id": {
                    "type": "string",
                    "description": "The ID of the task to remove from the structure",
                }
            },
            "required": ["task_id"],
        },
    ),
  • src/server.py:48-75 (registration)
    The server.call_tool handler_map dictionary registers 'remove_task' by mapping it to the corresponding handler lambda.
    handler_map = {
        "create_new_task": lambda: handlers.handle_create_new_task(
            arguments["title"], arguments["body"]
        ),
        "extend_current_task": lambda: handlers.handle_extend_current_task(
            arguments["title"], arguments["body"]
        ),
        "get_current_task": handlers.handle_get_current_task,
        "get_big_picture": lambda: handlers.handle_get_big_picture(
            arguments.get("format", "text")
        ),
        "complete_current_task": handlers.handle_complete_current_task,
        "get_completed_tasks": lambda: handlers.handle_get_completed_tasks(
            arguments.get("order", "chronological")
        ),
        "update_current_task": lambda: handlers.handle_update_current_task(
            arguments["body"]
        ),
        "get_stack_overview": handlers.handle_get_stack_overview,
        "peek_context": lambda: handlers.handle_peek_context(
            arguments.get("include_body", False)
        ),
        "list_siblings": lambda: handlers.handle_list_siblings(
            arguments.get("include_body", False)
        ),
        "switch_focus": lambda: handlers.handle_switch_focus(arguments["task_id"]),
        "remove_task": lambda: handlers.handle_remove_task(arguments["task_id"]),
    }
  • The core implementation in TaskManager that locates the task by ID (main or subtask), removes it from the structure, clears focus if necessary, and returns a success dict. Note: parent removal cascades by popping the main task.
    def remove_task(self, task_id: str) -> Dict[str, Any]:
        """Remove a task from the structure (but keep in completed_tasks if it was completed)."""
        # Find the task in the structure
        removed_task: Optional[Task] = None
    
        # Check main tasks
        for i, main_task in enumerate(self.global_tasks):
            if main_task.id == task_id:
                removed_task = main_task
                self.global_tasks.pop(i)
    
                # If this was the current task, clear manual focus
                if removed_task == self._manual_current_task:
                    self._manual_current_task = None
    
                return {
                    "success": True,
                    "message": f"Removed task: {removed_task.title}",
                    "task_id": task_id,
                    "was_completed": removed_task.status == TaskStatus.COMPLETED,
                }
    
            # Check subtasks
            for j, sub_task in enumerate(main_task.sub_tasks):
                if sub_task.id == task_id:
                    removed_task = sub_task
                    main_task.sub_tasks.pop(j)
    
                    # If this was the current task, clear manual focus
                    if removed_task == self._manual_current_task:
                        self._manual_current_task = None
    
                    return {
                        "success": True,
                        "message": f"Removed subtask: {removed_task.title}",
                        "task_id": task_id,
                        "was_completed": removed_task.status == TaskStatus.COMPLETED,
                    }
    
        raise ValueError(f"Task with ID '{task_id}' not found in structure")
Behavior4/5

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

With no annotations, the description carries full burden and discloses key behavioral traits: it explains that removed tasks go to 'completed_tasks history if it was completed', clarifies it 'can remove any task (completed or not)', and warns that 'removing a parent task removes all its subtasks'. This covers mutation effects and side effects, though it doesn't mention permissions or error handling.

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

Conciseness4/5

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

The description is appropriately sized with three sentences that are front-loaded: the first states the core action, the second adds behavioral details, and the third provides usage guidance. Every sentence adds value, though it could be slightly more streamlined by integrating the ID reference into the first sentence.

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 complexity (a destructive operation with cascading effects), no annotations, and no output schema, the description does well by explaining the mutation behavior and history implications. However, it lacks details on return values or error cases, which would enhance completeness for such a critical tool.

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?

Schema description coverage is 100%, so the schema already documents the 'task_id' parameter. The description adds no additional meaning about the parameter beyond implying its purpose through context (e.g., referencing 'task IDs' from other tools), which meets the baseline for high schema coverage.

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 specific action ('remove a task from the structure') and resource ('task'), distinguishing it from siblings like 'complete_current_task' or 'update_current_task' that modify tasks rather than removing them. The phrase 'cleanup your workspace' reinforces the purpose without being tautological.

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

Usage Guidelines5/5

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

It explicitly provides when to use this tool ('to see task IDs, use get_big_picture or get_stack_overview'), which helps differentiate from sibling tools for viewing tasks. The description also implies usage for cleanup, though it doesn't specify when not to use it or name direct alternatives beyond the ID lookup tools.

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