Skip to main content
Glama
108yen

task-orchestrator-mcp

by 108yen

updateTask

Modify task details like name, description, status, or resolution using the task ID in the task-orchestrator-mcp server.

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 that implements the updateTask tool logic: validates input, finds task by ID, mutates the task object with provided updates (name, description, status, resolution), persists to storage, and returns the updated task.
    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
    }
  • Zod input schema for the updateTask tool defining parameters: id (required), name/description/resolution/status (optional).
    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(),
    },
  • src/tools.ts:212-274 (registration)
    Registers the updateTask MCP tool with the server, providing description, Zod input schema validation, and a thin wrapper handler that calls the core updateTask function with error handling and JSON response formatting.
    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,
          }
        }
      },
    )

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