Skip to main content
Glama

list_tasks

View and organize tasks, track progress, and filter by project or hierarchy for effective sprint planning and productivity management.

Instructions

Explore and organize your task portfolio with intelligent filtering and comprehensive progress tracking. View all tasks across projects or focus on specific project tasks, perfect for sprint planning, progress reviews, and maintaining productivity momentum.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeCompletedNoInclude completed tasks in results (default: true)
parentIdNoFilter to tasks under this parent (optional)
projectIdYesID of the project to list tasks for
showHierarchyNoShow tasks in hierarchical tree format (default: true)
workingDirectoryYesThe full absolute path to the working directory where data is stored. MUST be an absolute path, never relative. Windows: "C:\Users\username\project" or "D:\projects\my-app". Unix/Linux/macOS: "/home/username/project" or "/Users/username/project". Do NOT use: ".", "..", "~", "./folder", "../folder" or any relative paths. Ensure the path exists and is accessible before calling this tool. NOTE: When server is started with --claude flag, this parameter is ignored and a global user directory is used instead.

Implementation Reference

  • Core execution logic for list_tasks tool: validates project and parent, fetches hierarchy or flat tasks, formats output with tree structure, icons, stats, and tips.
        handler: async ({ projectId, parentId, showHierarchy = true, includeCompleted = true }: {
          projectId: string;
          parentId?: string;
          showHierarchy?: boolean;
          includeCompleted?: boolean;
        }) => {
          try {
            // Validate project exists
            const project = await storage.getProject(projectId);
            if (!project) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `Error: Project with ID "${projectId}" not found. Use list_projects to see all available projects.`
                }],
                isError: true
              };
            }
    
            // If parentId is provided, validate parent task exists
            let parentTask = null;
            if (parentId) {
              parentTask = await storage.getTask(parentId);
              if (!parentTask) {
                return {
                  content: [{
                    type: 'text' as const,
                    text: `Error: Parent task with ID "${parentId}" not found.`
                  }],
                  isError: true
                };
              }
            }
    
            if (showHierarchy) {
              // Show full hierarchy starting from parentId (or root if not specified)
              const hierarchy = await storage.getTaskHierarchy(projectId, parentId);
    
              if (hierarchy.length === 0) {
                const scopeDescription = parentTask
                  ? `under parent task "${parentTask.name}"`
                  : `at the top level of project "${project.name}"`;
    
                return {
                  content: [{
                    type: 'text' as const,
                    text: `No tasks found ${scopeDescription}. Create your first task using create_task.`
                  }]
                };
              }
    
              const formatTaskHierarchy = (hierarchyList: typeof hierarchy, baseLevel: number = 0): string => {
                return hierarchyList.map(item => {
                  const task = item.task;
    
                  // Skip completed tasks if not included
                  if (!includeCompleted && task.completed) {
                    return '';
                  }
    
                  const indent = '  '.repeat(baseLevel);
                  const icon = task.completed ? 'āœ…' : 'ā³';
                  const priorityIcon = task.priority && task.priority >= 8 ? 'šŸ”„' :
                                     task.priority && task.priority >= 6 ? '⚔' : '';
                  const complexityIcon = task.complexity && task.complexity >= 8 ? '🧩' : '';
                  const statusText = task.status ? ` [${task.status.toUpperCase()}]` : '';
                  const timeText = task.estimatedHours ? ` (${task.estimatedHours}h)` : '';
    
                  let taskLine = `${indent}${icon} **${task.name}** ${priorityIcon}${complexityIcon}${statusText}${timeText}\n`;
                  taskLine += `${indent}   ID: ${task.id} | Level: ${task.level || 0}\n`;
                  taskLine += `${indent}   ${task.details}\n`;
    
                  if (task.tags && task.tags.length > 0) {
                    taskLine += `${indent}   Tags: ${task.tags.join(', ')}\n`;
                  }
    
                  if (task.dependsOn && task.dependsOn.length > 0) {
                    taskLine += `${indent}   Dependencies: ${task.dependsOn.length} task(s)\n`;
                  }
    
                  // Add children recursively
                  if (item.children.length > 0) {
                    const childrenText = formatTaskHierarchy(item.children, baseLevel + 1);
                    if (childrenText.trim()) {
                      taskLine += childrenText;
                    }
                  }
    
                  return taskLine;
                }).filter(line => line.trim()).join('\n');
              };
    
              const hierarchyText = formatTaskHierarchy(hierarchy);
              const totalTasks = countTasksInHierarchy(hierarchy);
              const completedTasks = countCompletedTasksInHierarchy(hierarchy);
    
              const scopeInfo = parentTask
                ? `Showing hierarchy under "${parentTask.name}" in project "${project.name}"`
                : `Showing full task hierarchy for project "${project.name}"`;
    
              return {
                content: [{
                  type: 'text' as const,
                  text: `🌲 **Task Hierarchy**
    
    ${scopeInfo}
    Total: ${totalTasks} tasks (${completedTasks} completed)
    
    ${hierarchyText}
    
    šŸ’” **Tips:**
    • Use \`create_task\` with parentId to add tasks at any level
    • Use \`list_tasks\` with specific parentId to focus on a subtree
    • Use \`update_task\` to change parent relationships`
                }]
              };
            } else {
              // Show flat list for specific parent level
              const tasks = await storage.getTasks(projectId, parentId);
    
              if (tasks.length === 0) {
                const scopeDescription = parentTask
                  ? `under parent task "${parentTask.name}"`
                  : `at the top level of project "${project.name}"`;
    
                return {
                  content: [{
                    type: 'text' as const,
                    text: `No tasks found ${scopeDescription}. Create your first task using create_task.`
                  }]
                };
              }
    
              const filteredTasks = includeCompleted ? tasks : tasks.filter(t => !t.completed);
    
              const taskList = filteredTasks.map(task => {
                const icon = task.completed ? 'āœ…' : 'ā³';
                const priorityIcon = task.priority && task.priority >= 8 ? 'šŸ”„' :
                                   task.priority && task.priority >= 6 ? '⚔' : '';
                const complexityIcon = task.complexity && task.complexity >= 8 ? '🧩' : '';
                const statusText = task.status ? ` [${task.status.toUpperCase()}]` : '';
                const timeText = task.estimatedHours ? ` (${task.estimatedHours}h)` : '';
    
                return `${icon} **${task.name}** ${priorityIcon}${complexityIcon}${statusText}${timeText}
       ID: ${task.id} | Level: ${task.level || 0}
       ${task.details}
       ${task.tags && task.tags.length > 0 ? `Tags: ${task.tags.join(', ')}` : ''}
       Created: ${new Date(task.createdAt).toLocaleString()}`;
              }).join('\n\n');
    
              const completedCount = filteredTasks.filter(t => t.completed).length;
              const scopeDescription = parentTask
                ? `under "${parentTask.name}"`
                : `at top level of "${project.name}"`;
    
              return {
                content: [{
                  type: 'text' as const,
                  text: `šŸ“‹ **Tasks ${scopeDescription}**
    
    Found ${filteredTasks.length} task(s) (${completedCount} completed):
    
    ${taskList}
    
    šŸ’” Use \`list_tasks\` with \`showHierarchy: true\` to see the full tree structure.`
                }]
              };
            }
          } catch (error) {
            return {
              content: [{
                type: 'text' as const,
                text: `Error listing tasks: ${error instanceof Error ? error.message : 'Unknown error'}`
              }],
              isError: true
            };
          }
        }
  • Tool name, description, and Zod input schema defining parameters: projectId (required), parentId, showHierarchy, includeCompleted.
    name: 'list_tasks',
    description: 'View tasks in hierarchical tree format. Filter by projectId (required) and/or parentId. Use parentId=null for top-level tasks, or specific parentId for subtasks.',
    inputSchema: {
      projectId: z.string(),
      parentId: z.string().optional(),
      showHierarchy: z.boolean().optional(),
      includeCompleted: z.boolean().optional()
    },
  • Registration of list_tasks within the createTaskTools function that bundles all task management tools.
    export function createTaskTools(storage: Storage) {
      return {
        create_task: createCreateTaskTool(storage),
        delete_task: createDeleteTaskTool(storage),
        get_task: createGetTaskTool(storage),
        list_tasks: createListTasksTool(storage),
        update_task: createUpdateTaskTool(storage),
        migrate_subtasks: createMigrateSubtasksTool(storage),
        move_task: createMoveTaskTool(storage)
      };
    }
  • Helper functions to recursively count total and completed tasks in the task hierarchy.
    function countTasksInHierarchy(hierarchy: any[]): number {
      return hierarchy.reduce((count, item) => {
        return count + 1 + countTasksInHierarchy(item.children);
      }, 0);
    }
    
    /**
     * Count completed tasks in hierarchy
     */
    function countCompletedTasksInHierarchy(hierarchy: any[]): number {
      return hierarchy.reduce((count, item) => {
        const thisCount = item.task.completed ? 1 : 0;
        return count + thisCount + countCompletedTasksInHierarchy(item.children);
      }, 0);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'intelligent filtering' and 'comprehensive progress tracking' but doesn't explain what these mean operationally. It doesn't disclose whether this is a read-only operation (implied but not stated), what format results are returned in, pagination behavior, error conditions, or performance characteristics. The description is promotional rather than informative about actual behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences but contains marketing language ('perfect for sprint planning', 'maintaining productivity momentum') that doesn't add operational value. It's front-loaded with vague benefits rather than concrete functionality. The second sentence repeats concepts from the first without adding new information. Several phrases could be removed without losing essential tool understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 5 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the tool returns (task objects? summaries? hierarchies?), doesn't mention the required 'workingDirectory' parameter's significance, and provides no error handling or behavioral context. The promotional language doesn't compensate for missing operational details needed for effective tool use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents all 5 parameters. The description adds no specific parameter information beyond what's in the schema. It mentions 'filtering' generally but doesn't connect to specific parameters like 'projectId', 'parentId', or 'includeCompleted'. Baseline 3 is appropriate when schema does all the parameter documentation work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool helps 'explore and organize your task portfolio' with 'intelligent filtering and comprehensive progress tracking', which indicates a listing/exploration function. However, it's vague about the specific action ('list' is implied but not explicit) and doesn't clearly distinguish this from sibling tools like 'get_task' or 'list_subtasks'. The description focuses more on benefits than the core function.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions use cases like 'sprint planning, progress reviews, and maintaining productivity momentum', but provides no explicit guidance on when to use this tool versus alternatives. It doesn't differentiate from 'get_task' (single task retrieval), 'list_subtasks' (subtask-specific listing), or 'search_memories' (different resource type). No when-not-to-use guidance or prerequisites are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/Pimzino/agentic-tools-mcp'

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