getTasksByTaskListId
Retrieve all tasks from a specific task list in Teamwork projects, with options for pagination and including completed items.
Instructions
Get all tasks from a specific task list in Teamwork
Input Schema
TableJSON 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: fetches tasks from the specified tasklist ID via API, supports pagination and filters, returns JSON response or error.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'); } }
- Tool definition object containing the name, description, input schema (with tasklistId required, optional pagination and filters), and annotations.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)Registers the tool in the toolPairs array, mapping definition to handler for inclusion in toolDefinitions and toolHandlersMap.{ definition: getTasksByTaskListId, handler: handleGetTasksByTaskListId },