todoist_create_section
Create a new section within a Todoist project to organize tasks by category, phase, or priority. Specify the section name and project ID to structure your workflow.
Instructions
Create a new section in a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the section | |
| projectId | Yes | The project ID where the section will be created | |
| order | No | Order of the section (optional) |
Implementation Reference
- src/index.ts:1481-1500 (handler)Handler logic for executing the todoist_create_section tool: validates args, calls todoistClient.addSection, and returns formatted response.if (name === "todoist_create_section") { if (!isCreateSectionArgs(args)) { throw new Error("Invalid arguments for todoist_create_section"); } const sectionData: any = { name: args.name, projectId: args.projectId }; if (args.order !== undefined) sectionData.order = args.order; const section = await todoistClient.addSection(sectionData); return { content: [{ type: "text", text: `Section created successfully:\nID: ${section.id}\nName: ${section.name}\nProject: ${section.projectId}` }], isError: false, }; }
- src/index.ts:500-521 (schema)Tool schema definition including name, description, and inputSchema for todoist_create_section.const CREATE_SECTION_TOOL: Tool = { name: "todoist_create_section", description: "Create a new section in a project", inputSchema: { type: "object", properties: { name: { type: "string", description: "The name of the section" }, projectId: { type: "string", description: "The project ID where the section will be created" }, order: { type: "number", description: "Order of the section (optional)" } }, required: ["name", "projectId"] } };
- src/index.ts:1083-1121 (registration)Registration of the todoist_create_section tool (as CREATE_SECTION_TOOL) in the list of tools returned by ListToolsRequestSchema handler.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, ], }));
- src/index.ts:873-886 (helper)Type guard helper function used to validate arguments for todoist_create_section tool.function isCreateSectionArgs(args: unknown): args is { name: string; projectId: string; order?: number; } { return ( typeof args === "object" && args !== null && "name" in args && "projectId" in args && typeof (args as { name: string; projectId: string }).name === "string" && typeof (args as { name: string; projectId: string }).projectId === "string" ); }