Skip to main content
Glama
108yen
by 108yen

listTasks

Retrieve hierarchical task structures by listing root tasks or filtering by parentId to display direct child tasks for organized task orchestration.

Instructions

List tasks from hierarchical structure, optionally filtered by parentId. Returns root tasks if no parentId specified, or direct children of specified parent task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parentIdNoFilter tasks by parent ID to get direct children (optional, returns root tasks if not specified)

Implementation Reference

  • Core implementation of listTasks: reads tasks from storage and returns root tasks or direct children of the specified parentId.
    export function listTasks(params?: { parentId?: string }): Task[] { const tasks = readTasks() if (!params?.parentId) { // Return root level tasks return tasks } // Find the parent task and return its direct children const parentTask = findTaskById(tasks, params.parentId) if (!parentTask) { // Return empty array for non-existent parent (graceful handling) return [] } return parentTask.tasks }
  • Zod input schema for the listTasks tool defining optional parentId parameter.
    inputSchema: { parentId: z .string() .describe( "Filter tasks by parent ID to get direct children (optional, returns root tasks if not specified)", ) .optional(), },
  • src/tools.ts:162-209 (registration)
    Registers the listTasks tool with the MCP server, including description, input schema, and error-handling wrapper that calls the core listTasks function.
    server.registerTool( "listTasks", { description: "List tasks from hierarchical structure, optionally filtered by parentId. Returns root tasks if no parentId specified, or direct children of specified parent task.", inputSchema: { parentId: z .string() .describe( "Filter tasks by parent ID to get direct children (optional, returns root tasks if not specified)", ) .optional(), }, }, (args) => { try { const tasks = listTasks(args) return { content: [ { text: JSON.stringify({ tasks }, null, 2), type: "text", }, ], } } catch (error) { return { content: [ { text: JSON.stringify( { error: { code: "TASK_LIST_ERROR", message: error instanceof Error ? error.message : "Unknown error", }, }, null, 2, ), type: "text", }, ], isError: true, } } }, )

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