add_checklist_item
Add a new task to a checklist with details like task name, description, context, and position. Enables AI agents to manage and track progress on complex tasks efficiently.
Instructions
Adds a new item to the checklist.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_and_plan | No | Related information, files the agent should read, and more details from other tasks, as well as a detailed plan for this task | |
| detailed_description | Yes | A longer description about what we want to achieve with this task | |
| done | No | Whether the task is already completed | |
| position | No | Optional position to insert the task (0-based index). If not provided, the task will be added at the end. | |
| task | Yes | A short yet comprehensive name for the task |
Implementation Reference
- src/index.ts:677-723 (handler)The core handler function for the 'add_checklist_item' tool. It validates inputs, reads current task data, creates and inserts the new checklist item (with optional position), updates progress via writeTaskData, and returns success or error response.private async addChecklistItem(args: any): Promise<any> { if (!args?.task || !args?.detailed_description) { throw new McpError(ErrorCode.InvalidParams, 'Task and detailed description are required'); } try { const taskData = await this.readTaskData(); // Create the new checklist item const newItem: ChecklistItem = { task: args.task, detailed_description: args.detailed_description, context_and_plan: args.context_and_plan, done: args.done || false }; // Add the item to the checklist at the specified position or at the end if (args.position !== undefined && args.position >= 0 && args.position <= taskData.checklist.length) { taskData.checklist.splice(args.position, 0, newItem); } else { taskData.checklist.push(newItem); } // Write the updated task data to the file await this.writeTaskData(taskData); return { content: [ { type: 'text', text: 'Checklist item added successfully.', }, ], }; } catch (error) { console.error('Error adding checklist item:', error); return { content: [ { type: 'text', text: `Error adding checklist item: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
- src/index.ts:203-233 (schema)Tool definition including name, description, and input schema for 'add_checklist_item', defining the expected parameters and validation.{ name: 'add_checklist_item', description: 'Adds a new item to the checklist.', inputSchema: { type: 'object', properties: { task: { type: 'string', description: 'A short yet comprehensive name for the task' }, detailed_description: { type: 'string', description: 'A longer description about what we want to achieve with this task' }, context_and_plan: { type: 'string', description: 'Related information, files the agent should read, and more details from other tasks, as well as a detailed plan for this task' }, done: { type: 'boolean', description: 'Whether the task is already completed', default: false }, position: { type: 'number', description: 'Optional position to insert the task (0-based index). If not provided, the task will be added at the end.' } }, required: ['task', 'detailed_description'] } },
- src/index.ts:430-431 (registration)Dispatcher registration in the CallToolRequestSchema handler switch statement, routing calls to the addChecklistItem method.case 'add_checklist_item': return await this.addChecklistItem(request.params.arguments);
- src/index.ts:31-36 (schema)TypeScript interface defining the structure of checklist items used in the add_checklist_item tool.interface ChecklistItem { done: boolean; task: string; detailed_description: string; context_and_plan?: string; }