todoist_create_section
Use this tool to create a new section in a Todoist project by specifying the section name and project ID. Optionally, set the section order for better task organization.
Instructions
Create a new section in a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the section | |
| order | No | Order of the section (optional) | |
| projectId | Yes | The project ID where the section will be created |
Implementation Reference
- src/index.ts:1481-1500 (handler)Executes the tool: validates input with isCreateSectionArgs type guard, builds section data object, calls Todoist API's addSection method, formats and returns success response with new section details.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 with properties for name (required string), projectId (required string), and optional order (number).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:1104-1107 (registration)Registration of the todoist_create_section tool (as CREATE_SECTION_TOOL) in the array of tools returned by the ListToolsRequestSchema handler.GET_SECTIONS_TOOL, CREATE_SECTION_TOOL, UPDATE_SECTION_TOOL, DELETE_SECTION_TOOL,
- src/index.ts:873-886 (helper)Type guard function used in the handler to validate arguments for todoist_create_section, ensuring presence and string types for name and projectId.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" ); }