Skip to main content
Glama

get_tasks

Retrieve tasks from Todoist using filters like project, section, label, or natural language queries such as 'today' or 'overdue'.

Instructions

Get tasks from Todoist with optional filtering.

Args:
    project_id: Filter tasks by project ID
    section_id: Filter tasks by section ID
    label: Filter tasks by label
    filter_query: Natural language filter (e.g., 'today', 'overdue', 'p1')

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNo
section_idNo
labelNo
filter_queryNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary MCP tool handler for 'get_tasks'. It accepts filtering parameters, calls the TodoistClient's get_tasks method, formats the results into a human-readable string list, and returns it.
    @mcp.tool()
    async def get_tasks(
        project_id: Optional[str] = None,
        section_id: Optional[str] = None, 
        label: Optional[str] = None,
        filter_query: Optional[str] = None
    ) -> str:
        """Get tasks from Todoist with optional filtering.
        
        Args:
            project_id: Filter tasks by project ID
            section_id: Filter tasks by section ID
            label: Filter tasks by label
            filter_query: Natural language filter (e.g., 'today', 'overdue', 'p1')
        """
        _check_client()
        
        tasks = await todoist_client.get_tasks(
            project_id=project_id,
            section_id=section_id,
            label=label,
            filter_query=filter_query
        )
        
        if not tasks:
            return "No tasks found."
        
        task_list = []
        for task in tasks:
            task_info = f"• [{task.id}] {task.content}"
            if task.due_string or task.due_date:
                task_info += f" (Due: {task.due_string or task.due_date})"
            if task.priority > 1:
                task_info += f" [Priority: {task.priority}]"
            if task.labels:
                task_info += f" Labels: {', '.join(task.labels)}"
            task_list.append(task_info)
        
        return f"Found {len(tasks)} tasks:\n" + "\n".join(task_list)
  • Helper method in TodoistClient class that performs the actual API request to fetch tasks from Todoist with optional filters and parses into TodoistTask models.
    async def get_tasks(self, 
                       project_id: Optional[str] = None,
                       section_id: Optional[str] = None,
                       label: Optional[str] = None,
                       filter_query: Optional[str] = None) -> List[TodoistTask]:
        """Get tasks with optional filtering."""
        params = {}
        if project_id:
            params["project_id"] = project_id
        if section_id:
            params["section_id"] = section_id
        if label:
            params["label"] = label
        if filter_query:
            params["filter"] = filter_query
        
        data = await self._request("GET", "/tasks", params=params)
        return [TodoistTask(**task) for task in data]
  • Pydantic BaseModel schema for TodoistTask, used to validate and structure task data returned from the Todoist API in get_tasks.
    class TodoistTask(BaseModel):
        """Represents a Todoist task."""
        id: str
        content: str
        description: str = ""
        is_completed: bool = False
        labels: List[str] = []
        priority: int = 1
        due_string: Optional[str] = None
        due_date: Optional[str] = None
        project_id: str = ""
        section_id: Optional[str] = None
        parent_id: Optional[str] = None
        order: int = 0
        url: str = ""
        created_at: str = ""
  • The @mcp.tool() decorator registers the get_tasks function as an MCP tool.
    @mcp.tool()
Behavior2/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 mentions 'optional filtering' but doesn't describe key behaviors like whether this is a read-only operation, if it requires authentication, how results are returned (e.g., pagination, format), or any rate limits. The description is minimal and leaves critical behavioral traits unspecified.

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 a clear opening sentence and a structured 'Args' section. It's front-loaded with the core purpose, and each sentence adds value without redundancy. Minor improvements could include integrating the parameter explanations more seamlessly.

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

Completeness3/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 (4 optional parameters) and the presence of an output schema (which handles return values), the description is partially complete. It covers the purpose and parameters but lacks behavioral context and usage guidelines. With no annotations, it should do more to compensate, especially for a tool with filtering capabilities.

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?

The description includes an 'Args' section that lists all four parameters with brief explanations, adding meaning beyond the input schema (which has 0% description coverage). However, the explanations are basic (e.g., 'Filter tasks by project ID') and don't provide detailed semantics like format examples (except for 'filter_query'), constraints, or interactions between parameters.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('tasks from Todoist') with optional filtering, making the purpose immediately understandable. It distinguishes itself from siblings like 'get_task' (singular) by implying it retrieves multiple tasks, though it doesn't explicitly contrast with other list-like tools like 'get_projects' or 'get_sections'.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to prefer 'get_tasks' over 'get_task' (singular), 'complete_task', or other siblings, nor does it specify prerequisites, contexts, or exclusions for usage.

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/dan-bailey/todoist-mcp'

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