Skip to main content
Glama

getTaskComments

Retrieve and filter comments for a specific task in Teamwork projects to track discussions and updates.

Instructions

Get comments for a specific task from Teamwork

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesThe ID of the task to retrieve comments for
pageNoPage number for pagination
pageSizeNoNumber of items per page
orderByNoOrder by field
orderModeNoOrder mode
searchTermNoFilter by comment content
updatedAfterNoFilter by updated after date (ISO 8601 format)
commentStatusNoFilter by comment status

Implementation Reference

  • The handler function that executes the 'getTaskComments' tool logic. Processes input, calls the teamwork service, formats response or error.
    export async function handleGetTaskComments(input: any) { logger.info('Calling teamworkService.getTaskComments()'); logger.info(`Task ID: ${input?.taskId}`); try { const taskId = String(input?.taskId); if (!taskId) { throw new Error("Task ID is required"); } // Extract optional parameters const options: Record<string, any> = {}; if (input.page) options.page = input.page; if (input.pageSize) options.pageSize = input.pageSize; if (input.orderBy) options.orderBy = input.orderBy; if (input.orderMode) options.orderMode = input.orderMode; if (input.searchTerm) options.searchTerm = input.searchTerm; if (input.updatedAfter) options.updatedAfter = input.updatedAfter; if (input.commentStatus) options.commentStatus = input.commentStatus; const comments = await teamworkService.getTaskComments(taskId, options); return { content: [{ type: "text", text: JSON.stringify(comments, null, 2) }] }; } catch (error: any) { return createErrorResponse(error, 'Retrieving task comments'); } }
  • Input schema, description, and annotations defining the 'getTaskComments' tool interface.
    export const getTaskCommentsDefinition = { name: "getTaskComments", description: "Get comments for a specific task from Teamwork", inputSchema: { type: "object", properties: { taskId: { type: "integer", description: "The ID of the task to retrieve comments for" }, page: { type: "integer", description: "Page number for pagination" }, pageSize: { type: "integer", description: "Number of items per page" }, orderBy: { type: "string", description: "Order by field", enum: ["all", "date", "project", "user", "type"] }, orderMode: { type: "string", description: "Order mode", enum: ["asc", "desc"] }, searchTerm: { type: "string", description: "Filter by comment content" }, updatedAfter: { type: "string", description: "Filter by updated after date (ISO 8601 format)" }, commentStatus: { type: "string", description: "Filter by comment status", enum: ["all", "read", "unread"] } }, required: ["taskId"] }, annotations: { title: "Get Task Comments", readOnlyHint: false, destructiveHint: false, openWorldHint: false } };
  • Registration of the 'getTaskComments' tool in the toolPairs array, linking definition and handler.
    { definition: getTaskComments, handler: handleGetTaskComments },
  • Helper service function that performs the actual API request to fetch task comments from Teamwork.
    export const getTaskComments = async (taskId: string, options: any = {}) => { try { const api = ensureApiClient(); const response = await api.get(`/tasks/${taskId}/comments.json`, { params: options }); return response.data; } catch (error: any) { logger.error(`Error fetching comments for task ${taskId}: ${error.message}`); throw new Error(`Failed to fetch comments for task ${taskId}`); } };

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