todoist_create_project
Create a new Todoist project with customizable name, color, view style, and optional sub-project structure to organize tasks effectively.
Instructions
Create a new project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the project | |
| parentId | No | Parent project ID for creating a sub-project (optional) | |
| color | No | Project color (optional) | |
| isFavorite | No | Whether to mark as favorite (optional) | |
| viewStyle | No | Project view style: 'list' or 'board' (optional) |
Implementation Reference
- src/index.ts:1394-1413 (handler)Handler implementation for the todoist_create_project tool. Validates input using isCreateProjectArgs, constructs project data, calls todoistClient.addProject(), and returns formatted success response with project details.if (name === "todoist_create_project") { if (!isCreateProjectArgs(args)) { throw new Error("Invalid arguments for todoist_create_project"); } const projectData: any = { name: args.name }; if (args.parentId) projectData.parentId = args.parentId; if (args.color) projectData.color = args.color; if (args.isFavorite !== undefined) projectData.isFavorite = args.isFavorite; if (args.viewStyle) projectData.viewStyle = args.viewStyle; const project = await todoistClient.addProject(projectData); return { content: [{ type: "text", text: `Project created successfully:\nID: ${project.id}\n${formatProject(project)}` }], isError: false, }; }
- src/index.ts:398-428 (schema)Tool schema definition for todoist_create_project, including input schema with properties like name (required), parentId, color, isFavorite, viewStyle.const CREATE_PROJECT_TOOL: Tool = { name: "todoist_create_project", description: "Create a new project", inputSchema: { type: "object", properties: { name: { type: "string", description: "The name of the project" }, parentId: { type: "string", description: "Parent project ID for creating a sub-project (optional)" }, color: { type: "string", description: "Project color (optional)" }, isFavorite: { type: "boolean", description: "Whether to mark as favorite (optional)" }, viewStyle: { type: "string", description: "Project view style: 'list' or 'board' (optional)", enum: ["list", "board"] } }, required: ["name"] } };
- src/index.ts:1098-1102 (registration)Registration of todoist_create_project tool (as CREATE_PROJECT_TOOL) in the tools array returned by ListToolsRequestSchema handler.GET_PROJECTS_TOOL, GET_PROJECT_TOOL, CREATE_PROJECT_TOOL, UPDATE_PROJECT_TOOL, DELETE_PROJECT_TOOL,
- src/index.ts:834-847 (helper)Type guard helper function isCreateProjectArgs used to validate arguments in the tool handler.function isCreateProjectArgs(args: unknown): args is { name: string; parentId?: string; color?: string; isFavorite?: boolean; viewStyle?: string; } { return ( typeof args === "object" && args !== null && "name" in args && typeof (args as { name: string }).name === "string" ); }
- src/index.ts:722-724 (helper)Helper function formatProject used to format project details in tool responses.function formatProject(project: any): string { return `- ${project.name}${project.color ? `\n Color: ${project.color}` : ''}${project.isFavorite ? `\n Favorite: Yes` : ''}${project.viewStyle ? `\n View: ${project.viewStyle}` : ''}${project.parentId ? `\n Parent: ${project.parentId}` : ''}${project.id ? ` (ID: ${project.id})` : ''}`; }