list_projects
Retrieve detailed information about all Todoist projects, including IDs, names, URLs, and favorite or inbox status, structured in JSON format for easy integration and analysis.
Instructions
List all projects in Todoist. Returns structured JSON data with project details including id, name, url, is_favorite, and is_inbox status.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/services/projects/projects.ts:27-46 (handler)The core handler function that lists all Todoist projects, applying caching logic before fetching from API.export async function listProjects(): Promise< ProjectsResponse & { cached_at?: string } > { try { ensureCacheDirectory(); const cachedData = tryReadFromCache(); if (cachedData) { return cachedData; } const projectsData = await fetchProjectsFromAPI(); const result = createCachedResult(projectsData); writeToCache(result); return result; } catch (error) { throw new Error(`Failed to list projects: ${getErrorMessage(error)}`); } }
- Type definition for the response structure returned by listProjects.interface ProjectsResponse { projects: TodoistProject[]; total_count: number; }
- Helper function to fetch projects directly from the Todoist API endpoint.async function fetchProjectsFromAPI(): Promise<ProjectsResponse> { const todoistClient = getTodoistClient(); const apiResponse = await todoistClient.get<TodoistProject[]>('/projects'); return { projects: apiResponse.data, total_count: apiResponse.data.length, }; }
- Usage of listProjects in getBrianOnlyProjects filter function.const allProjects = await listProjects(); const filteredProjects = allProjects.projects.filter(isBrianOnlyProject); return { projects: filteredProjects, total_count: filteredProjects.length, };
- src/tools/index.ts:24-30 (registration)Export/registration of project-related tools in tools index, though list_projects itself is a supporting service.export { getInboxProjectsTool, getBeckySharedProjectsTool, getBrianSharedProjectsTool, getBrianOnlyProjectsTool, listGtdProjectsTool, createProjectLabelTool,