update_task
Modify task attributes like content, priority, due dates, or labels in Todoist using the task ID to update existing tasks.
Instructions
Update an attribute of a task given its ID. Any attribute can be updated.
Args:
- task_id [str | int]: The ID of the task to update. Example '1234567890' or 1234567890
- content [str]: Task content. This value may contain markdown-formatted text and hyperlinks. Details on markdown support can be found in the Text Formatting article in the Help Center.
- description [str]: A description for the task. This value may contain markdown-formatted text and hyperlinks. Details on markdown support can be found in the Text Formatting article in the Help Center.
- labels [list[str]]: The task's labels (a list of names that may represent either personal or shared labels).
- priority [int]: Task priority from 1 (normal) to 4 (urgent).
- due_date [str]: Specific date in YYYY-MM-DD format relative to user’s timezone.
- deadline_date [str]: Specific date in YYYY-MM-DD format relative to user’s timezone.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | ||
| content | No | ||
| description | No | ||
| labels | No | ||
| priority | No | ||
| due_date | No | ||
| deadline_date | No |
Implementation Reference
- todoist_server.py:185-233 (handler)The handler function for the 'update_task' MCP tool. It is decorated with @mcp.tool() for registration and implements the logic to update a Todoist task by constructing a data dict from provided parameters and calling todoist_api.update_task.@mcp.tool() def update_task( task_id: str, content: Optional[str] = None, description: Optional[str] = None, labels: Optional[list[str]] = None, priority: Optional[int] = None, due_date: Optional[str] = None, deadline_date: Optional[str] = None, ): """ Update an attribute of a task given its ID. Any attribute can be updated. Args: - task_id [str | int]: The ID of the task to update. Example '1234567890' or 1234567890 - content [str]: Task content. This value may contain markdown-formatted text and hyperlinks. Details on markdown support can be found in the Text Formatting article in the Help Center. - description [str]: A description for the task. This value may contain markdown-formatted text and hyperlinks. Details on markdown support can be found in the Text Formatting article in the Help Center. - labels [list[str]]: The task's labels (a list of names that may represent either personal or shared labels). - priority [int]: Task priority from 1 (normal) to 4 (urgent). - due_date [str]: Specific date in YYYY-MM-DD format relative to user’s timezone. - deadline_date [str]: Specific date in YYYY-MM-DD format relative to user’s timezone. """ # Client sometimes struggle to convert int to str task_id = task_id.strip('"') try: data = {} if content: data["content"] = content if description: data["description"] = description if labels: if isinstance(labels, str): labels = [labels] data["labels"] = labels if priority: data["priority"] = priority if due_date: data["due_date"] = due_date if deadline_date: data["deadline_date"] = deadline_date is_success = todoist_api.update_task(task_id=task_id, **data) if not is_success: raise Exception return "Task updated successfully" except Exception as e: raise Exception(f"Couldn't update task {str(e)}")