update_comment
Update an existing comment on a Jira issue. Supports Markdown for rich formatting and mentions using accountId.
Instructions
Update an existing comment on 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).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issueKey | Yes | The issue key containing the comment | |
| commentId | Yes | The ID of the comment to update | |
| body | Yes | The new comment text. Supports 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 | Comment visibility settings |
Implementation Reference
- src/tools/comments.ts:196-207 (handler)Tool handler for 'update_comment' that validates args via schema, calls jiraClient.updateComment(), and returns success message.
case 'update_comment': { const validatedArgs = updateCommentSchema.cast(args); const result = await jiraClient.updateComment(validatedArgs); return { content: [ { type: 'text', text: `Comment ${result.id} updated successfully`, }, ], }; } - src/jira-client.ts:372-402 (handler)JiraClient.updateComment() method that calls the Jira API's issueComments.updateComment with issueKey, commentId, body (ADF), and visibility.
// Update comment async updateComment(input: UpdateCommentInput) { try { // The schema now handles the conversion from string to ADF // So input.body is already an ADF object const adfBody = input.body as UpdateComment['body']; const response = await this.jira.issueComments.updateComment({ issueIdOrKey: input.issueKey, id: input.commentId, body: adfBody, visibility: input.visibility, }); return response; } catch (error: unknown) { const errorDetails = { message: (error as Error).message, status: (error as JiraError).status, statusText: (error as JiraError).statusText, response: (error as JiraError).response?.data, request: { issueKey: input.issueKey, commentId: input.commentId, body: input.body, visibility: input.visibility } }; console.error('Comment update error details:', JSON.stringify(errorDetails, null, 2)); throw new Error(`Failed to update comment: ${JSON.stringify(errorDetails, null, 2)}`); } } - src/schemas/index.ts:153-187 (schema)Yup validation schema for update_comment input: requires issueKey, commentId, body (with Markdown-to-ADF conversion), and optional visibility.
export const updateCommentSchema = yup.object({ issueKey: yup.string().required('Issue key is required'), commentId: yup.string().required('Comment ID 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), }); - src/tools/comments.ts:73-109 (registration)Tool registration/definition in createCommentTools: name 'update_comment', description, and inputSchema with issueKey, commentId, body, visibility.
{ name: 'update_comment', description: 'Update an existing comment on 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).', inputSchema: { type: 'object', properties: { issueKey: { type: 'string', description: 'The issue key containing the comment', }, commentId: { type: 'string', description: 'The ID of the comment to update', }, body: { type: 'string', description: 'The new comment text. Supports 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: { type: 'object', properties: { type: { type: 'string', enum: ['role', 'group'], description: 'The visibility type', }, value: { type: 'string', description: 'The role or group name', }, }, description: 'Comment visibility settings', }, }, required: ['issueKey', 'commentId', 'body'], }, }, - src/index.ts:78-84 (registration)Routes 'update_comment' tool calls (via name prefix match) to handleCommentTool.
} else if ( name.startsWith('create_comment') || name.startsWith('get_comments') || name.startsWith('update_comment') || name.startsWith('delete_comment') ) { return await handleCommentTool(name, args || {}, this.jiraClient);