UNPKG

omnifocus-mcp-enhanced

Version:

🚀 NEW: Native Custom Perspective Access! Enhanced MCP server with OmniFocus custom perspective support, hierarchical task display, AI-optimized tool selection, and comprehensive task management

37 lines (36 loc) • 1.44 kB
import { z } from 'zod'; import { getPerspectiveTasks } from '../primitives/getPerspectiveTasks.js'; export const schema = z.object({ perspectiveName: z.string().describe("Name of the OmniFocus perspective to access (e.g., '今日工作安排', 'Work Today', etc.)"), hideCompleted: z.boolean().optional().describe("Hide completed and dropped tasks (default: true)"), limit: z.number().max(500).optional().describe("Maximum number of tasks to return (default: 100)") }); export async function handler(args, extra) { try { // Validate that perspectiveName is provided if (!args.perspectiveName) { throw new Error("'perspectiveName' is required to access OmniFocus perspectives"); } const result = await getPerspectiveTasks({ perspectiveName: args.perspectiveName, hideCompleted: args.hideCompleted !== false, // Default to true limit: args.limit || 100 }); return { content: [{ type: "text", text: result }] }; } catch (err) { const errorMessage = err instanceof Error ? err.message : 'Unknown error occurred'; return { content: [{ type: "text", text: `Error accessing OmniFocus perspective: ${errorMessage}` }], isError: true }; } }