@iflow-mcp/omnifocus-mcp 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/QUERY_TOOL_EXAMPLES.md +298 -0
  2. package/QUERY_TOOL_REFERENCE.md +228 -0
  3. package/README.md +250 -0
  4. package/assets/omnifocus-mcp-logo.png +0 -0
  5. package/cli.cjs +9 -0
  6. package/dist/omnifocustypes.js +48 -0
  7. package/dist/server.js +44 -0
  8. package/dist/tools/definitions/addOmniFocusTask.js +76 -0
  9. package/dist/tools/definitions/addProject.js +61 -0
  10. package/dist/tools/definitions/batchAddItems.js +89 -0
  11. package/dist/tools/definitions/batchRemoveItems.js +74 -0
  12. package/dist/tools/definitions/dumpDatabase.js +259 -0
  13. package/dist/tools/definitions/editItem.js +88 -0
  14. package/dist/tools/definitions/getPerspectiveView.js +107 -0
  15. package/dist/tools/definitions/listPerspectives.js +65 -0
  16. package/dist/tools/definitions/queryOmnifocus.js +190 -0
  17. package/dist/tools/definitions/removeItem.js +80 -0
  18. package/dist/tools/dumpDatabase.js +121 -0
  19. package/dist/tools/dumpDatabaseOptimized.js +192 -0
  20. package/dist/tools/primitives/addOmniFocusTask.js +227 -0
  21. package/dist/tools/primitives/addProject.js +132 -0
  22. package/dist/tools/primitives/batchAddItems.js +166 -0
  23. package/dist/tools/primitives/batchRemoveItems.js +44 -0
  24. package/dist/tools/primitives/editItem.js +443 -0
  25. package/dist/tools/primitives/getPerspectiveView.js +50 -0
  26. package/dist/tools/primitives/listPerspectives.js +34 -0
  27. package/dist/tools/primitives/queryOmnifocus.js +365 -0
  28. package/dist/tools/primitives/queryOmnifocusDebug.js +135 -0
  29. package/dist/tools/primitives/removeItem.js +177 -0
  30. package/dist/types.js +1 -0
  31. package/dist/utils/cacheManager.js +187 -0
  32. package/dist/utils/dateFormatting.js +58 -0
  33. package/dist/utils/omnifocusScripts/getPerspectiveView.js +169 -0
  34. package/dist/utils/omnifocusScripts/listPerspectives.js +59 -0
  35. package/dist/utils/omnifocusScripts/omnifocusDump.js +223 -0
  36. package/dist/utils/scriptExecution.js +113 -0
  37. package/package.json +37 -0
  38. package/src/omnifocustypes.ts +89 -0
  39. package/src/server.ts +109 -0
  40. package/src/tools/definitions/addOmniFocusTask.ts +80 -0
  41. package/src/tools/definitions/addProject.ts +67 -0
  42. package/src/tools/definitions/batchAddItems.ts +98 -0
  43. package/src/tools/definitions/batchRemoveItems.ts +80 -0
  44. package/src/tools/definitions/dumpDatabase.ts +311 -0
  45. package/src/tools/definitions/editItem.ts +96 -0
  46. package/src/tools/definitions/getPerspectiveView.ts +125 -0
  47. package/src/tools/definitions/listPerspectives.ts +72 -0
  48. package/src/tools/definitions/queryOmnifocus.ts +212 -0
  49. package/src/tools/definitions/removeItem.ts +86 -0
  50. package/src/tools/dumpDatabase.ts +196 -0
  51. package/src/tools/dumpDatabaseOptimized.ts +231 -0
  52. package/src/tools/primitives/addOmniFocusTask.ts +252 -0
  53. package/src/tools/primitives/addProject.ts +156 -0
  54. package/src/tools/primitives/batchAddItems.ts +207 -0
  55. package/src/tools/primitives/batchRemoveItems.ts +64 -0
  56. package/src/tools/primitives/editItem.ts +507 -0
  57. package/src/tools/primitives/getPerspectiveView.ts +71 -0
  58. package/src/tools/primitives/listPerspectives.ts +53 -0
  59. package/src/tools/primitives/queryOmnifocus.ts +394 -0
  60. package/src/tools/primitives/queryOmnifocusDebug.ts +139 -0
  61. package/src/tools/primitives/removeItem.ts +195 -0
  62. package/src/types.ts +107 -0
  63. package/src/utils/cacheManager.ts +234 -0
  64. package/src/utils/dateFormatting.ts +81 -0
  65. package/src/utils/omnifocusScripts/getPerspectiveView.js +169 -0
  66. package/src/utils/omnifocusScripts/listPerspectives.js +59 -0
  67. package/src/utils/omnifocusScripts/omnifocusDump.js +223 -0
  68. package/src/utils/scriptExecution.ts +128 -0
  69. package/tsconfig.json +15 -0
@@ -0,0 +1,298 @@
1
+ # Query OmniFocus Tool - Usage Examples
2
+
3
+ The `query_omnifocus` tool provides efficient, targeted queries against your OmniFocus database without loading everything into memory. This is much more context-efficient than using `dump_database`.
4
+
5
+ ## Basic Usage
6
+
7
+ ### Get all flagged tasks
8
+ ```json
9
+ {
10
+ "entity": "tasks",
11
+ "filters": {
12
+ "flagged": true
13
+ }
14
+ }
15
+ ```
16
+
17
+ ### Get tasks due in the next 7 days
18
+ ```json
19
+ {
20
+ "entity": "tasks",
21
+ "filters": {
22
+ "dueWithin": 7
23
+ }
24
+ }
25
+ ```
26
+
27
+ ### Get next actions only
28
+ ```json
29
+ {
30
+ "entity": "tasks",
31
+ "filters": {
32
+ "status": ["Next"]
33
+ }
34
+ }
35
+ ```
36
+
37
+ ### Get inbox tasks
38
+ ```json
39
+ {
40
+ "entity": "tasks",
41
+ "filters": {
42
+ "projectName": "inbox"
43
+ }
44
+ }
45
+ ```
46
+
47
+ ## Advanced Filtering
48
+
49
+ ### Get flagged tasks due this week with specific tags
50
+ ```json
51
+ {
52
+ "entity": "tasks",
53
+ "filters": {
54
+ "flagged": true,
55
+ "dueWithin": 7,
56
+ "tags": ["important", "work"]
57
+ },
58
+ "sortBy": "dueDate",
59
+ "sortOrder": "asc"
60
+ }
61
+ ```
62
+
63
+ ### Get overdue and due soon tasks
64
+ ```json
65
+ {
66
+ "entity": "tasks",
67
+ "filters": {
68
+ "status": ["Overdue", "DueSoon"]
69
+ },
70
+ "sortBy": "dueDate"
71
+ }
72
+ ```
73
+
74
+ ### Get tasks in a specific project
75
+ ```json
76
+ {
77
+ "entity": "tasks",
78
+ "filters": {
79
+ "projectName": "Weekly Review"
80
+ }
81
+ }
82
+ ```
83
+
84
+ ### Get tasks that will become available in the next 3 days
85
+ ```json
86
+ {
87
+ "entity": "tasks",
88
+ "filters": {
89
+ "deferredUntil": 3
90
+ }
91
+ }
92
+ ```
93
+
94
+ ## Performance Optimization
95
+
96
+ ### Get only specific fields (reduces response size)
97
+ ```json
98
+ {
99
+ "entity": "tasks",
100
+ "filters": {
101
+ "flagged": true
102
+ },
103
+ "fields": ["name", "dueDate", "projectName"],
104
+ "limit": 10
105
+ }
106
+ ```
107
+
108
+ ### Get just a count of matching items
109
+ ```json
110
+ {
111
+ "entity": "tasks",
112
+ "filters": {
113
+ "status": ["Next", "Available"]
114
+ },
115
+ "summary": true
116
+ }
117
+ ```
118
+
119
+ ### Limit results for large queries
120
+ ```json
121
+ {
122
+ "entity": "tasks",
123
+ "filters": {
124
+ "tags": ["someday"]
125
+ },
126
+ "limit": 20,
127
+ "sortBy": "modificationDate",
128
+ "sortOrder": "desc"
129
+ }
130
+ ```
131
+
132
+ ## Project Queries
133
+
134
+ ### Get all active projects
135
+ ```json
136
+ {
137
+ "entity": "projects",
138
+ "filters": {
139
+ "status": ["Active"]
140
+ }
141
+ }
142
+ ```
143
+
144
+ ### Get projects on hold
145
+ ```json
146
+ {
147
+ "entity": "projects",
148
+ "filters": {
149
+ "status": ["OnHold"]
150
+ }
151
+ }
152
+ ```
153
+
154
+ ### Include completed projects
155
+ ```json
156
+ {
157
+ "entity": "projects",
158
+ "includeCompleted": true
159
+ }
160
+ ```
161
+
162
+ ## Folder Queries
163
+
164
+ ### Get all folders
165
+ ```json
166
+ {
167
+ "entity": "folders"
168
+ }
169
+ ```
170
+
171
+ ### Get folder structure with project counts
172
+ ```json
173
+ {
174
+ "entity": "folders",
175
+ "fields": ["name", "projectCount", "path"]
176
+ }
177
+ ```
178
+
179
+ ## Complex Queries
180
+
181
+ ### Daily planning query - get today's agenda
182
+ ```json
183
+ {
184
+ "entity": "tasks",
185
+ "filters": {
186
+ "status": ["Next", "Available", "DueSoon", "Overdue"],
187
+ "dueWithin": 1
188
+ },
189
+ "sortBy": "dueDate",
190
+ "limit": 20
191
+ }
192
+ ```
193
+
194
+ ### Weekly review - get stale tasks
195
+ ```json
196
+ {
197
+ "entity": "tasks",
198
+ "filters": {
199
+ "status": ["Available", "Blocked"],
200
+ "hasNote": false
201
+ },
202
+ "sortBy": "modificationDate",
203
+ "sortOrder": "asc",
204
+ "limit": 30
205
+ }
206
+ ```
207
+
208
+ ### Get high-priority items (flagged or due soon)
209
+ ```json
210
+ {
211
+ "entity": "tasks",
212
+ "filters": {
213
+ "flagged": true
214
+ },
215
+ "limit": 10
216
+ }
217
+ ```
218
+ Then separately:
219
+ ```json
220
+ {
221
+ "entity": "tasks",
222
+ "filters": {
223
+ "dueWithin": 3
224
+ },
225
+ "limit": 10
226
+ }
227
+ ```
228
+
229
+ ## Tips for Efficient Querying
230
+
231
+ 1. **Use `summary: true`** when you only need counts, not full details
232
+ 2. **Specify `fields`** to reduce response size when you don't need all data
233
+ 3. **Use `limit`** to prevent overwhelming responses from large result sets
234
+ 4. **Combine filters** to get exactly what you need in one query
235
+ 5. **Sort strategically** - sort by the field most relevant to your use case
236
+
237
+ ## Performance Comparison
238
+
239
+ | Operation | dump_database | query_omnifocus |
240
+ |-----------|--------------|-----------------|
241
+ | Get all flagged tasks | ~300-500 lines (full dump) | ~20-50 lines (just flagged) |
242
+ | Count overdue items | Full dump + client processing | Single line with `summary: true` |
243
+ | Get tasks for one project | Full dump + client filtering | Just those tasks |
244
+ | Check inbox | Full dump | Just inbox items |
245
+
246
+ ## Common Use Cases
247
+
248
+ ### Morning Planning
249
+ Get your most important tasks for the day:
250
+ ```json
251
+ {
252
+ "entity": "tasks",
253
+ "filters": {
254
+ "status": ["Next", "DueSoon", "Overdue"],
255
+ "flagged": true
256
+ },
257
+ "sortBy": "dueDate",
258
+ "limit": 15
259
+ }
260
+ ```
261
+
262
+ ### Project Status Check
263
+ Quick count of tasks in a project:
264
+ ```json
265
+ {
266
+ "entity": "tasks",
267
+ "filters": {
268
+ "projectName": "Q4 Goals"
269
+ },
270
+ "summary": true
271
+ }
272
+ ```
273
+
274
+ ### Inbox Processing
275
+ See what's in your inbox:
276
+ ```json
277
+ {
278
+ "entity": "tasks",
279
+ "filters": {
280
+ "projectName": "inbox"
281
+ },
282
+ "fields": ["name", "flagged", "dueDate", "tagNames"]
283
+ }
284
+ ```
285
+
286
+ ### Context-Based Views
287
+ Get all tasks for a specific context/tag:
288
+ ```json
289
+ {
290
+ "entity": "tasks",
291
+ "filters": {
292
+ "tags": ["home"],
293
+ "status": ["Available", "Next"]
294
+ },
295
+ "sortBy": "estimatedMinutes",
296
+ "sortOrder": "asc"
297
+ }
298
+ ```
@@ -0,0 +1,228 @@
1
+ # Query OmniFocus Tool - Complete Reference Guide
2
+
3
+ ## Complete Field Reference
4
+
5
+ ### Task Fields
6
+ All available fields you can request for tasks:
7
+
8
+ | Field | Type | Description | Example Value |
9
+ |-------|------|-------------|---------------|
10
+ | `id` | string | Unique identifier | "abc123def456" |
11
+ | `name` | string | Task name/title | "Review quarterly report" |
12
+ | `note` | string | Task notes/description | "Check financial section" |
13
+ | `flagged` | boolean | Whether task is flagged | true |
14
+ | `taskStatus` | string | Current status | "Next", "Available", "Blocked" |
15
+ | `dueDate` | string | Due date in ISO format | "2024-12-25T00:00:00Z" |
16
+ | `deferDate` | string | Defer/start date in ISO format | "2024-12-20T00:00:00Z" |
17
+ | `completionDate` | string | When task was completed | "2024-12-24T14:30:00Z" |
18
+ | `estimatedMinutes` | number | Time estimate in minutes | 30 |
19
+ | `tagNames` | string[] | Array of tag names | ["work", "urgent"] |
20
+ | `tags` | string[] | Array of tag IDs | ["tag1id", "tag2id"] |
21
+ | `projectName` | string | Name of containing project | "Q4 Goals" |
22
+ | `projectId` | string | ID of containing project | "proj123" |
23
+ | `parentId` | string | ID of parent task (for subtasks) | "task456" |
24
+ | `childIds` | string[] | IDs of child tasks | ["task789", "task012"] |
25
+ | `hasChildren` | boolean | Whether task has subtasks | true |
26
+ | `sequential` | boolean | Whether subtasks are sequential | false |
27
+ | `completedByChildren` | boolean | Auto-complete when children done | true |
28
+ | `inInbox` | boolean | Whether task is in inbox | false |
29
+ | `modificationDate` | string | Last modified date | "2024-12-20T10:00:00Z" |
30
+ | `creationDate` | string | When task was created | "2024-12-01T09:00:00Z" |
31
+
32
+ ### Project Fields
33
+ All available fields you can request for projects:
34
+
35
+ | Field | Type | Description | Example Value |
36
+ |-------|------|-------------|---------------|
37
+ | `id` | string | Unique identifier | "proj123" |
38
+ | `name` | string | Project name | "Website Redesign" |
39
+ | `status` | string | Project status | "Active", "OnHold" |
40
+ | `note` | string | Project notes | "Phase 1 focus on UX" |
41
+ | `folderName` | string | Containing folder name | "Work" |
42
+ | `folderID` | string | Containing folder ID | "fold456" |
43
+ |enser | boolean | Tasks must be done in order | true |
44
+ | `dueDate` | string | Project due date | "2024-12-31T00:00:00Z" |
45
+ | `deferDate` | string | Project defer date | "2024-12-01T00:00:00Z" |
46
+ | `effectiveDueDate` | string | Inherited or set due date | "2024-12-31T00:00:00Z" |
47
+ | `effectiveDeferDate` | string | Inherited or set defer date | "2024-12-01T00:00:00Z" |
48
+ | `completedByChildren` | boolean | Auto-complete when tasks done | false |
49
+ | `containsSingletonActions` | boolean | Has single action list | true |
50
+ | `taskCount` | number | Number of tasks in project | 15 |
51
+ | `tasks` | string[] | Array of task IDs | ["task1", "task2"] |
52
+ | `modificationDate` | string | Last modified date | "2024-12-20T10:00:00Z" |
53
+ | `creationDate` | string | When project was created | "2024-11-01T09:00:00Z" |
54
+
55
+ ### Folder Fields
56
+ All available fields you can request for folders:
57
+
58
+ | Field | Type | Description | Example Value |
59
+ |-------|------|-------------|---------------|
60
+ | `id` | string | Unique identifier | "fold123" |
61
+ | `name` | string | Folder name | "Personal" |
62
+ | `path` | string | Full folder path | "Life/Personal" |
63
+ | `parentFolderID` | string | Parent folder ID | "fold000" |
64
+ | `status` | string | Folder status | "Active", "Dropped" |
65
+ | `projectCount` | number | Number of projects | 8 |
66
+ | `projects` | string[] | Array of project IDs | ["proj1", "proj2"] |
67
+ | `subfolders` | string[] | Array of subfolder IDs | ["fold456", "fold789"] |
68
+
69
+ ## Filter Behavior Details
70
+
71
+ ### `projectName` Filter
72
+ - **Behavior**: Case-insensitive partial/substring matching
73
+ - **Special value**: Use `"inbox"` to get inbox tasks
74
+ ```json
75
+ {
76
+ "projectName": "review" // Matches "Weekly Review", "Review Documents", etc.
77
+ }
78
+ ```
79
+
80
+ ### `deferredUntil` Filter
81
+ - **Behavior**: Returns tasks that are currently deferred but will become available within N days
82
+ - **Example**: `"deferredUntil": 7` returns tasks deferred now but available within the next 7 days
83
+ ```json
84
+ {
85
+ "deferredUntil": 3 // Tasks becoming available in next 3 days
86
+ }
87
+ ```
88
+
89
+ ### `dueWithin` Filter
90
+ - **Behavior**: Returns tasks due from now until N days in the future (inclusive)
91
+ - **Example**: `"dueWithin": 7` returns tasks due today through 7 days from now
92
+ ```json
93
+ {
94
+ "dueWithin": 1 // Tasks due today or tomorrow
95
+ }
96
+ ```
97
+
98
+ ### `tags` Filter
99
+ - **Behavior**: Exact match, case-sensitive
100
+ - **Logic**: OR - task must have at least ONE of the specified tags
101
+ ```json
102
+ {
103
+ "tags": ["Work", "work"] // Different - case matters!
104
+ }
105
+ ```
106
+
107
+ ### `status` Filter
108
+ - **Behavior**: Exact match against OmniFocus status values
109
+ - **Logic**: OR - item must have ONE of the specified statuses
110
+ ```json
111
+ {
112
+ "status": ["Next", "Available"] // Tasks that are either next or available
113
+ }
114
+ ```
115
+
116
+ ### `hasNote` Filter
117
+ - **Behavior**: Checks if note field exists and is non-empty (after trimming whitespace)
118
+ ```json
119
+ {
120
+ "hasNote": true // Tasks with non-empty notes
121
+ "hasNote": false // Tasks with no notes or only whitespace
122
+ }
123
+ ```
124
+
125
+ ## Complete Status Values
126
+
127
+ ### Task Status Values
128
+ | Status | Description | When it appears |
129
+ |--------|-------------|-----------------|
130
+ | `Next` | Next action in sequential list | First available task in sequential project/group |
131
+ | `Available` | Ready to work on | Task with no blockers, not sequential or is current in sequence |
132
+ | `Blocked` | Waiting on something | Task in sequential list waiting for previous task |
133
+ | `DueSoon` | Due within 24 hours | Task due soon (configurable in OF preferences) |
134
+ | `Overdue` | Past due date | Task whose due date has passed |
135
+ | `Completed` | Marked complete | Task that has been completed |
136
+ | `Dropped` | Cancelled/dropped | Task that was dropped (not completed) |
137
+
138
+ ### Project Status Values
139
+ | Status | Description |
140
+ |--------|-------------|
141
+ | `Active` | Normal active project |
142
+ | `OnHold` | Paused/on hold project |
143
+ | `Done` | Completed project |
144
+ | `Dropped` | Cancelled/dropped project |
145
+
146
+ ### Folder Status Values
147
+ | Status | Description |
148
+ |--------|-------------|
149
+ | `Active` | Normal active folder |
150
+ | `Dropped` | Dropped/hidden folder |
151
+
152
+ ## Filter Combination Logic
153
+
154
+ All filters use **AND** logic - an item must match ALL specified filters:
155
+
156
+ ```json
157
+ {
158
+ "entity": "tasks",
159
+ "filters": {
160
+ "flagged": true, // AND
161
+ "status": ["Next"], // AND
162
+ "tags": ["urgent"] // AND
163
+ }
164
+ }
165
+ // Returns: Flagged tasks that are Next actions with "urgent" tag
166
+ ```
167
+
168
+ Within array filters (`status`, `tags`), **OR** logic applies:
169
+ ```json
170
+ {
171
+ "status": ["Next", "Available"], // Next OR Available
172
+ "tags": ["home", "errands"] // has "home" OR "errands"
173
+ }
174
+ ```
175
+
176
+ ## Sort Fields
177
+
178
+ Common fields you can sort by:
179
+ - `name` - Alphabetical by item name
180
+ - `dueDate` - By due date (null dates sort last)
181
+ - `deferDate` - By defer date (null dates sort last)
182
+ - `modificationDate` - By last modified time
183
+ - `creationDate` - By creation time
184
+ - `estimatedMinutes` - By time estimate (shortest first with 'asc')
185
+ - `taskStatus` - Groups by status
186
+
187
+ ## Performance Tips
188
+
189
+ ### Request only needed fields
190
+ ```json
191
+ {
192
+ "entity": "tasks",
193
+ "fields": ["name", "dueDate", "flagged"], // Only get 3 fields instead of all
194
+ "limit": 50
195
+ }
196
+ ```
197
+
198
+ ### Use summary for counts
199
+ ```json
200
+ {
201
+ "entity": "tasks",
202
+ "filters": {"projectName": "Big Project"},
203
+ "summary": true // Returns just count, not full task details
204
+ }
205
+ ```
206
+
207
+ ### Combine related queries
208
+ Instead of multiple queries, get everything at once:
209
+ ```json
210
+ {
211
+ "entity": "tasks",
212
+ "filters": {
213
+ "status": ["Next", "Available", "DueSoon", "Overdue"],
214
+ "flagged": true
215
+ },
216
+ "fields": ["name", "dueDate", "projectName", "taskStatus"],
217
+ "sortBy": "dueDate"
218
+ }
219
+ ```
220
+
221
+ ## Common Gotchas
222
+
223
+ 1. **Tag names must be exact** - "Work" ≠ "work"
224
+ 2. **Project names are partial matches** - "Review" matches "Weekly Review"
225
+ 3. **Null dates sort last** - Tasks without due dates appear at the end when sorting by dueDate
226
+ 4. **Inbox is a special project name** - Use `"projectName": "inbox"` for inbox tasks
227
+ 5. **Status values are case-sensitive** - Use exact values like "Next", not "next"
228
+ 6. **Fields that don't exist return undefined** - Requesting invalid fields won't error but returns undefined