Skip to main content
Glama

taskSetAllSteps

Manage task efficiency by updating completion status for all steps within a specified task using the MCP server's structured input schema.

Instructions

設定某個任務所有步驟的完成狀態

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
completedYes
taskIdYes

Implementation Reference

  • Core handler logic: Loads tasks from JSON, finds the task by ID, sets all steps' completed status, updates task metadata, handles status logic (e.g., prompt to complete task if all steps done), and saves back to JSON.
    public static async setAllStepsStatus(taskId: string, completed: boolean): 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]; // 更新所有步驟狀態 task.steps = task.steps.map(step => ({ ...step, completed })); // 更新任務 task.updatedAt = new Date().toISOString(); // 當所有步驟完成時,提示使用completeTask來標記任務為已完成 if (completed && task.status !== TaskStatus.COMPLETED) { // 不自動設置任務為完成狀態,僅顯示提示信息 console.log(`任務 "${task.title}" 的所有步驟已完成,請使用 completeTask 方法將任務標記為已完成`); } else if (!completed && task.status === TaskStatus.COMPLETED) { // 如果將步驟設為未完成,且當前任務狀態為已完成,則將狀態改為進行中 task.status = TaskStatus.IN_PROGRESS; // 移除實際完成時間 delete task.actualCompletionDate; } // 保存所有任務 await this.writeTasks(tasks); return task; }
  • main.ts:857-883 (registration)
    MCP tool registration: Defines tool name, description, input schema (taskId: string, completed: boolean), and thin wrapper handler that calls TaskManagerTool.setAllStepsStatus and formats response.
    server.tool("taskSetAllSteps", "設定某個任務所有步驟的完成狀態", { taskId: z.string(), completed: z.boolean() }, async ({ taskId, completed }) => { try { const updatedTask = await TaskManagerTool.setAllStepsStatus(taskId, completed); if (!updatedTask) { return { content: [{ type: "text", text: `未找到ID為 ${taskId} 的任務` }] }; } const status = completed ? '完成' : '未完成'; return { content: [{ type: "text", text: `任務「${updatedTask.title}」的所有步驟已設為${status}狀態:\n${JSON.stringify(updatedTask, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `更新任務步驟狀態失敗: ${error instanceof Error ? error.message : "未知錯誤"}` }] }; } } );
  • Input schema using Zod for validation: taskId (string), completed (boolean).
    taskId: z.string(), completed: z.boolean() },

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