getTasksByTaskListId
Retrieve all tasks from a specific task list ID in Teamwork, with options for pagination and including completed tasks, using the Teamwork MCP server.
Instructions
Get all tasks from a specific task list in Teamwork
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeCompletedTasks | No | Include completed tasks in the results | |
| page | No | Page number for pagination | |
| pageSize | No | Number of items per page | |
| tasklistId | Yes | The ID of the task list to get tasks from |
Implementation Reference
- The main handler function that executes the tool logic: extracts input parameters, builds query params, calls the Teamwork API to get tasks from the specified tasklist, and returns the 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) { logger.error(`Error in getTasksByTaskListId handler: ${error.message}`); return { content: [{ type: "text", text: `Error: ${error.message}` }] }; } }
- The tool's definition object, including name, description, input schema for parameters like tasklistId, page, etc., 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)The tool is registered in the central toolPairs array in index.ts, which is used to build toolDefinitions and toolHandlersMap for the MCP server.{ definition: getTasksByTaskListId, handler: handleGetTasksByTaskListId },