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}`);
      }
    };
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate readOnlyHint=false, destructiveHint=false, and openWorldHint=false, which already communicate that this is a non-destructive, non-read-only operation with closed-world behavior. The description adds no behavioral context beyond this, such as rate limits, authentication needs, or pagination details, but doesn't contradict the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently states the tool's purpose without any unnecessary words. It's front-loaded with the core functionality and wastes no space on redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the 8 parameters with full schema coverage and annotations covering safety aspects, the description is minimally adequate. However, without an output schema and with no guidance on usage or behavioral nuances, it leaves gaps in helping an agent fully understand how to leverage this tool effectively in context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, all 8 parameters are documented in the schema. The description provides no additional parameter information beyond what's in the schema, so it meets the baseline of 3 where the schema does the heavy lifting without adding extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and resource 'comments for a specific task from Teamwork', making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'getTaskById' or 'createComment', but the specificity is adequate for understanding its function.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'getTaskById' (which might include comments) and 'createComment' (for adding comments), there's no indication of how this tool fits into the workflow or when it's the appropriate choice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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