get_tasks
Retrieve tasks from a specified ClickUp list, with options to include closed tasks, subtasks, and custom ordering.
Instructions
Get tasks from a ClickUp list. Returns task details including name, description, assignees, and status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | The ID of the list to get tasks from | |
| include_closed | No | Whether to include closed tasks | |
| subtasks | No | Whether to include subtasks in the results | |
| page | No | The page number to get | |
| order_by | No | The field to order by | |
| reverse | No | Whether to reverse the order |
Implementation Reference
- src/tools/task-tools.ts:58-84 (handler)The MCP tool handler for 'get_tasks' - registers the tool with name, description, Zod schema for parameters (list_id, include_closed, subtasks, page, order_by, reverse), and the async handler that calls tasksClient.getTasksFromList() and returns the result as JSON text content.
// Task tools server.tool( 'get_tasks', 'Get tasks from a ClickUp list. Returns task details including name, description, assignees, and status.', { list_id: z.string().describe('The ID of the list to get tasks from'), include_closed: z.boolean().optional().describe('Whether to include closed tasks'), subtasks: z.boolean().optional().describe('Whether to include subtasks in the results'), page: z.number().optional().describe('The page number to get'), order_by: z.string().optional().describe('The field to order by'), reverse: z.boolean().optional().describe('Whether to reverse the order') }, async ({ list_id, ...params }) => { try { const result = await tasksClient.getTasksFromList(list_id, params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error: any) { console.error('Error getting tasks:', error); return { content: [{ type: 'text', text: `Error getting tasks: ${error.message}` }], isError: true }; } } ); - src/clickup-client/tasks.ts:93-112 (schema)The GetTasksParams TypeScript interface defining the input shape for the underlying API call - includes optional filtering fields like page, order_by, reverse, subtasks, statuses, include_closed, assignees, date ranges, and custom_fields.
export interface GetTasksParams { page?: number; order_by?: string; reverse?: boolean; subtasks?: boolean; statuses?: string[]; include_closed?: boolean; assignees?: number[]; due_date_gt?: number; due_date_lt?: number; date_created_gt?: number; date_created_lt?: number; date_updated_gt?: number; date_updated_lt?: number; custom_fields?: Array<{ field_id: string; operator: string; value: any; }>; } - src/tools/task-tools.ts:58-84 (registration)The tool is registered via server.tool('get_tasks', ...) inside setupTaskTools(), which is called from src/index.ts line 42.
// Task tools server.tool( 'get_tasks', 'Get tasks from a ClickUp list. Returns task details including name, description, assignees, and status.', { list_id: z.string().describe('The ID of the list to get tasks from'), include_closed: z.boolean().optional().describe('Whether to include closed tasks'), subtasks: z.boolean().optional().describe('Whether to include subtasks in the results'), page: z.number().optional().describe('The page number to get'), order_by: z.string().optional().describe('The field to order by'), reverse: z.boolean().optional().describe('Whether to reverse the order') }, async ({ list_id, ...params }) => { try { const result = await tasksClient.getTasksFromList(list_id, params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error: any) { console.error('Error getting tasks:', error); return { content: [{ type: 'text', text: `Error getting tasks: ${error.message}` }], isError: true }; } } ); - src/clickup-client/tasks.ts:127-129 (helper)The getTasksFromList method on TasksClient - the underlying API helper that performs a GET request to /list/{listId}/task with optional query parameters.
async getTasksFromList(listId: string, params?: GetTasksParams): Promise<{ tasks: Task[] }> { return this.client.get(`/list/${listId}/task`, params); }