Skip to main content
Glama

taskStepAdd

Add new steps to tasks in projects by specifying the task ID, step description, and optional order or estimated time using this MCP server tool.

Instructions

為任務添加新步驟

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYes
estimatedTimeNo
orderNo
taskIdYes

Implementation Reference

  • Core implementation of taskStepAdd: adds a new step to the specified task by ID, generates UUID, appends, sorts steps by order, updates timestamp, and saves to tasks.json.
    public static async addTaskStep( taskId: string, description: string, order?: number, estimatedTime?: number ): 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 newOrder = order || task.steps.length + 1; // 創建新步驟 const newStep: TaskStep = { id: uuidv4(), description, completed: false, order: newOrder, estimatedTime }; // 添加新步驟 task.steps.push(newStep); // 重新排序步驟 task.steps.sort((a, b) => (a.order ?? 0) - (b.order ?? 0)); // 更新任務 task.updatedAt = new Date().toISOString(); // 保存所有任務 await this.writeTasks(tasks); return task; }
  • Zod input schema for taskStepAdd tool defining parameters: taskId, description, optional order and estimatedTime.
    taskId: z.string(), description: z.string(), order: z.number().optional(), estimatedTime: z.number().optional() },
  • main.ts:746-773 (registration)
    MCP server.tool registration for 'taskStepAdd', includes description, schema, and thin wrapper handler that calls TaskManagerTool.addTaskStep and formats response.
    server.tool("taskStepAdd", "為任務添加新步驟", { taskId: z.string(), description: z.string(), order: z.number().optional(), estimatedTime: z.number().optional() }, async ({ taskId, description, order, estimatedTime }) => { try { const updatedTask = await TaskManagerTool.addTaskStep(taskId, description, order, estimatedTime); if (!updatedTask) { return { content: [{ type: "text", text: `未找到ID為 ${taskId} 的任務` }] }; } return { content: [{ type: "text", text: `步驟添加成功:\n${JSON.stringify(updatedTask, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `添加步驟失敗: ${error instanceof Error ? error.message : "未知錯誤"}` }] }; } } );

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