Skip to main content
Glama

get_tasks

Retrieve all tasks from Task Master, with options to filter by status, include subtasks, and specify project details for AI-driven development workflows.

Instructions

Get all tasks from Task Master, optionally filtering by status and including subtasks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
complexityReportNoPath to the complexity report file (relative to project root or absolute)
fileNoPath to the tasks file (relative to project root or absolute)
projectRootYesThe directory of the project. Must be an absolute path.
statusNoFilter tasks by status (e.g., 'pending', 'done') or multiple statuses separated by commas (e.g., 'blocked,deferred')
tagNoTag context to operate on
withSubtasksNoInclude subtasks nested within their parent tasks in the response

Implementation Reference

  • The main handler function for the get_tasks tool, which fetches tasks from tmCore.tasks.list, applies filters, computes statistics including completion percentages for tasks and subtasks, and returns structured results or error handling.
    execute: withToolContext(
    	'get-tasks',
    	async (args: GetTasksArgs, { log, tmCore }: ToolContext) => {
    		const { projectRoot, status, withSubtasks, tag } = args;
    
    		try {
    			log.info(
    				`Getting tasks from ${projectRoot}${status ? ` with status filter: ${status}` : ''}${tag ? ` for tag: ${tag}` : ''}`
    			);
    
    			// Build filter
    			const filter =
    				status && status !== 'all'
    					? {
    							status: status
    								.split(',')
    								.map((s: string) => s.trim() as TaskStatus)
    						}
    					: undefined;
    
    			// Call tm-core tasks.list()
    			const result = await tmCore.tasks.list({
    				tag,
    				filter,
    				includeSubtasks: withSubtasks
    			});
    
    			log.info(
    				`Retrieved ${result.tasks?.length || 0} tasks (${result.filtered} filtered, ${result.total} total)`
    			);
    
    			// Calculate stats using reduce for cleaner code
    			const tasks = result.tasks ?? [];
    			const totalTasks = result.total;
    			const taskCounts = tasks.reduce(
    				(acc, task) => {
    					acc[task.status] = (acc[task.status] || 0) + 1;
    					return acc;
    				},
    				{} as Record<string, number>
    			);
    
    			const completionPercentage =
    				totalTasks > 0 ? ((taskCounts.done || 0) / totalTasks) * 100 : 0;
    
    			// Count subtasks using reduce
    			const subtaskCounts = tasks.reduce(
    				(acc, task) => {
    					task.subtasks?.forEach((st) => {
    						acc.total++;
    						acc[st.status] = (acc[st.status] || 0) + 1;
    					});
    					return acc;
    				},
    				{ total: 0 } as Record<string, number>
    			);
    
    			const subtaskCompletionPercentage =
    				subtaskCounts.total > 0
    					? ((subtaskCounts.done || 0) / subtaskCounts.total) * 100
    					: 0;
    
    			return handleApiResult({
    				result: {
    					success: true,
    					data: {
    						tasks: tasks as Task[],
    						filter: status || 'all',
    						stats: {
    							total: totalTasks,
    							completed: taskCounts.done || 0,
    							inProgress: taskCounts['in-progress'] || 0,
    							pending: taskCounts.pending || 0,
    							blocked: taskCounts.blocked || 0,
    							deferred: taskCounts.deferred || 0,
    							cancelled: taskCounts.cancelled || 0,
    							review: taskCounts.review || 0,
    							completionPercentage,
    							subtasks: {
    								total: subtaskCounts.total,
    								completed: subtaskCounts.done || 0,
    								inProgress: subtaskCounts['in-progress'] || 0,
    								pending: subtaskCounts.pending || 0,
    								blocked: subtaskCounts.blocked || 0,
    								deferred: subtaskCounts.deferred || 0,
    								cancelled: subtaskCounts.cancelled || 0,
    								completionPercentage: subtaskCompletionPercentage
    							}
    						}
    					}
    				},
    				log,
    				projectRoot,
    				tag: result.tag
    			});
    		} catch (error: any) {
    			log.error(`Error in get-tasks: ${error.message}`);
    			if (error.stack) {
    				log.debug(error.stack);
    			}
    			return handleApiResult({
    				result: {
    					success: false,
    					error: {
    						message: `Failed to get tasks: ${error.message}`
    					}
    				},
    				log,
    				projectRoot
    			});
    		}
    	}
    )
  • Zod schema defining input parameters for the get_tasks tool: projectRoot (required), status (optional filter), withSubtasks (optional boolean), tag (optional).
    const GetTasksSchema = z.object({
    	projectRoot: z
    		.string()
    		.describe('The directory of the project. Must be an absolute path.'),
    	status: z
    		.string()
    		.optional()
    		.describe(
    			"Filter tasks by status (e.g., 'pending', 'done') or multiple statuses separated by commas (e.g., 'blocked,deferred')"
    		),
    	withSubtasks: z
    		.boolean()
    		.optional()
    		.describe('Include subtasks nested within their parent tasks in the response'),
    	tag: z.string().optional().describe('Tag context to operate on')
    });
  • Registration function that adds the 'get_tasks' tool to the FastMCP server, specifying name, description, parameters schema, and execute handler.
    export function registerGetTasksTool(server: FastMCP) {
    	server.addTool({
    		name: 'get_tasks',
    		description:
    			'Get all tasks from Task Master, optionally filtering by status and including subtasks.',
    		parameters: GetTasksSchema,
    		execute: withToolContext(
    			'get-tasks',
    			async (args: GetTasksArgs, { log, tmCore }: ToolContext) => {
    				const { projectRoot, status, withSubtasks, tag } = args;
    
    				try {
    					log.info(
    						`Getting tasks from ${projectRoot}${status ? ` with status filter: ${status}` : ''}${tag ? ` for tag: ${tag}` : ''}`
    					);
    
    					// Build filter
    					const filter =
    						status && status !== 'all'
    							? {
    									status: status
    										.split(',')
    										.map((s: string) => s.trim() as TaskStatus)
    								}
    							: undefined;
    
    					// Call tm-core tasks.list()
    					const result = await tmCore.tasks.list({
    						tag,
    						filter,
    						includeSubtasks: withSubtasks
    					});
    
    					log.info(
    						`Retrieved ${result.tasks?.length || 0} tasks (${result.filtered} filtered, ${result.total} total)`
    					);
    
    					// Calculate stats using reduce for cleaner code
    					const tasks = result.tasks ?? [];
    					const totalTasks = result.total;
    					const taskCounts = tasks.reduce(
    						(acc, task) => {
    							acc[task.status] = (acc[task.status] || 0) + 1;
    							return acc;
    						},
    						{} as Record<string, number>
    					);
    
    					const completionPercentage =
    						totalTasks > 0 ? ((taskCounts.done || 0) / totalTasks) * 100 : 0;
    
    					// Count subtasks using reduce
    					const subtaskCounts = tasks.reduce(
    						(acc, task) => {
    							task.subtasks?.forEach((st) => {
    								acc.total++;
    								acc[st.status] = (acc[st.status] || 0) + 1;
    							});
    							return acc;
    						},
    						{ total: 0 } as Record<string, number>
    					);
    
    					const subtaskCompletionPercentage =
    						subtaskCounts.total > 0
    							? ((subtaskCounts.done || 0) / subtaskCounts.total) * 100
    							: 0;
    
    					return handleApiResult({
    						result: {
    							success: true,
    							data: {
    								tasks: tasks as Task[],
    								filter: status || 'all',
    								stats: {
    									total: totalTasks,
    									completed: taskCounts.done || 0,
    									inProgress: taskCounts['in-progress'] || 0,
    									pending: taskCounts.pending || 0,
    									blocked: taskCounts.blocked || 0,
    									deferred: taskCounts.deferred || 0,
    									cancelled: taskCounts.cancelled || 0,
    									review: taskCounts.review || 0,
    									completionPercentage,
    									subtasks: {
    										total: subtaskCounts.total,
    										completed: subtaskCounts.done || 0,
    										inProgress: subtaskCounts['in-progress'] || 0,
    										pending: subtaskCounts.pending || 0,
    										blocked: subtaskCounts.blocked || 0,
    										deferred: subtaskCounts.deferred || 0,
    										cancelled: subtaskCounts.cancelled || 0,
    										completionPercentage: subtaskCompletionPercentage
    									}
    								}
    							}
    						},
    						log,
    						projectRoot,
    						tag: result.tag
    					});
    				} catch (error: any) {
    					log.error(`Error in get-tasks: ${error.message}`);
    					if (error.stack) {
    						log.debug(error.stack);
    					}
    					return handleApiResult({
    						result: {
    							success: false,
    							error: {
    								message: `Failed to get tasks: ${error.message}`
    							}
    						},
    						log,
    						projectRoot
    					});
    				}
    			}
    		)
    	});
    }
  • Tool registry mapping 'get_tasks' to its registration function imported from @tm/mcp.
    get_tasks: registerGetTasksTool,
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 optional filtering and subtask inclusion but lacks critical details: required permissions, whether this is a read-only operation, pagination behavior, rate limits, error conditions, or what the response format looks like. For a tool with 6 parameters and no output schema, this is insufficient.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose ('Get all tasks') and immediately adds key optional features. Every word earns its place with zero redundancy.

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 6 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns, how results are structured, or important behavioral aspects like whether it's safe to call repeatedly. The high parameter count and lack of structured metadata require more descriptive context than provided.

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 fully documents all 6 parameters. The description mentions 'filtering by status' and 'including subtasks' which map to the 'status' and 'withSubtasks' parameters, but adds no additional semantic context beyond what the schema already provides. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('all tasks from Task Master'), specifying optional filtering by status and inclusion of subtasks. It distinguishes from 'get_task' (singular) but doesn't explicitly differentiate from other list-like tools like 'list_tags' or 'models'.

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?

No explicit guidance on when to use this tool versus alternatives is provided. The description mentions optional filtering but doesn't indicate when filtering is appropriate or compare to other task-related tools like 'get_task' (singular) or 'next_task'.

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/eyaltoledano/claude-task-master'

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