Skip to main content
Glama

linear_createComment

Add comments to Linear issues to provide updates, ask questions, or reply in threads for better team collaboration.

Instructions

Add a comment to an issue in Linear (supports threaded replies)

Input Schema

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

Implementation Reference

  • The handler function that implements the core logic for the linear_createComment tool. It performs input validation and calls the Linear service to create the comment.
    /**
     * Handler for creating a 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;
        }
      };
    }
  • The MCP tool definition for linear_createComment, including input and output schemas.
    export const createCommentToolDefinition: MCPToolDefinition = {
      name: 'linear_createComment',
      description: 'Add a comment to an issue in Linear (supports threaded replies)',
      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)',
          },
          parentId: {
            type: 'string',
            description: 'ID of the parent comment to reply to (for threaded comments)',
          },
        },
        required: ['issueId', 'body'],
      },
      output_schema: {
        type: 'object',
        properties: {
          id: { type: 'string' },
          body: { type: 'string' },
          url: { type: 'string' },
          parentId: { type: 'string' },
        },
      },
    };
  • The registration of the linear_createComment handler within the tool handlers registry function.
    export function registerToolHandlers(linearService: LinearService) {
      return {
        // User tools
        linear_getViewer: handleGetViewer(linearService),
        linear_getOrganization: handleGetOrganization(linearService),
        linear_getUsers: handleGetUsers(linearService),
        linear_getLabels: handleGetLabels(linearService),
    
        // Team tools
        linear_getTeams: handleGetTeams(linearService),
        linear_getWorkflowStates: handleGetWorkflowStates(linearService),
    
        // Project tools
        linear_getProjects: handleGetProjects(linearService),
        linear_createProject: handleCreateProject(linearService),
    
        // Project Management tools
        linear_updateProject: handleUpdateProject(linearService),
        linear_addIssueToProject: handleAddIssueToProject(linearService),
        linear_getProjectIssues: handleGetProjectIssues(linearService),
    
        // Cycle Management tools
        linear_getCycles: handleGetCycles(linearService),
        linear_getActiveCycle: handleGetActiveCycle(linearService),
        linear_addIssueToCycle: handleAddIssueToCycle(linearService),
    
        // Initiative Management tools
        linear_getInitiatives: getInitiativesHandler(linearService),
        linear_getInitiativeById: getInitiativeByIdHandler(linearService),
        linear_createInitiative: createInitiativeHandler(linearService),
        linear_updateInitiative: updateInitiativeHandler(linearService),
        linear_archiveInitiative: archiveInitiativeHandler(linearService),
        linear_unarchiveInitiative: unarchiveInitiativeHandler(linearService),
        linear_deleteInitiative: deleteInitiativeHandler(linearService),
        linear_getInitiativeProjects: getInitiativeProjectsHandler(linearService),
        linear_addProjectToInitiative: addProjectToInitiativeHandler(linearService),
        linear_removeProjectFromInitiative: removeProjectFromInitiativeHandler(linearService),
    
        // Issue tools
        linear_getIssues: handleGetIssues(linearService),
        linear_getIssueById: handleGetIssueById(linearService),
        linear_searchIssues: handleSearchIssues(linearService),
        linear_createIssue: handleCreateIssue(linearService),
        linear_updateIssue: handleUpdateIssue(linearService),
        linear_createComment: handleCreateComment(linearService),
        linear_addIssueLabel: handleAddIssueLabel(linearService),
        linear_removeIssueLabel: handleRemoveIssueLabel(linearService),
    
        // New Issue Management tools
        linear_assignIssue: handleAssignIssue(linearService),
        linear_subscribeToIssue: handleSubscribeToIssue(linearService),
        linear_convertIssueToSubtask: handleConvertIssueToSubtask(linearService),
        linear_createIssueRelation: handleCreateIssueRelation(linearService),
        linear_archiveIssue: handleArchiveIssue(linearService),
        linear_setIssuePriority: handleSetIssuePriority(linearService),
        linear_transferIssue: handleTransferIssue(linearService),
        linear_duplicateIssue: handleDuplicateIssue(linearService),
        linear_getIssueHistory: handleGetIssueHistory(linearService),
    
        // Comment Management tools
        linear_getComments: handleGetComments(linearService),
      };
    }
  • Type guard function used by the handler to validate input arguments for linear_createComment.
    /**
     * Type guard for linear_createComment tool arguments
     */
    export function isCreateCommentArgs(args: unknown): args is {
      issueId: string;
      body: string;
      parentId?: 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' &&
        (!('parentId' in args) || typeof (args as { parentId: string }).parentId === '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/tacticlaunch/mcp-linear'

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