jira_add_comment
Add comments to Jira issues with optional visibility controls for groups or roles. Enables team collaboration by documenting progress, updates, and discussions directly within issue tracking.
Instructions
Adds a comment to an issue. Supports visibility restrictions for groups or roles. Returns the created comment with author details and timestamp.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | Comment body text | |
| issueKey | Yes | Issue key to add comment to (e.g., PROJECT-123) | |
| visibility | No | Comment visibility restrictions (optional) |
Implementation Reference
- src/tools/add-comment.ts:57-77 (handler)The main handler function that validates input, calls the Jira API to add a comment, formats the response, and handles errors.export async function handleAddComment(input: unknown): Promise<McpToolResponse> { try { const validated = validateInput(AddCommentInputSchema, input); log.info(`Adding comment to issue ${validated.issueKey}...`); const comment = await addComment( validated.issueKey, validated.body, validated.visibility, validated.format ); log.info(`Added comment to ${validated.issueKey}`); return formatCommentResponse(comment); } catch (error) { log.error('Error in handleAddComment:', error); return handleError(error); } }
- src/types/tools.ts:174-196 (schema)Zod schema defining and validating the input parameters for the jira_add_comment tool: issueKey, body, optional visibility and format.export const AddCommentInputSchema = z.object({ issueKey: z .string() .describe('Issue key to add comment to') .refine((v) => isValidIssueKey(v), 'Invalid issue key format'), body: z.string().min(1).describe('Comment body text'), visibility: z .object({ type: z.enum(['group', 'role']).describe('Visibility type'), value: z.string().describe('Group name or role name'), }) .optional() .describe('Comment visibility restrictions'), format: z .enum(['markdown', 'adf', 'plain']) .optional() .default('markdown') .describe( 'Comment format: "markdown" (converts Markdown to ADF), "adf" (use as-is ADF object), "plain" (converts plain text to ADF with basic formatting). Default: "markdown"' ), }); export type AddCommentInput = z.infer<typeof AddCommentInputSchema>;
- src/index.ts:43-43 (registration)Registers the 'jira_add_comment' tool name with its handler function in the central toolHandlers Map used by the MCP server.[TOOL_NAMES.ADD_COMMENT, tools.handleAddComment],
- src/index.ts:63-63 (registration)Adds the addCommentTool Tool object (with name, description, schema) to the allTools array returned by listTools.tools.addCommentTool,
- src/config/constants.ts:35-35 (helper)Constant definition for the tool name 'jira_add_comment' used across the codebase for registration and references.ADD_COMMENT: 'jira_add_comment',