add_task_to_list
Add an existing task to a specified ClickUp list using task ID and list ID.
Instructions
Add an existing task to a ClickUp list.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | The ID of the list to add the task to | |
| task_id | Yes | The ID of the task to add |
Implementation Reference
- src/tools/task-tools.ts:428-441 (handler)The handler function for the 'add_task_to_list' tool. It takes list_id and task_id, calls listsClient.addTaskToList(), and returns the result as JSON text.
async ({ list_id, task_id }) => { try { const result = await listsClient.addTaskToList(list_id, task_id); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error: any) { console.error('Error adding task to list:', error); return { content: [{ type: 'text', text: `Error adding task to list: ${error.message}` }], isError: true }; } } - src/tools/task-tools.ts:423-427 (schema)The Zod schema defining the input parameters for 'add_task_to_list': list_id (string) and task_id (string), both required.
'Add an existing task to a ClickUp list.', { list_id: z.string().describe('The ID of the list to add the task to'), task_id: z.string().describe('The ID of the task to add') }, - src/tools/task-tools.ts:421-442 (registration)Tool registration using server.tool() to register 'add_task_to_list' with description, schema, and handler.
server.tool( 'add_task_to_list', 'Add an existing task to a ClickUp list.', { list_id: z.string().describe('The ID of the list to add the task to'), task_id: z.string().describe('The ID of the task to add') }, async ({ list_id, task_id }) => { try { const result = await listsClient.addTaskToList(list_id, task_id); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error: any) { console.error('Error adding task to list:', error); return { content: [{ type: 'text', text: `Error adding task to list: ${error.message}` }], isError: true }; } } ); - src/clickup-client/lists.ts:104-106 (helper)The ListsClient.addTaskToList() method that makes the HTTP POST call to /list/{listId}/task/{taskId} on the ClickUp API.
async addTaskToList(listId: string, taskId: string): Promise<{ success: boolean }> { return this.client.post(`/list/${listId}/task/${taskId}`); } - src/index.ts:40-47 (registration)The top-level setupTools() method that calls setupTaskTools(server), which registers all task tools including 'add_task_to_list'.
private setupTools() { // Set up all tools setupTaskTools(this.server); setupDocTools(this.server); setupSpaceTools(this.server); setupChecklistTools(this.server); setupCommentTools(this.server); }