Skip to main content
Glama

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; }; }

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