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
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | Project ID to get sections for (optional - if not provided, gets sections for all projects) |
Implementation Reference
- src/handlers/project-handlers.ts:29-51 (handler)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"; }
- src/tools/project-tools.ts:14-28 (schema)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;
- src/tools/index.ts:62-69 (registration)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, ];