get_tasks
Retrieve tasks from a ClickUp list by specifying the list ID and optional limit to manage and organize task data.
Instructions
Get tasks from a ClickUp list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | ClickUp List ID | |
| limit | No | Number of tasks to retrieve (max 100) |
Implementation Reference
- src/index.ts:139-168 (handler)The async getTasks function implementing the core logic of the 'get_tasks' tool: fetches tasks from ClickUp API for given list_id (limit optional), formats as JSON, handles Axios errors.const getTasks = async (args: any) => { try { const response = await clickupApi.get(`/list/${args.list_id}/task`, { params: { limit: args.limit || 50, }, }); return { content: [ { type: "text", text: JSON.stringify(response.data.tasks, null, 2), }, ], }; } catch (error) { if (axios.isAxiosError(error)) { return { content: [ { type: "text", text: `ClickUp API error: ${error.response?.data?.err ?? error.message}`, }, ], isError: true, }; } throw error; } };
- src/index.ts:28-47 (schema)Schema definition for the 'get_tasks' tool, specifying input parameters list_id (required) and optional limit.get_tasks: { description: "Get tasks from a ClickUp list", inputSchema: { type: "object", properties: { list_id: { type: "string", description: "ClickUp List ID" }, limit: { type: "number", description: "Number of tasks to retrieve (max 100)", default: 50, minimum: 1, maximum: 100 } }, required: ["list_id"] } },
- src/index.ts:279-294 (registration)Registration of tool handlers via setRequestHandler for CallToolRequestSchema, including the switch case dispatching 'get_tasks' calls to the getTasks function.server.setRequestHandler(CallToolRequestSchema, async (request) => { // @ts-ignore const { name, arguments: args } = request.params; switch (name) { case 'get_tasks': return await getTasks(args); case 'create_task': return await createTask(args); case 'update_task': return await updateTask(args); case 'get_task': return await getTask(args); default: throw new Error(`Unknown tool: ${name}`); } });