Skip to main content
Glama

getTaskListsByProjectId

Retrieve all task lists for a specific project in Teamwork to organize and track project tasks effectively.

Instructions

Get all task lists by project ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesThe ID of the project to get task lists from

Implementation Reference

  • The main MCP tool handler function. Validates projectId from input, calls the teamwork service to fetch task lists, formats the response as text content, and handles errors.
    export async function handleGetTaskListsByProjectId(input: any) { logger.info('Calling teamworkService.getTaskListsByProjectId()'); logger.info(`Project ID: ${input?.projectId}`); try { const projectId = input?.projectId; if (!projectId) { throw new Error("Project ID is required"); } const taskLists = await teamworkService.getTaskListsByProjectId(projectId); logger.info(`Task lists response received for project ID: ${projectId}`); if (taskLists) { return { content: [{ type: "text", text: JSON.stringify(taskLists, null, 2) }] }; } else { return { content: [{ type: "text", text: `Error getting task lists for project ID: ${projectId}` }] }; } } catch (error: any) { return createErrorResponse(error, 'Retrieving task lists'); } }
  • The tool schema definition, including name, description, input schema requiring projectId (integer), and annotations.
    export const getTaskListsByProjectIdDefinition = { name: "getTaskListsByProjectId", description: "Get all task lists by project ID", inputSchema: { type: "object", properties: { projectId: { type: "integer", description: "The ID of the project to get task lists from" } }, required: ["projectId"] }, annotations: { title: "Get Task Lists by Project ID", readOnlyHint: false, destructiveHint: false, openWorldHint: false } };
  • Registration of the tool in the toolPairs array, pairing the definition with its handler function.
    { definition: getTaskListsByProjectId, handler: handleGetTaskListsByProjectId },
  • Import statement bringing in the tool definition (aliased) and handler from the specific tool file.
    import { getTaskListsByProjectIdDefinition as getTaskListsByProjectId, handleGetTaskListsByProjectId } from './tasks/getTaskListsByProjectId.js';
  • Supporting service function called by the handler. Performs the actual API request to Teamwork to retrieve task lists for the given project ID.
    export const getTaskListsByProjectId = async (projectId: number) => { try { const api = ensureApiClient(); const response = await api.get(`/projects/${projectId}/tasklists.json`); return response.data; } catch (error: any) { logger.error(`Error fetching task lists for project ${projectId}: ${error.message}`); throw new Error(`Failed to fetch task lists for project ${projectId}`); } };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Vizioz/Teamwork-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server