Skip to main content
Glama
greirson

Todoist MCP Server

todoist_section_get

Retrieve sections within Todoist projects to organize tasks by category or workflow stage, using project IDs to filter results.

Instructions

Get a list of sections within a project from Todoist with their IDs and names

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoProject ID to get sections for (optional - if not provided, gets sections for all projects)

Implementation Reference

  • The core handler function that implements the todoist_section_get tool. It calls the Todoist API's getSections method, processes the response, and formats the list of sections for output.
    export async function handleGetSections(
      todoistClient: TodoistApi,
      args: GetSectionsArgs
    ): Promise<string> {
      // Use getSections with proper type handling
      const result = await todoistClient.getSections(
        args as Parameters<typeof todoistClient.getSections>[0]
      );
    
      // Handle the new API response format with 'results' property
      const sections = extractArrayFromResponse<TodoistSection>(result);
    
      const sectionList = sections
        .map(
          (section: TodoistSection) =>
            `- ${section.name} (ID: ${section.id}, Project ID: ${section.projectId})`
        )
        .join("\n");
    
      return sections.length > 0
        ? `Sections:\n${sectionList}`
        : "No sections found";
    }
  • Defines the tool schema for todoist_section_get, including name, description, and input schema with optional project_id parameter.
    export const GET_SECTIONS_TOOL: Tool = {
      name: "todoist_section_get",
      description:
        "Get a list of sections within a project from Todoist with their IDs and names",
      inputSchema: {
        type: "object",
        properties: {
          project_id: {
            type: "string",
            description:
              "Project ID to get sections for (optional - if not provided, gets sections for all projects)",
          },
        },
      },
    };
  • src/index.ts:191-196 (registration)
    Registers and dispatches the todoist_section_get tool in the main server request handler switch statement, performing argument validation and calling the handler.
    case "todoist_section_get":
      if (!isGetSectionsArgs(args)) {
        throw new Error("Invalid arguments for todoist_section_get");
      }
      result = await handleGetSections(apiClient, args);
      break;
  • Includes the todoist_section_get tool (via PROJECT_TOOLS) in the complete list of available tools served by the MCP server.
    export const ALL_TOOLS = [
      ...TASK_TOOLS,
      ...PROJECT_TOOLS,
      ...COMMENT_TOOLS,
      ...LABEL_TOOLS,
      ...SUBTASK_TOOLS,
      ...TEST_TOOLS,
    ];

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/greirson/mcp-todoist'

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