get_projects
Retrieve all Todoist projects to organize and manage task folders efficiently using the Python MCP Server.
Instructions
Get all todo projects. These are like folders for tasks in Todoist
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"title": "get_projectsArguments",
"type": "object"
}
Implementation Reference
- todoist_server.py:39-47 (handler)The main handler function for the 'get_projects' tool, decorated with @mcp.tool() for registration and execution. It fetches projects from the Todoist API and returns a list of Project objects.@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-22 (schema)Dataclass defining the schema/structure of each project returned by the get_projects tool.@dataclass class Project: id: str name: str
- todoist_server.py:27-30 (schema)Internal dataclass used for typing the response from todoist_api.get_projects().class TodoistProjectResponse: id: str name: str
- todoist_server.py:49-56 (helper)Helper function that calls 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