Skip to main content
Glama
kydycode

Enhanced Todoist MCP Server Extended

todoist_get_projects

Retrieve all active projects from Todoist with pagination support, allowing users to manage and organize tasks efficiently using a specified limit and cursor for seamless navigation.

Instructions

Get all active projects with pagination support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoPagination cursor for next page (optional)
limitNoMaximum number of projects to return (default: 50, max: 200) (optional)

Implementation Reference

  • The main handler logic for the todoist_get_projects tool. Validates arguments using isProjectArgs, calls todoistClient.getProjects with pagination params, formats the projects list using formatProject, and returns formatted text output with next cursor if available.
    if (name === "todoist_get_projects") { if (!isProjectArgs(args)) { throw new Error("Invalid arguments for todoist_get_projects"); } const params: any = {}; if (args.cursor) params.cursor = args.cursor; if (args.limit) params.limit = args.limit; const projectsResponse = await todoistClient.getProjects(params); const projectList = projectsResponse.results?.map(formatProject).join('\n\n') || 'No projects found'; const nextCursor = projectsResponse.nextCursor ? `\n\nNext cursor: ${projectsResponse.nextCursor}` : ''; return { content: [{ type: "text", text: `Projects:\n${projectList}${nextCursor}` }], isError: false, }; }
  • Tool schema definition including name, description, and input schema for pagination (cursor and limit).
    const GET_PROJECTS_TOOL: Tool = { name: "todoist_get_projects", description: "Get all active projects with pagination support", inputSchema: { type: "object", properties: { cursor: { type: "string", description: "Pagination cursor for next page (optional)" }, limit: { type: "number", description: "Maximum number of projects to return (default: 50, max: 200) (optional)", default: 50 } } } };
  • src/index.ts:1083-1121 (registration)
    Registration of the todoist_get_projects tool (as GET_PROJECTS_TOOL) in the ListToolsRequestHandler's tools array, making it discoverable by MCP clients.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ // Task tools CREATE_TASK_TOOL, QUICK_ADD_TASK_TOOL, GET_TASKS_TOOL, GET_TASK_TOOL, UPDATE_TASK_TOOL, DELETE_TASK_TOOL, COMPLETE_TASK_TOOL, REOPEN_TASK_TOOL, SEARCH_TASKS_TOOL, MOVE_TASK_TOOL, BULK_MOVE_TASKS_TOOL, // Project tools GET_PROJECTS_TOOL, GET_PROJECT_TOOL, CREATE_PROJECT_TOOL, UPDATE_PROJECT_TOOL, DELETE_PROJECT_TOOL, // Section tools GET_SECTIONS_TOOL, CREATE_SECTION_TOOL, UPDATE_SECTION_TOOL, DELETE_SECTION_TOOL, // Label tools CREATE_LABEL_TOOL, GET_LABEL_TOOL, GET_LABELS_TOOL, UPDATE_LABEL_TOOL, DELETE_LABEL_TOOL, // Comment tools CREATE_COMMENT_TOOL, GET_COMMENT_TOOL, GET_COMMENTS_TOOL, UPDATE_COMMENT_TOOL, DELETE_COMMENT_TOOL, ], }));
  • Helper function to format project details into a readable string used in the handler output.
    function formatProject(project: any): string { return `- ${project.name}${project.color ? `\n Color: ${project.color}` : ''}${project.isFavorite ? `\n Favorite: Yes` : ''}${project.viewStyle ? `\n View: ${project.viewStyle}` : ''}${project.parentId ? `\n Parent: ${project.parentId}` : ''}${project.id ? ` (ID: ${project.id})` : ''}`; }
  • Type guard helper function to validate arguments for the todoist_get_projects tool.
    } { // Allows empty object or object with optional cursor/limit return typeof args === "object" && args !== null; } function isProjectIdArgs(args: unknown): args is { projectId: string;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kydycode/todoist-mcp-server-ext'

If you have feedback or need assistance with the MCP directory API, please join our Discord server