Skip to main content
Glama
zalab-inc
by zalab-inc

update_comment

Modify or remove an existing comment on a Linear issue by providing the comment ID and new content or setting the delete flag.

Instructions

A tool that updates or deletes an existing comment on an issue in Linear

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commentNoThe new content for the comment
commentIdYesThe ID of the comment to update
deleteNoWhether to delete the comment

Implementation Reference

  • The async handler function that implements the core logic of the 'update_comment' tool, including validation, update/delete operations via Linear client, error handling, and response formatting.
    handler: async (args: z.infer<typeof updateCommentSchema>) => {
      try {
        // Validate input
        if (!args.commentId || args.commentId.trim() === "") {
          return {
            content: [{
              type: "text",
              text: "Error: Comment ID cannot be empty",
            }],
          };
        }
        
        // Handle delete operation if delete flag is true
        if (args.delete === true) {
          // Delete the comment
          const deleteCommentResponse = await linearClient.deleteComment(args.commentId);
          
          if (!deleteCommentResponse) {
            return {
              content: [{
                type: "text",
                text: "Failed to delete comment. Please check the comment ID and try again.",
              }],
            };
          }
          
          // Check if the delete operation was successful
          const deleteResponse = deleteCommentResponse as unknown as LinearDeleteResponse;
          
          if (deleteResponse.success === false) {
            return {
              content: [{
                type: "text",
                text: "Failed to delete comment. Please check the comment ID and try again.",
              }],
            };
          }
          
          // Return success message for deletion
          return {
            content: [{
              type: "text",
              text: `Status: Success\nMessage: Linear comment deleted\nComment ID: ${args.commentId}`,
            }],
          };
        }
        
        // For update operations, comment content is required
        if (!args.comment || args.comment.trim() === "") {
          return {
            content: [{
              type: "text",
              text: "Error: Comment content cannot be empty for update operations",
            }],
          };
        }
        
        // Update the comment
        const updateCommentResponse = await linearClient.updateComment(args.commentId, {
          body: args.comment,
        });
        
        if (!updateCommentResponse) {
          return {
            content: [{
              type: "text",
              text: "Failed to update comment. Please check the comment ID and try again.",
            }],
          };
        }
        
        // Mendapatkan ID komentar dari respons
        // Linear SDK mengembalikan hasil dalam pola success dan entity
        if (updateCommentResponse.success) {
          // Mengakses komentar dan mendapatkan ID dengan tipe data yang benar
          const comment = await updateCommentResponse.comment;
          if (comment && comment.id) {
            return {
              content: [{
                type: "text",
                text: `Status: Success\nMessage: Linear comment updated\nComment ID: ${comment.id}`,
              }],
            };
          }
        }
        
        // Extract data from response to check for success
        const commentResponse = updateCommentResponse as unknown as LinearCommentResponse;
        
        // If the response indicates failure, return an error
        if (commentResponse.success === false) {
          return {
            content: [{
              type: "text",
              text: "Failed to update comment. Please check the comment ID and try again.",
            }],
          };
        }
        
        // Extract comment data from the correct property
        const commentData: CommentResponseData = commentResponse.comment || updateCommentResponse as unknown as CommentResponseData;
        
        // Langsung cek hasil respons yang telah diparsing
        const commentId = commentData?.id || (updateCommentResponse as unknown as { id?: string })?.id;
        if (commentId) {
          return {
            content: [{
              type: "text",
              text: `Status: Success\nMessage: Linear comment updated\nComment ID: ${commentId}`,
            }],
          };
        }
        
        if (!commentData) {
          // Tampilkan pesan sukses meski data tidak lengkap
          return {
            content: [{
              type: "text",
              text: "Status: Success\nMessage: Linear comment updated",
            }],
          };
        }
        
        if (!commentData.id) {
          // Data komentar ada tapi tidak ada ID
          return {
            content: [{
              type: "text",
              text: "Status: Success\nMessage: Linear comment updated (ID not available)",
            }],
          };
        }
        
        // Kasus sukses dengan ID tersedia
        return {
          content: [{
            type: "text",
            text: `Status: Success\nMessage: Linear comment updated\nComment ID: ${commentData.id}`,
          }],
        };
      } catch (error) {
        // Handle errors gracefully
        const errorMessage = error instanceof Error ? error.message : "Unknown error";
        return {
          content: [{
            type: "text",
            text: `An error occurred while updating or deleting the comment:\n${errorMessage}`,
          }],
        };
      }
    }
  • Zod schema defining the input schema for the 'update_comment' tool: commentId (required), comment (optional for update), delete (optional boolean).
    const updateCommentSchema = z.object({
      commentId: z.string().describe("The ID of the comment to update"),
      comment: z.string().describe("The new content for the comment").optional(),
      delete: z.boolean().describe("Whether to delete the comment").optional().default(false),
    });
  • src/index.ts:31-41 (registration)
    Registration of the LinearUpdateCommentTool (which has name: 'update_comment') along with other tools in the MCP server using registerTool.
    registerTool(server, [
      LinearSearchIssuesTool,
      LinearGetProfileTool,
      LinearCreateIssueTool,
      LinearCreateCommentTool,
      LinearUpdateCommentTool,
      LinearGetIssueTool,
      LinearGetTeamIdTool,
      LinearUpdateIssueTool,
      LinearGetCommentTool,
    ]);
  • Re-export of LinearUpdateCommentTool from its implementation file, making it available for import in src/index.ts.
    export { 
      LinearGetProfileTool, 
      LinearSearchIssuesTool,
      LinearCreateIssueTool,
      LinearUpdateIssueTool,
      LinearCreateCommentTool,
      LinearUpdateCommentTool,
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it states the tool can update or delete a comment, it lacks critical details: it doesn't specify permissions required, whether updates are reversible, rate limits, error conditions (e.g., invalid commentId), or what happens on deletion (e.g., permanent vs. soft delete). For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the core purpose. It avoids redundancy and wastes no words, though it could be slightly more structured (e.g., by separating update and delete scenarios). Every part of the sentence earns its place by conveying essential information.

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?

Given the tool's complexity (a mutation operation with three parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like permissions, side effects, or error handling, nor does it explain return values. For a tool that modifies or deletes data, this leaves the agent with insufficient context to use it safely and effectively.

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?

Schema description coverage is 100%, with all three parameters (commentId, comment, delete) well-documented in the schema. The description adds no additional parameter semantics beyond what the schema provides—it doesn't explain parameter interactions (e.g., how 'delete' overrides 'comment'), formats, or constraints. Baseline 3 is appropriate since the schema does the heavy lifting.

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 tool's purpose: 'updates or deletes an existing comment on an issue in Linear'. It specifies the verb (update/delete), resource (comment), and context (issue in Linear), which is specific and actionable. However, it doesn't explicitly distinguish this tool from its sibling 'create_comment', which handles comment creation rather than modification/deletion.

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. It doesn't mention prerequisites (e.g., needing an existing comment ID), when not to use it (e.g., for creating new comments), or refer to sibling tools like 'create_comment' or 'get_comment'. Usage is implied by the purpose statement but not explicitly articulated.

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/zalab-inc/mcp-linear-app'

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