Skip to main content
Glama
mdoel
by mdoel

get_active_tasks

Retrieve a list of uncompleted tasks from OmniFocus to view current work items and manage ongoing activities.

Instructions

Call this tool to get a list of all active (uncompleted) tasks from the user's OmniFocus. Use it when the user asks for their 'active tasks', 'current tasks', or 'open tasks'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function implementing the logic to fetch active tasks from OmniFocus by generating and executing a JXA script, parsing the JSON output.
    async getActiveTasks(filters: TaskFilters = {}): Promise<OmniFocusTask[]> {
      console.error('[DEBUG] getActiveTasks called with filters:', JSON.stringify(filters));
      const jxaScript = buildJxaScriptForTasks(true);
      const output = this.executeScript(jxaScript);
      try {
        const tasks = JSON.parse(output);
        return tasks;
      } catch (e) {
        console.error('[DEBUG] Failed to parse OmniFocus JXA output:', output);
        throw new Error('Failed to parse OmniFocus output as JSON');
      }
    }
  • src/server.ts:46-50 (registration)
    Tool registration in the MCP ListTools response, including name, description, and input schema (empty object since no parameters required).
    {
      name: 'get_active_tasks',
      description: "Call this tool to get a list of all active (uncompleted) tasks from the user's OmniFocus. Use it when the user asks for their 'active tasks', 'current tasks', or 'open tasks'.",
      inputSchema: { type: 'object', properties: {} }
    },
  • MCP CallToolRequest handler dispatch for 'get_active_tasks', invoking the OmniFocusClient method.
    case 'get_active_tasks':
      result = await this.client.getActiveTasks();
      break;
  • TypeScript interface defining the structure of OmniFocusTask, used as the return type for getActiveTasks.
    export interface OmniFocusTask {
      id: string;
      name: string;
      note: string;
      completed: boolean;
      completionDate?: string | null;
      creationDate: string;
      modificationDate: string;
      dueDate?: string | null;
      deferDate?: string | null;
      estimatedMinutes?: number | null;
      flagged: boolean;
      repetitionRule?: string | null;
      sequential: boolean;
      project?: {
        id: string;
        name: string;
      } | null;
      context?: {
        id: string;
        name: string;
      } | null;
      containingProject?: {
        id: string;
        name: string;
      } | null;
    }
  • Helper function generating the JXA (JavaScript for Automation) script executed in OmniFocus to retrieve active tasks, including filtering logic.
    export function buildJxaScriptForTasks(activeOnly: boolean): string {
      return `
        (() => {
          const app = Application('OmniFocus');
          app.includeStandardAdditions = true;
          const ofDoc = app.defaultDocument;
          function safe(obj, method) {
            try { return obj && typeof obj[method] === 'function' ? obj[method]() : null; } catch { return null; }
          }
          function getContext(task) {
            const ctx = safe(task, 'context');
            return ctx ? { id: safe(ctx, 'id'), name: safe(ctx, 'name') } : null;
          }
          function getProject(task) {
            const proj = safe(task, 'containingProject');
            return proj ? { id: safe(proj, 'id'), name: safe(proj, 'name') } : null;
          }
          function isInTemplatesFolder(project) {
            let folder = safe(project, 'folder');
            while (folder) {
              if (safe(folder, 'name') === 'Templates') return true;
              folder = safe(folder, 'parentFolder');
            }
            return false;
          }
          function isExcludedTask(task) {
            const name = safe(task, 'name') || '';
            const note = safe(task, 'note') || '';
            if (name.includes('«') || name.includes('»') || note.includes('«') || note.includes('»')) return true;
            if (name.includes('⚙️') || note.includes('⚙️')) return true;
            const proj = safe(task, 'containingProject');
            if (!proj) return false;
            return isInTemplatesFolder(proj);
          }
          function getTaskData(task) {
            return {
              id: safe(task, 'id'),
              name: safe(task, 'name'),
              note: safe(task, 'note'),
              completed: safe(task, 'completed'),
              status: safe(task, 'status'),
              completionDate: safe(task, 'completionDate') ? safe(task, 'completionDate').toISOString() : null,
              creationDate: safe(task, 'creationDate') ? safe(task, 'creationDate').toISOString() : null,
              modificationDate: safe(task, 'modificationDate') ? safe(task, 'modificationDate').toISOString() : null,
              dueDate: safe(task, 'dueDate') ? safe(task, 'dueDate').toISOString() : null,
              deferDate: safe(task, 'deferDate') ? safe(task, 'deferDate').toISOString() : null,
              estimatedMinutes: safe(task, 'estimatedMinutes'),
              flagged: safe(task, 'flagged'),
              repetitionRule: safe(task, 'repetitionRule'),
              sequential: safe(task, 'sequential'),
              project: safe(task, 'project'),
              context: getContext(task),
              containingProject: getProject(task)
            };
          }
          const allTasks = Array.from(ofDoc.flattenedTasks());
          const filteredTasks = allTasks.filter(task => {
            if (isExcludedTask(task)) return false;
            const statusObj = safe(task, 'status') ? task.status() : null;
            const statusName = statusObj ? safe(statusObj, 'name') : '';
            if (${activeOnly ? 'true' : 'false'}) {
              // Exclude completed or dropped tasks
              return !task.completed() && !/dropped/i.test(statusName);
            }
            return true;
          });
          const result = filteredTasks.map(getTaskData);
          return JSON.stringify(result);
        })();
      `;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves a list of active tasks, implying a read-only operation, but does not disclose other behavioral traits such as authentication requirements, rate limits, error conditions, or the format of the returned list. For a tool with zero annotation coverage, this is a significant gap.

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?

The description is concise and well-structured with two sentences: the first states the purpose, and the second provides usage guidelines. Every sentence adds value, and there is no wasted text, making it front-loaded and efficient.

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 low complexity (0 parameters, no output schema, no annotations), the description is reasonably complete for its purpose. However, it lacks details on behavioral aspects like authentication or output format, which could be important for an AI agent to use it correctly, especially without annotations.

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 input schema has 0 parameters with 100% description coverage, so no parameter documentation is needed. The description does not add parameter semantics, which is appropriate here, but it could have mentioned if any implicit parameters (e.g., user context) are involved. Baseline is 4 for zero 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 tool's purpose: 'get a list of all active (uncompleted) tasks from the user's OmniFocus.' It specifies the verb ('get'), resource ('active tasks'), and scope ('from the user's OmniFocus'), but does not explicitly differentiate it from sibling tools like 'get_all_tasks' beyond the 'active' qualifier.

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

Usage Guidelines4/5

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

The description provides clear usage context: 'Use it when the user asks for their 'active tasks', 'current tasks', or 'open tasks'.' This gives explicit guidance on when to invoke the tool, but does not mention when not to use it or name alternatives among the sibling 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/mdoel/omnifocus-mcp'

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