todoist_get_projects
Retrieve all projects from a Todoist account via the Todoist MCP Server, enabling users to view and manage task organization through Claude’s interface.
Instructions
Get all projects from the user's Todoist account
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"title": "todoist_get_projectsArguments",
"type": "object"
}
Implementation Reference
- src/projects.py:10-36 (handler)The handler function that implements the core logic of the todoist_get_projects tool. It retrieves all projects from the Todoist API using the provided client, handles pagination, and returns a JSON-formatted list of projects or an error message.def todoist_get_projects(ctx: Context) -> str: """Get all projects from the user's Todoist account """ todoist_client = ctx.request_context.lifespan_context.todoist_client try: logger.info("Getting all projects") # Consume iterator to flatten paginated results into single list projects_iterator = todoist_client.get_projects() all_projects = [] for project_batch in projects_iterator: all_projects.extend(project_batch) # Break early when partial batch indicates end of results if len(project_batch) < 200: break if not all_projects: logger.info("No projects found") return "No projects found in your Todoist account" logger.info(f"Retrieved {len(all_projects)} projects") return json.dumps([project.to_dict() for project in all_projects], indent=2, default=str) except Exception as error: logger.error(f"Error getting projects: {error}") return f"Error getting projects: {str(error)}"
- src/main.py:72-72 (registration)The registration of the todoist_get_projects tool using the MCP FastMCP decorator, which automatically generates the tool schema from the function signature and registers it with the server.mcp.tool()(todoist_get_projects)
- src/main.py:12-18 (registration)Import statement that brings the todoist_get_projects handler into main.py for registration.from .projects import ( todoist_get_projects, todoist_get_project, todoist_add_project, todoist_update_project, todoist_delete_project, )