remove_checklist_item
Remove a specific item from a checklist by its index to streamline task management and maintain organized progress tracking on the Divide and Conquer MCP Server.
Instructions
Removes a checklist item.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | Yes | The index of the checklist item to remove (0-based) |
Implementation Reference
- src/index.ts:866-905 (handler)The main handler function that validates the index, reads the task data, removes the checklist item at the specified index using splice, updates and saves the task data, and returns a success or error message.private async removeChecklistItem(args: any): Promise<any> { if (args?.index === undefined) { throw new McpError(ErrorCode.InvalidParams, 'Index is required'); } try { const taskData = await this.readTaskData(); // Check if the index is valid if (args.index < 0 || args.index >= taskData.checklist.length) { throw new McpError(ErrorCode.InvalidParams, `Invalid index: ${args.index}`); } // Remove the checklist item taskData.checklist.splice(args.index, 1); // Write the updated task data to the file await this.writeTaskData(taskData); return { content: [ { type: 'text', text: 'Checklist item removed successfully.', }, ], }; } catch (error) { console.error('Error removing checklist item:', error); return { content: [ { type: 'text', text: `Error removing checklist item: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
- src/index.ts:295-304 (schema)Input schema defining the required 'index' parameter as a number for the checklist item to remove.inputSchema: { type: 'object', properties: { index: { type: 'number', description: 'The index of the checklist item to remove (0-based)' } }, required: ['index'] }
- src/index.ts:292-305 (registration)Tool registration in the ListToolsRequestSchema handler, including name, description, and input schema.{ name: 'remove_checklist_item', description: 'Removes a checklist item.', inputSchema: { type: 'object', properties: { index: { type: 'number', description: 'The index of the checklist item to remove (0-based)' } }, required: ['index'] } },
- src/index.ts:438-439 (registration)Dispatch case in the CallToolRequestSchema handler that routes the tool call to the removeChecklistItem method.case 'remove_checklist_item': return await this.removeChecklistItem(request.params.arguments);