get_projects
Retrieve all project folders from Todoist to organize and manage tasks effectively.
Instructions
Get all todo projects. These are like folders for tasks in Todoist
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- todoist_server.py:39-46 (handler)The handler function for the 'get_projects' MCP tool. Decorated with @mcp.tool() for registration. Fetches projects from the Todoist API, maps them to Project dataclasses, and returns the list. Handles exceptions by returning an error message.@mcp.tool() def get_projects() -> list[Project]: """Get all todo projects. These are like folders for tasks in Todoist""" try: projects: TodoistProjectResponse = todoist_api.get_projects() return [Project(p.id, p.name) for p in projects] except Exception as e: return f"Error: Couldn't fetch projects {str(e)}"
- todoist_server.py:18-21 (schema)Dataclass defining the Project schema used as the return type for get_projects tool.@dataclass class Project: id: str name: str
- todoist_server.py:49-56 (helper)Helper function that uses get_projects to find a project ID by name.def get_project_id_by_name(project_name: str) -> str: """Search for a project by name and return its ID""" projects = get_projects() for project in projects: if project.name.lower() == project_name.lower(): return project.id return None