Add completionDate + completedAfter filter to list_tasks; fix containerId on completed tasks - #2
Conversation
…erId null on completed tasks list_tasks didn't expose a completed task's completionDate (only get_task did), and there was no way to filter by completion date server-side. Added completionDate to list_tasks' output and a completedAfter (ISO datetime) filter, following the existing dueBeforeDate pattern. Separately, list_tasks and get_task both resolved a task's containerId/ containerType via assignedContainer, which comes back null for completed tasks. Other write-path snippets (move_task, complete_task, create_task, edit_task, drop_task) already avoid this via parentTask/containingProject instead -- move_task.js even has a comment noting assignedContainer "doesn't update after moveTasks". Applied the same fix to list_tasks and get_task so completed tasks resolve their container correctly too. package-lock.json also resyncs to package.json's current name/version (0.1.0 -> @scardis/omnifocus-mcp@0.1.2), which had drifted.
|
Closing in favour of #6, which independently contains all three changes here: the To be clear about what is being closed, because this PR is sound: I test-merged it against Two notes worth carrying to #6:
One thing I would have asked for had this been merged on its own: it ships two behaviour changes with no new tests. The test count is unchanged at 150 — the only test edit is adding Thanks for both this and the diagnosis in #1 — that one is fixed and released in |
Summary
list_tasksdidn't expose a completed task'scompletionDate— onlyget_taskdid, one task at a time, so finding "everything completed since X" required fetching every completed task individually. AddedcompletionDatetolist_tasks' output (nullfor incomplete tasks, consistent withdueDate/deferDate/plannedDate) and a new optionalcompletedAfter(ISO datetime) filter, following the existingdueBeforeDatepattern.list_tasksandget_taskboth resolved a task'scontainerId/containerTypeviaassignedContainer, which comes backnullfor completed tasks. The write-path snippets (move_task,complete_task,create_task,edit_task,drop_task) already avoid this —move_task.jshas a comment notingassignedContainer"reflects original placement and doesn't update after moveTasks." Applied the sameparentTask/containingProjectfallback tolist_tasksandget_taskso completed tasks resolve their container correctly too.package-lock.jsonalso resyncs topackage.json's current name/version (it had drifted toomnifocus-mcp@0.1.0vs.@scardis/omnifocus-mcp@0.1.2).Related to the
dist/snippetspackaging issue filed at #1 — unrelated bug, just flagging the connection since both surfaced from the same real-world usage.Test plan
npm test— all 144 unit tests pass (updated one existingTaskSummaryfixture inschemas.test.tsto include the now-requiredcompletionDatefield).mcpblocally; verified against a real OmniFocus database:list_taskswithfilter.status: ["complete"]returns realcompletionDatetimestampsfilter.completedAftercorrectly narrows results (confirmed two known-earlier completions were excluded by a later cutoff)containerId/containerTyperesolve correctly on completed tasks via bothlist_tasksandget_task(previously both came backnull)