getTasksByTaskListId
Retrieve all tasks from a specified task list in Teamwork. Supports pagination and includes completed tasks.
Instructions
Get all tasks from a specific task list in Teamwork
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tasklistId | Yes | The ID of the task list to get tasks from | |
| page | No | Page number for pagination | |
| pageSize | No | Number of items per page | |
| includeCompletedTasks | No | Include completed tasks in the results |
Implementation Reference
- The handler function that executes the tool logic. It makes a GET request to /tasklists/{tasklistId}/tasks.json with optional pagination and filter parameters, then returns the response data as text.
export async function handleGetTasksByTaskListId(input: any) { try { const { tasklistId, page, pageSize, includeCompletedTasks, ...otherParams } = input; logger.info(`Getting tasks for task list ID: ${tasklistId}`); // Build query parameters const queryParams: Record<string, any> = { page, pageSize, includeCompletedTasks, ...otherParams }; // Filter out undefined values Object.keys(queryParams).forEach(key => queryParams[key] === undefined && delete queryParams[key] ); // Make API call const apiClient = getApiClientForVersion(); const response = await apiClient.get( `/tasklists/${tasklistId}/tasks.json`, { params: queryParams } ); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }] }; } catch (error: any) { return createErrorResponse(error, 'Retrieving tasks by task list'); } } - The tool definition and input schema. Defines the tool name as 'getTasksByTaskListId', description, and input properties (tasklistId required, optional page, pageSize, includeCompletedTasks).
export const getTasksByTaskListIdDefinition = { name: "getTasksByTaskListId", description: "Get all tasks from a specific task list in Teamwork", inputSchema: { type: "object", properties: { tasklistId: { type: "integer", description: "The ID of the task list to get tasks from" }, page: { type: "integer", description: "Page number for pagination" }, pageSize: { type: "integer", description: "Number of items per page" }, includeCompletedTasks: { type: "boolean", description: "Include completed tasks in the results" } }, required: ["tasklistId"] }, annotations: { title: "Get Tasks by Task List ID", readOnlyHint: false, destructiveHint: false, openWorldHint: false } }; - src/tools/index.ts:72-72 (registration)Registration of the tool in the toolPairs array, pairing the definition with its handler.
{ definition: getTasksByTaskListId, handler: handleGetTasksByTaskListId }, - src/tools/index.ts:14-14 (registration)Import of the getTasksByTaskListId definition and handler into the tools index.
import { getTasksByTaskListIdDefinition as getTasksByTaskListId, handleGetTasksByTaskListId } from './tasks/getTasksByTaskListId.js'; - src/tools/index.ts:121-121 (registration)Re-export of the handler from the tools index for downstream consumers.
export { handleGetTasksByTaskListId } from './tasks/getTasksByTaskListId.js';