complete_task
Mark a task as completed in OmniFocus by specifying its unique task ID, enabling efficient task management and progress tracking within the MCP OmniFocus automation framework.
Instructions
Complete a task in OmniFocus.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | The ID of the task to complete |
Implementation Reference
- src/mcp_omnifocus/server.py:102-105 (handler)MCP tool handler for 'complete_task', decorated with @mcp.tool for registration, defines input schema via Annotated, and delegates to omnifocus helper.@mcp.tool def complete_task(task_id: Annotated[str, Field(description="The ID of the task to complete")]) -> dict[str, str]: """Complete a task in OmniFocus.""" return omnifocus.complete_task(task_id)
- Core implementation of complete_task using JavaScript evaluation to call task.markComplete() in OmniFocus.def complete_task(task_id: str) -> dict[str, str]: """Complete a task in OmniFocus. Args: task_id: The ID of the task to complete. Returns: A dictionary containing the completed task's details. """ script = Template( dedent(""" ${__common_functions__} (() => { let task = Task.byIdentifier("${task_id}"); if (!task) { throw "Could not find task: " + task_id.toString(); } task.markComplete(); return formatTask(task); })(); """) ) return evaluate_javascript(script.substitute(__common_functions__=__common_functions__, task_id=task_id))