Skip to main content
Glama

get_all_tasks

Retrieve all tasks across all projects, with optional label filtering for comprehensive search.

Instructions

Get all tasks across all projects with optional label filtering (comprehensive search).

Use when you need to search/filter across your entire task system. For daily focus, use get_daily_productivity_overview() instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelNoOptional label name to filter by. If None, returns all tasks.
debugNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes
metadataYesMetadata about the data itself
summaryYesHuman-readable insights
debugYes
successYes
api_versionNocurrent
response_versionNo1.0

Implementation Reference

  • The MCP tool handler for get_all_tasks. Decorated with @mcp.tool(), it accepts an optional label filter, creates an API client, calls get_all_tasks_impl, and returns a StandardResponse.
    @mcp.tool()
    async def get_all_tasks(
        label: str | None = None, debug: bool = False
    ) -> StandardResponse:
        """Get all tasks across all projects with optional label filtering (comprehensive search).
    
        Use when you need to search/filter across your entire task system.
        For daily focus, use get_daily_productivity_overview() instead.
    
        Args:
            label: Optional label name to filter by. If None, returns all tasks.
    
        Note: This is a heavy operation that recursively searches all projects.
        """
        start_time = time.time()
        try:
            api_client = create_api_client()
            result = get_all_tasks_impl(api_client, label)
    
            # Estimate API calls based on typical project count
            estimated_api_calls = result.get("api_calls_made", 5)
    
            return create_simple_response(
                data=result,
                summary_text=f"Retrieved {result.get('total_tasks', 0)} tasks across all projects"
                + (f" with label '{label}'" if label else ""),
                api_endpoint="/categories + /children",
                api_calls_made=estimated_api_calls,
                debug=debug,
                start_time=start_time,
            )
        except Exception as e:
            logger.exception("Failed to get all tasks")
            return create_error_response(e, "/categories + /children", debug, start_time)
  • The implementation helper (get_all_tasks_impl). Fetches all top-level items (today tasks, due items, projects, categories), then recursively collects all nested items via get_all_nested_items. Optionally filters by label. Finally filters to tasks only (excluding projects/categories).
    def get_all_tasks_impl(
        api_client: MarvinAPIClient, label: str | None = None
    ) -> dict[str, Any]:
        """Get all tasks and projects with optional label filtering, using recursive traversal."""
        try:
            # Get all top-level items
            today_items = api_client.get_tasks()
            due_items = api_client.get_due_items()
            projects = api_client.get_projects()
            categories = api_client.get_categories()
    
            all_items = get_all_nested_items(
                list(itertools.chain(*[today_items, due_items, projects, categories])),
                api_client=api_client,
            )
    
            # Filter by label if specified
            if label:
                # Get all labels to understand the label structure
                labels = api_client.get_labels()
    
                # Find the label ID
                label_id = None
                for lbl in labels:
                    if lbl.get("title", "").lower() == label.lower():
                        label_id = lbl.get("_id")
                        break
    
                if label_id:
                    filtered_items = []
                    for item in all_items:
                        item_labels = item.get("labelIds", [])
                        if label_id in item_labels:
                            filtered_items.append(item)
                    all_items = filtered_items
                else:
                    # If label not found, return empty results
                    all_items = []
    
            # Filter to only tasks (not projects or categories)
            tasks = [
                item
                for item in all_items
                if item.get("type") not in ["project", "category"]
            ]
    
            return {
                "tasks": tasks,
                "task_count": len(tasks),
                "filter_applied": label is not None,
                "label_filter": label,
                "source": "Recursive traversal of all items",
            }
    
        except Exception as e:
            logger.exception("Failed to get all tasks")
            return {"error": str(e), "tasks": [], "task_count": 0}
  • Helper function get_all_nested_items that takes a list of top-level items and recursively expands projects/categories by fetching their children via _get_all_children_recursive, deduplicating by ID.
    def get_all_nested_items(
        items: list[dict[str, Any]], api_client: MarvinAPIClient
    ) -> list[dict[str, Any]]:
        all_items: list[dict[str, Any]] = []
        item_ids = set()
    
        for item in items:
            item_id = item.get("_id")
            if item_id and item_id not in item_ids:
                all_items.append(item)
                item_ids.add(item_id)
    
        # For each project/category, recursively get all children
        for item in list(all_items):  # Create a copy to avoid modifying while iterating
            item_id = item.get("_id")
            item_type = item.get("type")
            if not item_id or (item_type not in ["project", "category"]):
                continue
            children = _get_all_children_recursive(api_client, item_id)
            for child in children:
                child_id = child.get("_id")
                if child_id and child_id not in item_ids:
                    all_items.append(child)
                    item_ids.add(child_id)
        return all_items
  • Recursive helper _get_all_children_recursive that fetches children of a parent item and recursively fetches grandchildren, with cycle detection via a visited set.
    def _get_all_children_recursive(
        api_client: MarvinAPIClient, parent_id: str, visited: set[str] | None = None
    ) -> list[dict[str, Any]]:
        """Recursively get all children of a parent item, avoiding infinite loops."""
        if visited is None:
            visited = set()
    
        if parent_id in visited:
            logger.warning("Circular reference detected for parent_id %s", parent_id)
            return []
    
        visited.add(parent_id)
    
        try:
            direct_children = api_client.get_children(parent_id)
            all_children = list(direct_children)  # Copy the list
    
            # Recursively get children of each child
            for child in direct_children:
                child_id = child.get("_id")
                if child_id:
                    grandchildren = _get_all_children_recursive(
                        api_client, child_id, visited.copy()
                    )
                    all_children.extend(grandchildren)
    
        except Exception as e:
            logger.warning("Failed to get children for parent_id %s: %s", parent_id, e)
            return []
        else:
            return all_children
  • The FastMCP instance creation. The @mcp.tool() decorator on get_all_tasks (line 196) registers the tool with the MCP server.
    mcp: FastMCP = FastMCP(name="amazing-marvin-mcp")
Behavior4/5

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

No annotations, so description carries full burden. Describes it as a comprehensive search, implying broad scope and read-only nature. Lacks details on pagination, performance, or side effects, but is mostly transparent.

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?

Two sentences, no fluff, front-loaded with the core action in the first sentence.

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

Completeness5/5

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

For a simple retrieval tool with output schema, the description covers purpose, usage context, and differentiation from sibling, making it complete.

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

Parameters2/5

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

Schema coverage is 50% (debug parameter lacks description). Description only repeats 'optional label filtering' already in schema and does not explain the debug parameter, failing to compensate for missing schema detail.

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?

States 'Get all tasks across all projects with optional label filtering' with clear verb and scope, and distinguishes from sibling 'get_daily_productivity_overview'.

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?

Explicitly says 'Use when you need to search/filter across your entire task system' and provides an alternative for daily focus, showing when to use and when not.

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/bgheneti/Amazing-Marvin-MCP'

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