todoist_section_create
Organize tasks by creating new sections within Todoist projects to structure and categorize your workflow.
Instructions
Create a new section within a project in Todoist
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the section | |
| project_id | Yes | Project ID where the section will be created |
Implementation Reference
- src/handlers/project-handlers.ts:76-86 (handler)The core handler function that implements the logic to create a new section in Todoist by calling the Todoist API's addSection method.export async function handleCreateSection( todoistClient: TodoistApi, args: CreateSectionArgs ): Promise<string> { const section = await todoistClient.addSection({ name: args.name, projectId: args.project_id, }); return `Section created:\nName: ${section.name}\nID: ${section.id}\nProject ID: ${section.projectId}`; }
- src/tools/project-tools.ts:53-70 (schema)Defines the tool metadata, description, and input schema (JSON Schema) for validating arguments to todoist_section_create.export const CREATE_SECTION_TOOL: Tool = { name: "todoist_section_create", description: "Create a new section within a project in Todoist", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the section", }, project_id: { type: "string", description: "Project ID where the section will be created", }, }, required: ["name", "project_id"], }, };
- src/index.ts:205-210 (registration)Registers the tool handling in the main switch dispatcher: validates args with type guard and calls the handler function.case "todoist_section_create": if (!isCreateSectionArgs(args)) { throw new Error("Invalid arguments for todoist_section_create"); } result = await handleCreateSection(apiClient, args); break;
- src/type-guards.ts:122-131 (schema)Runtime type guard (schema validation) ensuring arguments have required 'name' and 'project_id' string properties.export function isCreateSectionArgs(args: unknown): args is CreateSectionArgs { return ( typeof args === "object" && args !== null && "name" in args && "project_id" in args && typeof (args as { name: string }).name === "string" && typeof (args as { project_id: string }).project_id === "string" ); }
- src/tools/project-tools.ts:72-77 (registration)Includes the CREATE_SECTION_TOOL in the PROJECT_TOOLS array, which is aggregated into ALL_TOOLS for tool listing.export const PROJECT_TOOLS = [ GET_PROJECTS_TOOL, GET_SECTIONS_TOOL, CREATE_PROJECT_TOOL, CREATE_SECTION_TOOL, ];