todo_add
Add new tasks to a checklist with titles, priorities, due dates, and tags for organized task management on the MCP TODO Checklist Server.
Instructions
Adiciona uma nova tarefa à lista
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dueDate | No | Data de vencimento (YYYY-MM-DD) | |
| listTitle | Yes | Título da lista | |
| priority | No | Prioridade da tarefa | |
| tags | No | Tags da tarefa | |
| taskTitle | Yes | Título da tarefa |
Implementation Reference
- src/index.ts:185-203 (handler)Executes the todo_add tool: validates input with Zod schema, retrieves user's checklists, finds the target list by title, adds a new item using ChecklistService.addItem, and returns a success message.case "todo_add": { console.error('DEBUG - Processing todo_add'); const params = addSchema.parse(args); const lists = await checklistService.getUserChecklists('current-user'); const list = lists.find(l => l.title === params.listTitle); if (!list) { throw new Error(`Lista não encontrada: ${params.listTitle}`); } const newItem = await checklistService.addItem(list.id, { title: params.taskTitle, priority: params.priority, dueDate: params.dueDate ? new Date(params.dueDate) : undefined, tags: params.tags, completed: false }); return { content: [{ type: "text", text: `Tarefa "${params.taskTitle}" adicionada à lista "${params.listTitle}"!` }] }; }
- src/index.ts:38-44 (schema)Zod schema for validating input parameters of the todo_add tool.const addSchema = z.object({ listTitle: z.string(), taskTitle: z.string(), priority: z.enum(['low', 'medium', 'high']).optional().default('medium'), dueDate: z.string().optional(), tags: z.array(z.string()).optional().default([]) });
- src/index.ts:111-125 (registration)Registers the todo_add tool in the ListTools response, including its description and input schema.{ name: "todo_add", description: "Adiciona uma nova tarefa à lista", inputSchema: { type: "object", properties: { listTitle: { type: "string", description: "Título da lista" }, taskTitle: { type: "string", description: "Título da tarefa" }, priority: { type: "string", enum: ["low", "medium", "high"], description: "Prioridade da tarefa" }, dueDate: { type: "string", description: "Data de vencimento (YYYY-MM-DD)" }, tags: { type: "array", items: { type: "string" }, description: "Tags da tarefa" }, }, required: ["listTitle", "taskTitle"], }, },
- Helper method in ChecklistService that implements the core logic for adding a new item to a checklist: generates ID and timestamps, appends to items array, persists to storage.async addItem(checklistId: string, data: Omit<ChecklistItem, 'id' | 'createdAt' | 'updatedAt'>): Promise<ChecklistItem> { const checklist = await this.getChecklist(checklistId); const now = new Date(); const item: ChecklistItem = { ...data, id: crypto.randomUUID(), createdAt: now, updatedAt: now }; checklist.items.push(item); checklist.updatedAt = now; await this.storage.save(`checklist:${checklistId}`, checklist); return item; }