Skip to main content
Glama
108yen
by 108yen

getTask

Retrieve task details using a specific task ID for efficient task management and orchestration within the task-orchestrator-mcp server.

Instructions

Get a task by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesTask ID

Implementation Reference

  • Core handler function that retrieves a task by its ID. Loads all tasks from storage, uses findTaskById helper to locate the task recursively in the hierarchy, and returns it or throws appropriate errors.
    export function getTask(id: string): Task { if (!id || typeof id !== "string") { throw new Error(ERROR_MESSAGES.INVALID_TASK_ID) } const tasks = readTasks() const task = findTaskById(tasks, id) if (!task) { throw new Error(ERROR_MESSAGES.TASK_NOT_FOUND(id)) } return task }
  • src/tools.ts:117-159 (registration)
    Registration of the 'getTask' MCP tool using server.registerTool, including schema, description, and thin wrapper handler that calls the core getTask function.
    // Register getTask tool server.registerTool( "getTask", { description: "Get a task by its ID", inputSchema: { id: z.string().describe("Task ID"), }, }, (args) => { try { const task = getTask(args.id) return { content: [ { text: JSON.stringify({ task }, null, 2), type: "text", }, ], } } catch (error) { return { content: [ { text: JSON.stringify( { error: { code: "TASK_NOT_FOUND", message: error instanceof Error ? error.message : "Unknown error", }, }, null, 2, ), type: "text", }, ], isError: true, } } }, )
  • Zod input schema for the getTask tool, requiring a single 'id' string parameter.
    inputSchema: { id: z.string().describe("Task ID"), },
  • Recursive helper function used by getTask to search for a task by ID in the nested task hierarchy.
    export function findTaskById(tasks: Task[], id: string): Task | undefined { for (const task of tasks) { if (task.id === id) { return task } const found = findTaskById(task.tasks, id) if (found) { return found } } 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