add_task
Add tasks to your todo list with titles, priorities, and estimated Pomodoro sessions to organize work and track productivity.
Instructions
Add a new task to the todo list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Task title | |
| description | No | Task description | |
| priority | Yes | Task priority | |
| estimatedPomodoros | Yes | Estimated number of pomodoros needed |
Implementation Reference
- src/index.ts:255-280 (handler)Executes the add_task tool: creates a new Task from input arguments, appends it to the tasks list, persists data to file, and returns a success response with the new task.case "add_task": { const task: Task = { id: Date.now().toString(), title: args.title as string, description: args.description as string, status: "pending", priority: args.priority as "low" | "medium" | "high", estimatedPomodoros: args.estimatedPomodoros as number, completedPomodoros: 0, createdAt: new Date().toISOString(), }; data.tasks.push(task); saveData(data); return { content: [ { type: "text", text: JSON.stringify( { success: true, task, message: "Task added successfully" }, null, 2 ), }, ], }; }
- src/index.ts:90-110 (schema)Defines the tool metadata including name, description, and input schema for validating add_task parameters.{ name: "add_task", description: "Add a new task to the todo list", inputSchema: { type: "object", properties: { title: { type: "string", description: "Task title" }, description: { type: "string", description: "Task description" }, priority: { type: "string", enum: ["low", "medium", "high"], description: "Task priority", }, estimatedPomodoros: { type: "number", description: "Estimated number of pomodoros needed", }, }, required: ["title", "priority", "estimatedPomodoros"], }, },
- src/index.ts:245-247 (registration)Registers the list tools handler which exposes the add_task tool (among others) via the TOOLS array.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));
- src/index.ts:20-30 (helper)TypeScript interface defining the structure of a Task, used in the add_task handler.interface Task { id: string; title: string; description?: string; status: "pending" | "in-progress" | "completed"; priority: "low" | "medium" | "high"; estimatedPomodoros: number; completedPomodoros: number; createdAt: string; completedAt?: string; }