create_task
Automate task creation in OmniFocus by defining a name and optional note. Streamline task management using MCP OmniFocus server for integration with VS Code, command line, or MCP-compatible clients.
Instructions
Create a new task in OmniFocus with a name and an optional note.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the task to create | |
| note | No | The note for the task, None if no note |
Implementation Reference
- src/mcp_omnifocus/server.py:120-127 (handler)FastMCP tool handler, registration, and schema definition for the 'create_task' tool. Delegates implementation to omnifocus utility.@mcp.tool def create_task( name: Annotated[str, Field(description="The name of the task to create")], note: Annotated[str | None, Field(description="The note for the task, None if no note")] = None, ) -> dict[str, str]: """Create a new task in OmniFocus with a name and an optional note.""" return omnifocus.create_task(task_name=name, task_note=note)
- Helper utility that executes JavaScript in OmniFocus to create a new task with name and optional note, then formats and returns task details.def create_task(task_name: str, task_note: str | None = None) -> dict[str, str]: """Create a new task in OmniFocus. Args: task_name: The name of the task to create. task_note: An optional note for the task. Returns: A dictionary containing the created task's details. """ script = Template( dedent(""" ${__common_functions__} (() => { let task = new Task("${task_name}"); let task_note = ${task_note}; if (task_note) { task.note = task_note; } return formatTask(task); })(); """) ) return evaluate_javascript( script.substitute( __common_functions__=__common_functions__, task_name=task_name, task_note=f'"{task_note}"' if task_note else "null", ) )