Skip to main content
Glama

reorder_checklist_item

Move a checklist item to a new position by specifying its current and desired index, enabling organized task management within structured workflows.

Instructions

Moves a checklist item to a new position.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_indexYesThe current index of the checklist item (0-based)
to_indexYesThe new index for the checklist item (0-based)

Implementation Reference

  • The handler function that implements the core logic for reordering a checklist item. It validates the from_index and to_index parameters, moves the item in the checklist array using splice, recalculates progress, and persists the updated task data to the config file.
    private async reorderChecklistItem(args: any): Promise<any> { if (args?.from_index === undefined || args?.to_index === undefined) { throw new McpError(ErrorCode.InvalidParams, 'From index and to index are required'); } try { const taskData = await this.readTaskData(); // Check if the indices are valid if (args.from_index < 0 || args.from_index >= taskData.checklist.length) { throw new McpError(ErrorCode.InvalidParams, `Invalid from index: ${args.from_index}`); } if (args.to_index < 0 || args.to_index > taskData.checklist.length) { throw new McpError(ErrorCode.InvalidParams, `Invalid to index: ${args.to_index}`); } // Move the checklist item const [item] = taskData.checklist.splice(args.from_index, 1); taskData.checklist.splice(args.to_index, 0, item); // Write the updated task data to the file await this.writeTaskData(taskData); return { content: [ { type: 'text', text: 'Checklist item reordered successfully.', }, ], }; } catch (error) { console.error('Error reordering checklist item:', error); return { content: [ { type: 'text', text: `Error reordering checklist item: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
  • Input schema defining the parameters for the tool: from_index and to_index as required numbers.
    inputSchema: { type: 'object', properties: { from_index: { type: 'number', description: 'The current index of the checklist item (0-based)' }, to_index: { type: 'number', description: 'The new index for the checklist item (0-based)' } }, required: ['from_index', 'to_index'] }
  • src/index.ts:306-323 (registration)
    Registration of the tool in the ListTools response, providing name, description, and input schema for discovery.
    { name: 'reorder_checklist_item', description: 'Moves a checklist item to a new position.', inputSchema: { type: 'object', properties: { from_index: { type: 'number', description: 'The current index of the checklist item (0-based)' }, to_index: { type: 'number', description: 'The new index for the checklist item (0-based)' } }, required: ['from_index', 'to_index'] } },
  • src/index.ts:440-441 (registration)
    Switch case in the CallToolRequest handler that routes calls to the reorderChecklistItem method.
    case 'reorder_checklist_item': return await this.reorderChecklistItem(request.params.arguments);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/landicefu/divide-and-conquer-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server