Skip to main content
Glama

list_subtasks

Break down complex projects into actionable subtasks with detailed visibility and flexible filtering. Ideal for sprint planning, daily standups, and tracking progress across project hierarchies.

Instructions

Navigate your detailed work breakdown with granular subtask visibility and flexible filtering options. Perfect for sprint planning, daily standups, and detailed progress tracking across the complete project hierarchy from high-level goals to specific implementation steps.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoFilter subtasks to only those in this project (optional)
taskIdNoFilter subtasks to only those belonging to this task (optional)
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

  • Main execution logic for the list_subtasks tool. Validates inputs, fetches subtasks from storage, formats them hierarchically with status indicators, counts completed ones, and returns formatted text output or errors.
        handler: async ({ taskId, projectId }: { taskId?: string; projectId?: string }) => {
          try {
            // Validate task exists if taskId is provided
            if (taskId) {
              const task = await storage.getTask(taskId);
              if (!task) {
                return {
                  content: [{
                    type: 'text' as const,
                    text: `Error: Task with ID "${taskId}" not found. Use list_tasks to see all available tasks.`
                  }],
                  isError: true
                };
              }
            }
    
            // Validate project exists if projectId is provided
            if (projectId) {
              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
                };
              }
            }
    
            const subtasks = await storage.getSubtasks(taskId, projectId);
    
            if (subtasks.length === 0) {
              let message = 'No subtasks found.';
              if (taskId) {
                message = `No subtasks found for the specified task. Create your first subtask using create_subtask.`;
              } else if (projectId) {
                message = `No subtasks found in the specified project. Create your first subtask using create_subtask.`;
              } else {
                message = `No subtasks found. Create your first subtask using create_subtask.`;
              }
    
              return {
                content: [{
                  type: 'text' as const,
                  text: message
                }]
              };
            }
    
            // Get additional context for display
            const tasks = await storage.getTasks();
            const projects = await storage.getProjects();
            const taskMap = new Map(tasks.map(t => [t.id, t.name]));
            const projectMap = new Map(projects.map(p => [p.id, p.name]));
    
            let subtaskList: string;
            if (taskId) {
              // Show subtasks for a specific task
              subtaskList = subtasks.map(subtask => {
                const status = subtask.completed ? '✅' : '⏳';
                return `${status} **${subtask.name}** (ID: ${subtask.id})
    Details: ${subtask.details}
    Status: ${subtask.completed ? 'Completed' : 'Pending'}
    Created: ${new Date(subtask.createdAt).toLocaleString()}
    Updated: ${new Date(subtask.updatedAt).toLocaleString()}`;
              }).join('\n\n');
            } else {
              // Group by task when showing multiple tasks' subtasks
              const subtasksByTask = subtasks.reduce((acc, subtask) => {
                const taskName = taskMap.get(subtask.taskId) || 'Unknown Task';
                const projectName = projectMap.get(subtask.projectId) || 'Unknown Project';
                const key = `${projectName} > ${taskName}`;
                if (!acc[key]) acc[key] = [];
                acc[key].push(subtask);
                return acc;
              }, {} as Record<string, typeof subtasks>);
    
              subtaskList = Object.entries(subtasksByTask).map(([taskPath, taskSubtasks]) => {
                const subtaskItems = taskSubtasks.map(subtask => {
                  const status = subtask.completed ? '✅' : '⏳';
                  return `  ${status} **${subtask.name}** (ID: ${subtask.id}) - ${subtask.details}`;
                }).join('\n');
    
                return `**${taskPath}**\n${subtaskItems}`;
              }).join('\n\n');
            }
    
            const completedCount = subtasks.filter(s => s.completed).length;
            let headerText = `Found ${subtasks.length} subtask(s) (${completedCount} completed):`;
    
            if (taskId) {
              const task = await storage.getTask(taskId);
              const taskName = task ? task.name : 'Unknown Task';
              headerText = `Found ${subtasks.length} subtask(s) in task "${taskName}" (${completedCount} completed):`;
            } else if (projectId) {
              const project = await storage.getProject(projectId);
              const projectName = project ? project.name : 'Unknown Project';
              headerText = `Found ${subtasks.length} subtask(s) in project "${projectName}" (${completedCount} completed):`;
            }
    
            return {
              content: [{
                type: 'text' as const,
                text: `${headerText}\n\n${subtaskList}`
              }]
            };
          } catch (error) {
            return {
              content: [{
                type: 'text' as const,
                text: `Error listing subtasks: ${error instanceof Error ? error.message : 'Unknown error'}`
              }],
              isError: true
            };
          }
        }
  • Zod-based input schema defining optional taskId and projectId parameters for filtering subtasks.
    inputSchema: {
      taskId: z.string().optional(),
      projectId: z.string().optional()
    },
  • Tool registration object defining name, description, schema, and handler for the list_subtasks MCP tool, returned by createListSubtasksTool.
      return {
        name: 'list_subtasks',
        description: 'View subtasks, optionally filtered by task ID or project ID',
        inputSchema: {
          taskId: z.string().optional(),
          projectId: z.string().optional()
        },
        handler: async ({ taskId, projectId }: { taskId?: string; projectId?: string }) => {
          try {
            // Validate task exists if taskId is provided
            if (taskId) {
              const task = await storage.getTask(taskId);
              if (!task) {
                return {
                  content: [{
                    type: 'text' as const,
                    text: `Error: Task with ID "${taskId}" not found. Use list_tasks to see all available tasks.`
                  }],
                  isError: true
                };
              }
            }
    
            // Validate project exists if projectId is provided
            if (projectId) {
              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
                };
              }
            }
    
            const subtasks = await storage.getSubtasks(taskId, projectId);
    
            if (subtasks.length === 0) {
              let message = 'No subtasks found.';
              if (taskId) {
                message = `No subtasks found for the specified task. Create your first subtask using create_subtask.`;
              } else if (projectId) {
                message = `No subtasks found in the specified project. Create your first subtask using create_subtask.`;
              } else {
                message = `No subtasks found. Create your first subtask using create_subtask.`;
              }
    
              return {
                content: [{
                  type: 'text' as const,
                  text: message
                }]
              };
            }
    
            // Get additional context for display
            const tasks = await storage.getTasks();
            const projects = await storage.getProjects();
            const taskMap = new Map(tasks.map(t => [t.id, t.name]));
            const projectMap = new Map(projects.map(p => [p.id, p.name]));
    
            let subtaskList: string;
            if (taskId) {
              // Show subtasks for a specific task
              subtaskList = subtasks.map(subtask => {
                const status = subtask.completed ? '✅' : '⏳';
                return `${status} **${subtask.name}** (ID: ${subtask.id})
    Details: ${subtask.details}
    Status: ${subtask.completed ? 'Completed' : 'Pending'}
    Created: ${new Date(subtask.createdAt).toLocaleString()}
    Updated: ${new Date(subtask.updatedAt).toLocaleString()}`;
              }).join('\n\n');
            } else {
              // Group by task when showing multiple tasks' subtasks
              const subtasksByTask = subtasks.reduce((acc, subtask) => {
                const taskName = taskMap.get(subtask.taskId) || 'Unknown Task';
                const projectName = projectMap.get(subtask.projectId) || 'Unknown Project';
                const key = `${projectName} > ${taskName}`;
                if (!acc[key]) acc[key] = [];
                acc[key].push(subtask);
                return acc;
              }, {} as Record<string, typeof subtasks>);
    
              subtaskList = Object.entries(subtasksByTask).map(([taskPath, taskSubtasks]) => {
                const subtaskItems = taskSubtasks.map(subtask => {
                  const status = subtask.completed ? '✅' : '⏳';
                  return `  ${status} **${subtask.name}** (ID: ${subtask.id}) - ${subtask.details}`;
                }).join('\n');
    
                return `**${taskPath}**\n${subtaskItems}`;
              }).join('\n\n');
            }
    
            const completedCount = subtasks.filter(s => s.completed).length;
            let headerText = `Found ${subtasks.length} subtask(s) (${completedCount} completed):`;
    
            if (taskId) {
              const task = await storage.getTask(taskId);
              const taskName = task ? task.name : 'Unknown Task';
              headerText = `Found ${subtasks.length} subtask(s) in task "${taskName}" (${completedCount} completed):`;
            } else if (projectId) {
              const project = await storage.getProject(projectId);
              const projectName = project ? project.name : 'Unknown Project';
              headerText = `Found ${subtasks.length} subtask(s) in project "${projectName}" (${completedCount} completed):`;
            }
    
            return {
              content: [{
                type: 'text' as const,
                text: `${headerText}\n\n${subtaskList}`
              }]
            };
          } catch (error) {
            return {
              content: [{
                type: 'text' as const,
                text: `Error listing subtasks: ${error instanceof Error ? error.message : 'Unknown error'}`
              }],
              isError: true
            };
          }
        }
      };
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 'flexible filtering options' which hints at the filtering parameters, but doesn't describe what the tool returns (list format, pagination, error behavior), whether it's read-only or has side effects, or any performance/rate limit considerations. For a tool with no annotations, this is insufficient disclosure.

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 verbose and marketing-oriented ('Perfect for sprint planning...') rather than functional. It uses two long sentences filled with buzzwords instead of clearly stating the tool's purpose upfront. The structure is not front-loaded with essential information, making it inefficient for an AI agent to parse.

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?

Given no annotations and no output schema, the description should provide more complete context about what this tool does and returns. It mentions filtering but doesn't explain the return format, pagination, or error handling. For a list/retrieval tool with 3 parameters and no structured output documentation, this description is incomplete.

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 three parameters. The description mentions 'flexible filtering options' which aligns with the optional projectId and taskId parameters, but adds no additional semantic meaning beyond what's already in the schema descriptions. This meets the baseline 3 for high schema coverage.

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 mentions 'navigate your detailed work breakdown with granular subtask visibility' which implies listing subtasks, but it's vague about the specific action. It doesn't clearly state 'list subtasks' or 'retrieve subtasks' as a verb+resource combination. The description focuses more on use cases (sprint planning, daily standups) than on what the tool actually does.

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

Usage Guidelines3/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, daily standups, and detailed progress tracking' which implies when to use this tool, but it doesn't explicitly differentiate from sibling tools like 'list_tasks' or 'get_subtask'. There's no guidance on when to choose this tool over alternatives, only implied context from the use case descriptions.

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