Skip to main content
Glama

taskStepDelete

Remove specific steps from tasks to maintain organized workflows and eliminate unnecessary actions.

Instructions

刪除任務的特定步驟

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYes
stepIdYes

Implementation Reference

  • main.ts:776-801 (registration)
    Registration of the 'taskStepDelete' MCP tool, including description, Zod input schema, and thin async handler that delegates to TaskManagerTool.deleteTaskStep and handles response formatting.
    server.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 : "未知錯誤"}` }] }; } } );
  • Core handler logic for deleting a task step: loads tasks, finds task, filters out the step by ID, reorders remaining steps, updates timestamp, and persists changes to storage.
    public 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; }
  • Zod schema defining input parameters: taskId (string) and stepId (string).
    { taskId: z.string(), stepId: z.string() },

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/GonTwVn/GonMCPtool'

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