todoist_project_create
Create a new project in Todoist with customizable name, color, and favorite status for organizing tasks.
Instructions
Create a new project in Todoist
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the project | |
| color | No | Color for the project (optional) | |
| is_favorite | No | Whether to mark the project as favorite (optional) |
Implementation Reference
- src/handlers/project-handlers.ts:53-74 (handler)The core handler function that implements the todoist_project_create tool logic. It builds the project data object from input arguments and uses the Todoist API client to create the project, then formats and returns a success message with project details.export async function handleCreateProject( todoistClient: TodoistApi, args: CreateProjectArgs ): Promise<string> { const projectData: TodoistProjectData = { name: args.name, }; if (args.color) { projectData.color = args.color; } if (args.is_favorite !== undefined) { projectData.isFavorite = args.is_favorite; } const project = await todoistClient.addProject(projectData); return `Project created:\nName: ${project.name}\nID: ${project.id}${ project.color ? `\nColor: ${project.color}` : "" }${project.isFavorite ? "\nMarked as favorite" : ""}`; }
- src/tools/project-tools.ts:30-51 (schema)Defines the Tool metadata and input schema (JSON Schema) for the todoist_project_create tool, specifying required 'name' and optional 'color' and 'is_favorite' parameters.export const CREATE_PROJECT_TOOL: Tool = { name: "todoist_project_create", description: "Create a new project in Todoist", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the project", }, color: { type: "string", description: "Color for the project (optional)", }, is_favorite: { type: "boolean", description: "Whether to mark the project as favorite (optional)", }, }, required: ["name"], }, };
- src/index.ts:198-203 (registration)Registers and routes incoming tool calls for 'todoist_project_create' in the main server request handler switch statement, performing argument validation before invoking the handler.case "todoist_project_create": if (!isCreateProjectArgs(args)) { throw new Error("Invalid arguments for todoist_project_create"); } result = await handleCreateProject(apiClient, args); break;
- src/type-guards.ts:113-119 (schema)Runtime type guard function that validates input arguments conform to CreateProjectArgs type for todoist_project_create tool.export function isCreateProjectArgs(args: unknown): args is CreateProjectArgs { return ( typeof args === "object" && args !== null && "name" in args && typeof (args as { name: string }).name === "string" );
- src/tools/project-tools.ts:72-76 (registration)Includes the todoist_project_create tool (CREATE_PROJECT_TOOL) in the PROJECT_TOOLS array, which is aggregated into ALL_TOOLS for server registration.export const PROJECT_TOOLS = [ GET_PROJECTS_TOOL, GET_SECTIONS_TOOL, CREATE_PROJECT_TOOL, CREATE_SECTION_TOOL,