create_comment
Add a comment to a Jira issue with plain text or Markdown formatting. Mentions users with @[accountId:displayName] and optionally restrict visibility to roles or groups.
Instructions
Add a comment to a Jira issue. Supports plain text or Markdown for rich formatting (headings, lists, code blocks, links, etc.). Markdown is automatically converted to ADF. For mentions, use format: @[accountId:displayName] (get accountId from get_users tool). Returns comment ID and creation details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issueKey | Yes | Issue key (e.g., "PROJ-123") to add the comment to. | |
| body | Yes | Comment content. Can be plain text or Markdown for rich formatting (headings, lists, code blocks, links, etc.). Markdown will be automatically converted to ADF. For mentions, use format: @[accountId:displayName] (get accountId from get_users tool). | |
| visibility | No | Optional visibility settings to restrict comment access to specific roles or groups. |
Implementation Reference
- src/tools/comments.ts:137-148 (handler)Handler for 'create_comment': validates args via createCommentSchema, calls jiraClient.createComment(), returns success message with comment ID.
case 'create_comment': { const validatedArgs = createCommentSchema.cast(args); const comment = await jiraClient.createComment(validatedArgs); return { content: [ { type: 'text', text: `Comment ${comment.id} created successfully`, }, ], }; } - src/schemas/index.ts:54-87 (schema)Yup validation schema for create_comment: requires issueKey (string) and body (string that gets transformed to ADF format), optional visibility object.
export const createCommentSchema = yup.object({ issueKey: yup.string().required('Issue key is required'), body: yup.mixed() .required('Comment body is required') .test('is-string', 'Body must be a string', function (value) { return typeof value === 'string'; }) .transform(function (value) { // If it's a string and looks like markdown, convert to ADF if (typeof value === 'string' && isMarkdown(value)) { return markdownToADF(value); } // For plain text, create a simple ADF paragraph return { version: 1, type: 'doc', content: [ { type: 'paragraph', content: [ { type: 'text', text: value } ] } ] }; }), visibility: yup.object({ type: yup.string().oneOf(['role', 'group']).optional(), value: yup.string().optional(), }).optional().default(undefined), });