linear_createComment
Add comments to Linear issues by specifying the issue ID and comment text. Supports Markdown formatting for clear, structured communication in project management tasks.
Instructions
Add a comment to an issue in Linear
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | Text of the comment (Markdown supported) | |
| issueId | Yes | ID or identifier of the issue to comment on (e.g., ABC-123) |
Implementation Reference
- The main handler function for the linear_createComment tool. It validates the input arguments using the isCreateCommentArgs type guard and delegates to linearService.createComment(args) to perform the actual API call.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 MCPToolDefinition object defining the input schema (issueId, body, optional parentId), output schema, name, and description for the linear_createComment tool.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' }, }, }, };
- src/tools/handlers/index.ts:108-108 (registration)Registration of the linear_createComment tool handler in the main tool handlers registry, mapping the tool name to the handleCreateComment function curried with the LinearService instance.linear_createComment: handleCreateComment(linearService),
- src/tools/type-guards.ts:187-201 (helper)Type guard function used by the handler to validate and narrow the type of input arguments for the linear_createComment tool.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') ); }