Skip to main content
Glama
someposer
by someposer

list_tasks

Retrieve a comprehensive list of all tasks from OmniFocus, including their full hierarchy and parent tags, for efficient task management and organization.

Instructions

List all tasks in OmniFocus. The task full name is the full heirarchy of the task, including parent tags.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core implementation of the list_tasks tool. Constructs a JavaScript template using common functions (including formatTask) and evaluates it via evaluate_javascript to fetch and format all flattened tasks from OmniFocus.
    def list_tasks() -> list[dict[str, str]]:
        """List all tasks in OmniFocus.
    
        Returns:
            A list of dictionaries containing task names, ids, project ids, and tag ids.
        """
        script = Template(
            dedent("""
        ${__common_functions__}
    
        (() => {
            return flattenedTasks.map((task) => {
                try {
                    return formatTask(task);
                } catch (e) {
                    return null;
                }
            }).filter(Boolean);
        })();
        """)
        )
    
        return evaluate_javascript(script.substitute(__common_functions__=__common_functions__))
  • Registers the 'list_tasks' tool in the FastMCP server using @mcp.tool decorator. Serves as the MCP tool handler, delegating execution to the core omnifocus.list_tasks() implementation.
    @mcp.tool
    def list_tasks() -> list[dict[str, str]]:
        """List all tasks in OmniFocus. The task full name is the full heirarchy of the task, including parent tags."""
        return omnifocus.list_tasks()
  • Shared JavaScript functions injected into list_tasks script, including formatTask which structures task data into the output dict format, taskStatusToString for status mapping, and others used in task listing.
    __common_functions__ = dedent("""
    function projectStatusToString(status) {
        // Handle null/undefined cases
        if (!status) {
            return 'Unknown';
        }
        
        // Map of status objects to their string representations
        const statusMap = {
            [Project.Status.Active]: 'Active',
            [Project.Status.Done]: 'Done', 
            [Project.Status.Dropped]: 'Dropped',
            [Project.Status.OnHold]: 'OnHold',
        };
        
        // Return the corresponding string or 'Unknown' if not found
        return statusMap[status] || 'Unknown';
    }
                                  
    function taskStatusToString(status) {
        // Handle null/undefined cases
        if (!status) {
            return 'Unknown';
        }
        
        // Map of status objects to their string representations
        const statusMap = {
            [Task.Status.Available]: 'Available',
            [Task.Status.Blocked]: 'Blocked', 
            [Task.Status.Completed]: 'Completed',
            [Task.Status.Dropped]: 'Dropped',
            [Task.Status.DueSoon]: 'DueSoon',
            [Task.Status.Next]: 'Next',
            [Task.Status.Overdue]: 'Overdue'
        };
        
        // Return the corresponding string or 'Unknown' if not found
        return statusMap[status] || 'Unknown';
    }
                                  
    function getFullTagName(tag) {
        const names = [];
        let currentTag = tag;
        // Traverse up the hierarchy
        while (currentTag) {
            names.unshift(currentTag.name);
            try {
                currentTag = currentTag.parent;
            } catch (e) {
                break;  // If we can't access parent, stop traversing
            }
        }
        return names.join(' : ');
    };
                                  
    function getLeafNodes(node) {
        if (!node.children || node.children.length === 0) {
            return [node];
        }
        return node.children.flatMap(getLeafNodes);
    }
    
    function getPerspectiveByName(name) {
        let perspectives = new Array()
        perspectives = perspectives.concat(Perspective.BuiltIn.all)
        perspectives = perspectives.concat(Perspective.Custom.all)
        perspectiveNames = perspectives.map(perspective => perspective.name.toUpperCase())
    
        return perspectives[perspectiveNames.indexOf(name.toUpperCase())] || null;
    }
                                  
    function formatTask(task) {
        return {
            id: task.id.primaryKey,
            name: task.name,
            projectName: task.containingProject ? task.containingProject.name : null,
            status: taskStatusToString(task.taskStatus),
            flagged: task.flagged,
            deferDate: task.deferDate ? task.deferDate.toString() : null,
            dueDate: task.dueDate ? task.dueDate.toString() : null,
            dropped: task.dropped,
            completed: task.completed,
            tags: task.tags ? task.tags.map(tt => tt.name) : [],
            note: task.note
        };
    }
                                  
    function taskStatusFilter(task, allowedStatuses) {
        if (!allowedStatuses || allowedStatuses.length === 0) {
            return true;
        }
        return allowedStatuses.includes(taskStatusToString(task.taskStatus));
    }
    """)
  • Defines the output schema as list[dict[str, str]] for the list_tasks tool via type hint, used by FastMCP for validation.
    @mcp.tool
    def list_tasks() -> list[dict[str, str]]:
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It describes the return format (task full name with hierarchy) but doesn't cover pagination, rate limits, authentication needs, error conditions, or whether this is a read-only operation. For a list operation with zero annotation coverage, this leaves significant behavioral gaps.

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?

Two clear sentences with zero waste. The first states the core purpose, the second clarifies the output format. Front-loaded with the main action, though could be slightly more structured for readability.

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?

For a simple list operation with 0 parameters and no output schema, the description covers the basic purpose and output format. However, without annotations and with multiple sibling alternatives, it should provide more guidance on when to use this specific tool vs. filtered alternatives. The lack of behavioral context for a tool with no annotation coverage is a notable gap.

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

Parameters4/5

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

The tool has 0 parameters with 100% schema description coverage, so the schema already fully documents the parameter situation. The description appropriately doesn't discuss parameters, maintaining focus on what the tool does rather than its inputs. Baseline for 0 parameters is 4.

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 ('List') and resource ('all tasks in OmniFocus'), making the purpose explicit. It distinguishes from some siblings by listing all tasks without filtering, but doesn't explicitly differentiate from list_tasks_by_project or list_tasks_by_tag which provide filtered views.

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

Usage Guidelines3/5

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

The description implies usage context by specifying 'all tasks' and explaining the 'full name' format, but doesn't provide explicit guidance on when to use this vs. alternatives like list_tasks_by_project or list_tasks_by_tag. No when-not-to-use or prerequisite information is included.

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

Related 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/someposer/mcp-omnifocus'

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