Skip to main content
Glama

taskStepUpdate

Update specific steps within tasks by modifying descriptions, completion status, order, or estimated time using task and step identifiers.

Instructions

更新任務的特定步驟

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYes
stepIdYes
updatesYes

Implementation Reference

  • main.ts:712-743 (registration)
    Registers the 'taskStepUpdate' MCP tool with server.tool(), including description, Zod input schema, thin handler wrapper, and response formatting.
    server.tool("taskStepUpdate", "更新任務的特定步驟", { taskId: z.string(), stepId: z.string(), updates: z.object({ description: z.string().optional(), completed: z.boolean().optional(), order: z.number().optional(), estimatedTime: z.number().optional() }) }, async ({ taskId, stepId, updates }) => { try { const updatedTask = await TaskManagerTool.updateTaskStep(taskId, stepId, updates); 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 updating a specific task step: loads tasks from storage, locates task and step, merges updates, updates timestamp, checks if all steps complete (logs prompt), persists changes, returns updated task.
    public static async updateTaskStep(taskId: string, stepId: string, updates: Partial<Omit<TaskStep, 'id'>>): 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 stepIndex = task.steps.findIndex(s => s.id === stepId); if (stepIndex === -1) { return null; } // 更新步驟 task.steps[stepIndex] = { ...task.steps[stepIndex], ...updates }; // 更新任務 task.updatedAt = new Date().toISOString(); // 檢查所有步驟是否完成,如果所有步驟完成則提示用戶使用 completeTask const allStepsCompleted = task.steps.every(s => s.completed); if (allStepsCompleted && task.status !== TaskStatus.COMPLETED) { // 不自動設置任務為完成狀態,顯示提示信息 console.log(`任務 "${task.title}" 的所有步驟已完成,請使用 completeTask 方法將任務標記為已完成`); } // 保存所有任務 await this.writeTasks(tasks); return task; }
  • Zod input schema for the taskStepUpdate tool, defining required taskId/stepId and optional updates matching TaskStep properties.
    taskId: z.string(), stepId: z.string(), updates: z.object({ description: z.string().optional(), completed: z.boolean().optional(), order: z.number().optional(), estimatedTime: z.number().optional() })
  • TypeScript interface defining TaskStep structure, used as basis for schema updates (excludes id which is immutable).
    export interface TaskStep { /** * 步驟ID */ id: string; /** * 步驟描述 */ description: string; /** * 步驟是否完成 */ completed?: boolean; /** * 步驟順序 */ order?: number; /** * 步驟預估完成時間(分鐘) */ estimatedTime?: number; }

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