Skip to main content
Glama
108yen
by 108yen

updateTask

Modify task details such as name, description, status, or resolution using the task ID within the task-orchestrator-mcp server. Update existing tasks efficiently.

Instructions

Update an existing task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoUpdated task description (optional)
idYesTask ID
nameNoUpdated task name (optional)
resolutionNoTask resolution details (optional)
statusNoUpdated task status (optional)

Implementation Reference

  • Core handler function for updating a task's properties (name, description, status, resolution). Finds task by ID, validates inputs, applies updates, and persists to storage.
    export function updateTask(params: { description?: string id: string name?: string resolution?: string status?: string }): Task { const { description, id, name, resolution, status } = params if (!id || typeof id !== "string") { throw new Error(ERROR_MESSAGES.INVALID_TASK_ID) } const tasks = readTasks() const currentTask = findTaskById(tasks, id) if (!currentTask) { throw new Error(`Task with id '${id}' not found`) } // Validate status if provided if (status !== undefined) { const validStatuses = ["todo", "in_progress", "done"] if (!validStatuses.includes(status)) { throw new Error( `Invalid status '${status}'. Must be one of: ${validStatuses.join(", ")}`, ) } } // Update fields if provided if (name !== undefined) { if (!name || typeof name !== "string" || name.trim() === "") { throw new Error("Task name must be a non-empty string") } currentTask.name = name.trim() } if (description !== undefined) { currentTask.description = typeof description === "string" ? description.trim() : "" } if (status !== undefined) { currentTask.status = status } if (resolution !== undefined) { currentTask.resolution = typeof resolution === "string" ? resolution.trim() : undefined } writeTasks(tasks) return currentTask }
  • src/tools.ts:212-274 (registration)
    MCP tool registration for updateTask, defining input schema with Zod and error-handling wrapper that delegates to core updateTask function.
    server.registerTool( "updateTask", { description: "Update an existing task", inputSchema: { description: z .string() .describe("Updated task description (optional)") .optional(), id: z.string().describe("Task ID"), name: z.string().describe("Updated task name (optional)").optional(), resolution: z .string() .describe("Task resolution details (optional)") .optional(), status: z .enum(["todo", "in_progress", "done"]) .describe("Updated task status (optional)") .optional(), }, }, (args) => { try { const task = updateTask( args as { description?: string id: string name?: string resolution?: string status?: string }, ) return { content: [ { text: JSON.stringify({ task }, null, 2), type: "text", }, ], } } catch (error) { return { content: [ { text: JSON.stringify( { error: { code: "TASK_UPDATE_ERROR", message: error instanceof Error ? error.message : "Unknown error", }, }, null, 2, ), type: "text", }, ], isError: true, } } }, )
  • Zod input schema validation for updateTask parameters: id (required), optional name, description, resolution, status (enum).
    inputSchema: { description: z .string() .describe("Updated task description (optional)") .optional(), id: z.string().describe("Task ID"), name: z.string().describe("Updated task name (optional)").optional(), resolution: z .string() .describe("Task resolution details (optional)") .optional(), status: z .enum(["todo", "in_progress", "done"]) .describe("Updated task status (optional)") .optional(), },
  • Recursive helper to find and update a task in-place within the nested task hierarchy, used internally by updateTask.
    export function updateTaskInPlace( tasks: Task[], id: string, updateFn: (task: Task) => Task, ): Task | undefined { for (let i = 0; i < tasks.length; i++) { const task = tasks[i] if (task && task.id === id) { tasks[i] = updateFn(task) return tasks[i] } if (task?.tasks) { const updated = updateTaskInPlace(task.tasks, id, updateFn) if (updated) { return updated } } } return undefined }

Other Tools

Related Tools

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/108yen/task-orchestrator-mcp'

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