Skip to main content
Glama

createComment

Add comments to tasks, milestones, notebooks, links, or fileversions in Teamwork. Specify the resource, comment body, and optional notifications or privacy settings.

Instructions

Creates a new comment for a specific resource (tasks, milestones, notebooks, links, fileversions) in Teamwork

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resourceYesThe resource type (tasks, milestones, notebooks, links, fileversions)
resourceIdYesThe ID of the resource to add a comment to
bodyYesThe content of the comment
notifyNoWho to notify ('all' to notify all project users, 'true' to notify followers, specific user IDs, or empty for no notification)
isPrivateNoWhether the comment should be private
pendingFileAttachmentsNoComma-separated list of pending file references to attach to the comment
contentTypeNoContent type of the comment (html or plain text)plaintext
authorIdNoID of the user to post as (only for admins)

Implementation Reference

  • The handler function `handleCreateComment` that executes the createComment tool logic. It extracts input fields (resource, resourceId, body, notify, isPrivate, pendingFileAttachments, contentType, authorId), builds commentData, and calls the service layer.
    export async function handleCreateComment(input: any) {
      logger.info('Calling teamworkService.createComment()');
      logger.info(`Resource: ${input?.resource}, Resource ID: ${input?.resourceId}`);
      
      try {
        const resource = input.resource;
        const resourceId = input.resourceId;
        const commentData: any = {};
        
        // Set required fields
        commentData.body = input.body;
        
        // Set optional fields if provided
        if (input.notify !== undefined) commentData.notify = input.notify;
        if (input.isPrivate !== undefined) commentData['isprivate'] = input.isPrivate;
        if (input.pendingFileAttachments) commentData.pendingFileAttachments = input.pendingFileAttachments;
        if (input.contentType === 'html') commentData['content-type'] = 'html';
        if (input.authorId) commentData['author-id'] = input.authorId;
        
        const result = await teamworkService.createComment(resource, resourceId, commentData);
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify(result, null, 2)
          }]
        };
      } catch (error: any) {
        return createErrorResponse(error, 'Creating comment');
      }
    } 
  • The tool definition `createCommentDefinition` containing the name, description, inputSchema (with fields: resource, resourceId, body, notify, isPrivate, pendingFileAttachments, contentType, authorId), and annotations.
    export const createCommentDefinition = {
      name: "createComment",
      description: "Creates a new comment for a specific resource (tasks, milestones, notebooks, links, fileversions) in Teamwork",
      inputSchema: {
        type: "object",
        properties: {
          resource: {
            type: "string",
            description: "The resource type (tasks, milestones, notebooks, links, fileversions)",
            enum: ["tasks", "milestones", "notebooks", "links", "fileversions"]
          },
          resourceId: {
            type: "string",
            description: "The ID of the resource to add a comment to"
          },
          body: {
            type: "string",
            description: "The content of the comment"
          },
          notify: {
            type: "string",
            description: "Who to notify ('all' to notify all project users, 'true' to notify followers, specific user IDs, or empty for no notification)",
            default: ""
          },
          isPrivate: {
            type: "boolean",
            description: "Whether the comment should be private",
            default: false
          },
          pendingFileAttachments: {
            type: "string",
            description: "Comma-separated list of pending file references to attach to the comment"
          },
          contentType: {
            type: "string",
            description: "Content type of the comment (html or plain text)",
            enum: ["html", "plaintext"],
            default: "plaintext"
          },
          authorId: {
            type: "string",
            description: "ID of the user to post as (only for admins)"
          }
        },
        required: ["resource", "resourceId", "body"]
      },
      annotations: {
        title: "Create Comment",
        readOnlyHint: false,
        destructiveHint: false,
        openWorldHint: false
      }
    };
  • The service layer function `createComment` that performs the actual API call to Teamwork's v1 endpoint POST /{resource}/{resourceId}/comments.json with the comment payload.
    export const createComment = async (resource: string, resourceId: string, commentData: any) => {
      try {
        // Validate resource type
        const validResources = ['tasks', 'milestones', 'notebooks', 'links', 'fileversions'];
        if (!validResources.includes(resource)) {
          throw new Error(`Invalid resource type. Must be one of: ${validResources.join(', ')}`);
        }
        
        // For API v1, we need the proper client
        const api = getApiClientForVersion('v1');
        
        // We're using the v1 API which has a different format for the request
        const payload = {
          comment: commentData
        };
        
        // The API v1 endpoint doesn't include the base path
        const response = await api.post(`/${resource}/${resourceId}/comments.json`, payload);
        
        return response.data;
      } catch (error: any) {
        logger.error(`Error creating comment for ${resource}/${resourceId}: ${error.message}`);
        throw new Error(`Failed to create comment for ${resource}/${resourceId}: ${error.message}`);
      }
    };
  • Import of createCommentDefinition (aliased as createComment) and handleCreateComment from the tool file into the tools index.
    import { createCommentDefinition as createComment, handleCreateComment } from './comments/createComment.js';
  • Registration of the createComment tool pair (definition + handler) in the toolPairs array for the MCP server.
    { definition: createComment, handler: handleCreateComment },
Behavior2/5

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

Annotations already indicate readOnlyHint=false and destructiveHint=false, so the description adds no behavioral context beyond what the schema provides. It does not explain side effects like whether the comment is posted immediately, if notifications trigger, or what happens on failure.

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 sentence with no wasted words, making it highly concise. It successfully conveys the core function without unnecessary elaboration.

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

Completeness2/5

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

Despite having 8 parameters and no output schema, the description provides minimal context. It fails to explain the comment creation workflow, what the response contains, or how the notify/isPrivate parameters affect behavior. A richer description would improve completeness.

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?

Input schema has 100% description coverage, so each parameter is already documented. The description does not add any meaning beyond the schema; it merely repeats the verb 'creates a comment'.

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

Purpose5/5

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

The description states it creates a comment and lists the specific resource types (tasks, milestones, notebooks, links, fileversions). This clearly distinguishes it from sibling tools like createTask or createProject which create different entities.

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

Usage Guidelines3/5

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

The description implies use for adding comments to resources, but it does not explicitly state when to use this tool versus alternatives like updateTask or getTaskComments. No exclusion criteria or alternatives are mentioned.

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