Skip to main content
Glama
wkoutre

Linear MCP Server

by wkoutre

linear_createComment

Add comments to Linear issues to provide updates, share information, or ask questions, using Markdown formatting for clarity.

Instructions

Add a comment to an issue in Linear

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueIdYesID or identifier of the issue to comment on (e.g., ABC-123)
bodyYesText of the comment (Markdown supported)

Implementation Reference

  • The handler function that implements the core logic for the linear_createComment tool. It validates the input arguments using the isCreateCommentArgs type guard and calls the LinearService to create the comment.
    export function handleCreateComment(linearService: LinearService) {
      return async (args: unknown) => {
        try {
          if (!isCreateCommentArgs(args)) {
            throw new Error("Invalid arguments for createComment");
          }
          
          return await linearService.createComment(args);
        } catch (error) {
          logError("Error creating comment", error);
          throw error;
        }
      };
    }
  • Defines the tool schema for linear_createComment, specifying input (issueId, body) and output structure.
    export const createCommentToolDefinition: MCPToolDefinition = {
      name: "linear_createComment",
      description: "Add a comment to an issue in Linear",
      input_schema: {
        type: "object",
        properties: {
          issueId: {
            type: "string",
            description: "ID or identifier of the issue to comment on (e.g., ABC-123)",
          },
          body: {
            type: "string",
            description: "Text of the comment (Markdown supported)",
          },
        },
        required: ["issueId", "body"],
      },
      output_schema: {
        type: "object",
        properties: {
          id: { type: "string" },
          body: { type: "string" },
          url: { type: "string" }
        }
      }
    };
  • Registers the linear_createComment tool in the handlers map by associating it with the handleCreateComment function curried with linearService.
    linear_createComment: handleCreateComment(linearService),
  • Type guard function used by the handler to validate input arguments for the linear_createComment tool.
     * Type guard for linear_createComment tool arguments
     */
    export function isCreateCommentArgs(args: unknown): args is {
      issueId: string;
      body: string;
    } {
      return (
        typeof args === "object" &&
        args !== null &&
        "issueId" in args &&
        typeof (args as { issueId: string }).issueId === "string" &&
        "body" in args &&
        typeof (args as { body: string }).body === "string"
      );
    }

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/wkoutre/linear-mcp-server'

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