taskStepDelete
Remove specific steps from tasks in GonMCPtool by specifying taskId and stepId, streamlining task management for efficient project workflows.
Instructions
刪除任務的特定步驟
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stepId | Yes | ||
| taskId | Yes |
Implementation Reference
- tools/taskManagerTool.ts:314-345 (handler)Core handler implementation that deletes the specified step from the task, reorders remaining steps, updates timestamp, and saves to tasks.jsonpublic static async deleteTaskStep(taskId: string, stepId: string): Promise<Task | null> { const tasks = await this.readTasks(); const taskIndex = tasks.findIndex(t => t.id === taskId); if (taskIndex === -1) { return null; } const task = tasks[taskIndex]; const initialStepsLength = task.steps.length; // 刪除步驟 task.steps = task.steps.filter(s => s.id !== stepId); if (task.steps.length === initialStepsLength) { return null; } // 重新排序步驟 task.steps = task.steps.map((step, index) => ({ ...step, order: index + 1 })); // 更新任務 task.updatedAt = new Date().toISOString(); // 保存所有任務 await this.writeTasks(tasks); return task; }
- main.ts:776-801 (registration)Registers the taskStepDelete tool with Zod input schema (taskId, stepId) and thin wrapper handler that calls TaskManagerTool.deleteTaskStepserver.tool("taskStepDelete", "刪除任務的特定步驟", { taskId: z.string(), stepId: z.string() }, async ({ taskId, stepId }) => { try { const updatedTask = await TaskManagerTool.deleteTaskStep(taskId, stepId); if (!updatedTask) { return { content: [{ type: "text", text: `未找到指定的任務或步驟` }] }; } return { content: [{ type: "text", text: `步驟刪除成功:\n${JSON.stringify(updatedTask, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `刪除步驟失敗: ${error instanceof Error ? error.message : "未知錯誤"}` }] }; } } );
- main.ts:779-781 (schema)Zod input schema defining parameters for taskStepDelete tool: taskId (string), stepId (string)taskId: z.string(), stepId: z.string() },