Skip to main content
Glama
magarcia

Linear MCP Server

linear_add_comment

Add comments to Linear issues to provide updates, context, or feedback using markdown formatting for clear communication within the issue tracking system.

Instructions

Add a comment to a Linear issue

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYesComment text (markdown supported)
createAsUserNoCustom username for the comment creator
displayIconUrlNoCustom avatar URL for the comment creator
issueIdYesIssue ID to comment on

Implementation Reference

  • The main handler function that executes the tool logic: validates input parameters (issueId and body required), fetches the issue to verify existence, prepares input for Linear API, creates the comment, handles errors, and returns a JSON response with comment details or error.
    export const linearAddCommentHandler: ToolHandler = async args => {
      const params = args as {
        issueId: string;
        body: string;
        createAsUser?: string;
        displayIconUrl?: string;
      };
    
      try {
        // Validate required parameters
        if (!params.issueId) {
          return {
            content: [
              {
                type: 'text',
                text: 'Error: Issue ID is required',
              },
            ],
            isError: true,
          };
        }
    
        if (!params.body) {
          return {
            content: [
              {
                type: 'text',
                text: 'Error: Comment body is required',
              },
            ],
            isError: true,
          };
        }
    
        // Get the issue to validate it exists
        const issue = await linearClient.issue(params.issueId);
        if (!issue) {
          return {
            content: [
              {
                type: 'text',
                text: `Error: Issue with ID ${params.issueId} not found`,
              },
            ],
            isError: true,
          };
        }
    
        // Set up input parameters for comment creation
        const input: {
          issueId: string;
          body: string;
          [key: string]: unknown;
        } = {
          issueId: params.issueId,
          body: params.body,
        };
    
        // Add optional parameters if present
        if (params.createAsUser) input.createAsUser = params.createAsUser;
        if (params.displayIconUrl) input.displayIconUrl = params.displayIconUrl;
    
        // Create the comment using the Linear API
        const commentPayload = await linearClient.createComment(input);
    
        if (!commentPayload.success || !commentPayload.comment) {
          return {
            content: [
              {
                type: 'text',
                text: 'Error: Failed to create comment',
              },
            ],
            isError: true,
          };
        }
    
        // Extract data for response
        const responseData = {
          body: params.body,
          url: await issue.url,
          createdAt: new Date().toISOString(),
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(responseData),
            },
          ],
        };
      } catch (error) {
        const errorMessage =
          error instanceof Error
            ? error.message
            : typeof error === 'string'
              ? error
              : 'Unknown error occurred';
    
        return {
          content: [
            {
              type: 'text',
              text: `Error: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
    };
  • Registers the 'linear_add_comment' tool using registerTool, providing name, description, inputSchema, and linking to the linearAddCommentHandler.
    export const linearAddCommentTool = registerTool(
      {
        name: 'linear_add_comment',
        description: 'Add a comment to a Linear issue',
        inputSchema: {
          type: 'object',
          properties: {
            issueId: {
              type: 'string',
              description: 'Issue ID to comment on',
            },
            body: {
              type: 'string',
              description: 'Comment text (markdown supported)',
            },
            createAsUser: {
              type: 'string',
              description: 'Custom username for the comment creator',
            },
            displayIconUrl: {
              type: 'string',
              description: 'Custom avatar URL for the comment creator',
            },
          },
          required: ['issueId', 'body'],
        },
      },
      linearAddCommentHandler
    );
  • Defines the input schema for the tool, specifying properties for issueId (required string), body (required string), and optional createAsUser and displayIconUrl strings.
    inputSchema: {
      type: 'object',
      properties: {
        issueId: {
          type: 'string',
          description: 'Issue ID to comment on',
        },
        body: {
          type: 'string',
          description: 'Comment text (markdown supported)',
        },
        createAsUser: {
          type: 'string',
          description: 'Custom username for the comment creator',
        },
        displayIconUrl: {
          type: 'string',
          description: 'Custom avatar URL for the comment creator',
        },
      },
      required: ['issueId', 'body'],
    },
  • src/tools/index.ts:6-6 (registration)
    Imports the linear_add_comment module to ensure the tool registration is executed when the tools index is loaded.
    import './linear_add_comment.js';
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Add a comment') but doesn't describe what happens—whether this creates a permanent record, requires specific permissions, supports notifications, or has rate limits. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding the tool's behavior and implications.

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, efficient sentence that front-loads the core purpose with zero wasted words. It directly answers 'what does this tool do?' without unnecessary elaboration, making it easy for an agent to parse quickly.

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 4 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects like permissions, side effects, or response format, leaving the agent with insufficient context to use the tool effectively beyond basic parameter passing.

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%, so the schema fully documents all four parameters (issueId, body, createAsUser, displayIconUrl). The description adds no parameter-specific information beyond what's in the schema, such as examples or constraints. This meets the baseline of 3, as the schema handles the heavy lifting, but the description doesn't enhance parameter understanding.

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 action ('Add a comment') and target resource ('to a Linear issue'), making the purpose immediately understandable. It distinguishes from siblings like linear_create_issue or linear_update_issue by focusing specifically on commenting. However, it doesn't explicitly differentiate from hypothetical similar tools like linear_update_comment (if it existed), keeping it at 4 rather than 5.

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 issue), exclusions, or comparisons to sibling tools like linear_update_issue (which might also allow commenting). The agent must infer usage from the tool name and schema alone.

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/magarcia/mcp-server-linearapp'

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