todo_add
Add a new task to a checklist with title, priority, due date, and tags for organized task management.
Instructions
Adiciona uma nova tarefa à lista
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listTitle | Yes | Título da lista | |
| taskTitle | Yes | Título da tarefa | |
| priority | No | Prioridade da tarefa | |
| dueDate | No | Data de vencimento (YYYY-MM-DD) | |
| tags | No | Tags da tarefa |
Implementation Reference
- src/index.ts:185-203 (handler)Main handler logic for the 'todo_add' tool: parses arguments with addSchema, retrieves user checklists to find the target list, adds a new item via checklistService.addItem, and returns 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 validation schema used in the todo_add handler for input parameters.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)Tool registration in the ListTools response, including name, description, and JSON 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"], }, },