todoist_delete_task
Remove a task from Todoist by specifying its task ID, enabling efficient task management and cleanup within the Todoist MCP Server environment.
Instructions
Delete a task from Todoist
Args: task_id: ID of the task to delete
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes |
Implementation Reference
- src/tasks.py:569-593 (handler)The handler function that implements the logic to delete a Todoist task by ID. It verifies the task exists, deletes it using the Todoist API client, and returns a success message with the task content.def todoist_delete_task(ctx: Context, task_id: str) -> str: """Delete a task from Todoist Args: task_id: ID of the task to delete """ todoist_client = ctx.request_context.lifespan_context.todoist_client try: logger.info(f"Deleting task with ID: {task_id}") try: task = todoist_client.get_task(task_id=task_id) task_content = task.content except Exception as error: logger.warning(f"Error getting task with ID: {task_id}: {error}") return f"Could not verify task with ID: {task_id}. Deletion aborted." is_success = todoist_client.delete_task(task_id=task_id) logger.info(f"Task deleted successfully: {task_id}") return f"Successfully deleted task: {task_content} (ID: {task_id})" except Exception as error: logger.error(f"Error deleting task: {error}") return f"Error deleting task: {str(error)}"
- src/main.py:92-92 (registration)The registration of the todoist_delete_task tool using the MCP decorator mcp.tool().mcp.tool()(todoist_delete_task)