mark_task_done
Updates the status of a checklist item to completed by specifying its index, aiding in task tracking within structured JSON workflows.
Instructions
Marks a checklist item as done.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | Yes | The index of the checklist item to mark as done (0-based) |
Implementation Reference
- src/index.ts:782-821 (handler)The handler function that executes the tool logic: validates the index, reads task data, sets the checklist item at the given index to done, persists the update, and returns a success message.private async markTaskDone(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}`); } // Mark the checklist item as done taskData.checklist[args.index].done = true; // Write the updated task data to the file await this.writeTaskData(taskData); return { content: [ { type: 'text', text: 'Task marked as done.', }, ], }; } catch (error) { console.error('Error marking task as done:', error); return { content: [ { type: 'text', text: `Error marking task as done: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
- src/index.ts:267-276 (schema)Input schema definition requiring a numeric 'index' (0-based) for the checklist item.inputSchema: { type: 'object', properties: { index: { type: 'number', description: 'The index of the checklist item to mark as done (0-based)' } }, required: ['index'] }
- src/index.ts:264-277 (registration)Tool registration in the tools array passed to server.setTools(), including name, description, and schema.{ name: 'mark_task_done', description: 'Marks a checklist item as done.', inputSchema: { type: 'object', properties: { index: { type: 'number', description: 'The index of the checklist item to mark as done (0-based)' } }, required: ['index'] } },
- src/index.ts:434-435 (registration)Dispatcher case in the tool request handler switch that routes calls to the markTaskDone method.case 'mark_task_done': return await this.markTaskDone(request.params.arguments);