Skip to main content
Glama

getTasksByProjectId

Retrieve all tasks from a specific Teamwork project by providing the project ID to manage and track project work items.

Instructions

Get all tasks from a specific project in Teamwork

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesThe ID of the project to get tasks from

Implementation Reference

  • The main handler function for the 'getTasksByProjectId' MCP tool. It processes the input, calls the teamwork service to fetch tasks, formats the response as JSON text, and handles errors.
    export async function handleGetTasksByProjectId(input: any) { logger.info('Calling teamworkService.getTasksByProjectId()'); logger.info(`Project ID: ${input?.projectId}`); try { const projectId = String(input?.projectId); if (!projectId) { throw new Error("Project ID is required"); } const tasks = await teamworkService.getTasksByProjectId(projectId); logger.info(`Tasks response received for project ID: ${projectId}`); return { content: [{ type: "text", text: JSON.stringify(tasks, null, 2) }] }; } catch (error: any) { return createErrorResponse(error, 'Retrieving tasks for project'); } }
  • The tool definition including name, description, input schema (requiring projectId as integer), and annotations for the 'getTasksByProjectId' tool.
    export const getTasksByProjectIdDefinition = { name: "getTasksByProjectId", description: "Get all tasks from a specific project in Teamwork", inputSchema: { type: "object", properties: { projectId: { type: "integer", description: "The ID of the project to get tasks from" } }, required: ["projectId"] }, annotations: { title: "Get Tasks by Project ID", readOnlyHint: false, destructiveHint: false, openWorldHint: false } };
  • Registration of the 'getTasksByProjectId' tool in the central toolPairs array, pairing its definition and handler for use in the MCP tools registry. (See also import at line 13 and export at line 118.)
    { definition: getTasksByProjectId, handler: handleGetTasksByProjectId },
  • Supporting service function that performs the actual API call to retrieve tasks for a given project ID from Teamwork, used by the tool handler.
    export const getTasksByProjectId = async (projectId: string) => { try { const api = ensureApiClient(); const response = await api.get(`/projects/${projectId}/tasks.json`); return response.data; } catch (error: any) { logger.error(`Error fetching tasks for project ${projectId}: ${error.message}`); throw new Error(`Failed to fetch tasks 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