Skip to main content
Glama

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';

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