todoist_get_task
Retrieve an active task from Todoist using its unique task ID, enabling users to access and manage task details directly through the Todoist MCP Server.
Instructions
Get an active task from Todoist
Args: task_id: ID of the task to retrieve
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"task_id": {
"title": "Task Id",
"type": "string"
}
},
"required": [
"task_id"
],
"title": "todoist_get_taskArguments",
"type": "object"
}
Implementation Reference
- src/tasks.py:329-350 (handler)The main handler function that retrieves a single Todoist task by its ID using the Todoist API, handles errors, and returns the task as JSON.def todoist_get_task(ctx: Context, task_id: str) -> str: """Get an active task from Todoist Args: task_id: ID of the task to retrieve """ todoist_client = ctx.request_context.lifespan_context.todoist_client try: logger.info(f"Getting task with ID: {task_id}") task = todoist_client.get_task(task_id=task_id) if not task: logger.info(f"No task found with ID: {task_id}") return f"No task found with ID: {task_id}" logger.info(f"Retrieved task: {task.id}") return json.dumps(task.to_dict(), indent=2, default=str) except Exception as error: logger.error(f"Error getting task: {error}") return f"Error getting task: {str(error)}"
- src/main.py:84-84 (registration)Registration of the todoist_get_task tool with the MCP server using the decorator.mcp.tool()(todoist_get_task)
- src/main.py:26-36 (registration)Import of the todoist_get_task function from tasks module for use in main.py registration.from .tasks import ( todoist_get_task, todoist_get_tasks, todoist_filter_tasks, todoist_add_task, todoist_update_task, todoist_complete_task, todoist_uncomplete_task, todoist_move_task, todoist_delete_task, )