Skip to main content
Glama
mdoel
by mdoel

get_active_projects

Retrieve a list of current, non-completed projects from OmniFocus to view ongoing work and manage active tasks.

Instructions

Call this tool to get a list of all active (not completed or dropped) projects from OmniFocus. Use it when the user asks for their 'active projects' or 'current projects'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Primary handler function implementing the get_active_projects tool logic: generates JXA script for all projects, executes via osascript, parses JSON output, and filters to active projects (non-completed and non-dropped).
    async getActiveProjects(): Promise<any[]> {
      console.error('[DEBUG] getActiveProjects called');
      const jxaScript = buildJxaScriptForProjects(false);
      const output = this.executeScript(jxaScript);
      try {
        const projects = JSON.parse(output);
        return projects.filter((p: any) => !p.completed && !(p.status && typeof p.status === 'string' && p.status.toLowerCase().includes('dropped')));
      } 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:56-60 (registration)
    Tool registration in ListToolsRequestHandler, defining name, description, and empty input schema.
    {
      name: 'get_active_projects',
      description: "Call this tool to get a list of all active (not completed or dropped) projects from OmniFocus. Use it when the user asks for their 'active projects' or 'current projects'.",
      inputSchema: { type: 'object', properties: {} }
    },
  • MCP tool dispatch handler case that calls the client implementation.
    case 'get_active_projects':
      result = await this.client.getActiveProjects();
      break;
  • Helper function that generates the JXA (JavaScript for Automation) script executed by OmniFocus to retrieve project data.
    export function buildJxaScriptForProjects(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 isInTemplatesFolder(project) {
            let folder = safe(project, 'folder');
            while (folder) {
              if (safe(folder, 'name') === 'Templates') return true;
              folder = safe(folder, 'parentFolder');
            }
            return false;
          }
          function isExcludedProject(project) {
            const name = safe(project, 'name') || '';
            if (name.includes('«') || name.includes('»')) return true;
            if (name.includes('⚙️')) return true;
            return isInTemplatesFolder(project);
          }
          function getProjectData(project) {
            return {
              id: safe(project, 'id'),
              name: safe(project, 'name'),
              note: safe(project, 'note'),
              completed: safe(project, 'completed'),
              status: safe(project, 'status'),
              flagged: safe(project, 'flagged'),
              folder: (function() {
                const folder = safe(project, 'folder');
                return folder ? { id: safe(folder, 'id'), name: safe(folder, 'name') } : null;
              })(),
            };
          }
          const allProjects = Array.from(ofDoc.flattenedProjects());
          const filteredProjects = allProjects.filter(project => {
            if (isExcludedProject(project)) return false;
            // No activeOnly filtering here; always return all projects
            return true;
          });
          const result = filteredProjects.map(getProjectData);
          return JSON.stringify(result);
        })();
      `;
    } 
  • TypeScript interface defining the structure of project objects returned by the get_active_projects tool.
    export interface OmniFocusProject {
      id: string;
      name: string;
      note: string;
      status: 'active' | 'on-hold' | 'completed' | 'dropped';
      completionDate?: string;
      creationDate: string;
      modificationDate: string;
      dueDate?: string;
      deferDate?: string;
      sequential: boolean;
      singleton: boolean;
      containingFolder?: {
        id: string;
        name: string;
      };
    }
Behavior3/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. It describes the tool's behavior as retrieving a list of active projects, which is adequate but lacks details like response format, pagination, or error handling. It doesn't contradict any annotations.

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 front-loaded with the core purpose in the first sentence, followed by usage guidance in the second. Both sentences earn their place with no wasted words, making it highly efficient and well-structured.

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?

For a tool with 0 parameters, no annotations, and no output schema, the description is complete enough by clearly stating what it does and when to use it. It could slightly improve by hinting at the return format, but it's largely sufficient given the low complexity.

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% coverage, so no parameter documentation is needed. The description appropriately adds no parameter details, maintaining focus on the tool's purpose and usage.

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 verb ('get a list') and resource ('all active projects from OmniFocus'), explicitly distinguishing it from siblings by specifying 'active (not completed or dropped)' projects rather than all projects or tasks.

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 provides explicit guidance on when to use this tool ('when the user asks for their "active projects" or "current projects"'), with clear context that distinguishes it from sibling tools like 'get_all_projects' or 'get_active_tasks'.

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