add_comment
Add comments to Jira tickets directly from the Cursor editor to provide updates, feedback, or additional information on issues.
Instructions
Add a comment to a Jira ticket
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticketId | Yes | The Jira ticket ID | |
| comment | Yes |
Implementation Reference
- src/server.ts:320-342 (handler)The async handler function implementing the 'add_comment' tool logic: validates Jira configuration, calls jira.issueComments.addComment to add the comment to the ticket, and returns success or error response.async ({ ticketId, comment }: { ticketId: string; comment: JiraComment }) => { const configError = validateJiraConfig(); if (configError) { return { content: [{ type: "text", text: `Configuration error: ${configError}` }], }; } try { await jira.issueComments.addComment({ issueIdOrKey: ticketId, comment: comment.body, }); return { content: [{ type: "text", text: `Added comment to ${ticketId}` }], }; } catch (error) { return { content: [{ type: "text", text: `Failed to add comment: ${(error as Error).message}` }], }; } }
- src/server.ts:57-59 (schema)Zod schema defining the structure of the comment input (body: string) for the add_comment tool.const CommentSchema = z.object({ body: z.string().describe("The comment text"), });
- src/server.ts:40-42 (schema)TypeScript interface for JiraComment used in the add_comment tool input parameters.interface JiraComment { body: string; }
- src/server.ts:313-343 (registration)Registration of the 'add_comment' MCP tool via server.tool(), specifying name, description, input schema, and handler function.server.tool( "add_comment", "Add a comment to a Jira ticket", { ticketId: z.string().describe("The Jira ticket ID"), comment: CommentSchema, }, async ({ ticketId, comment }: { ticketId: string; comment: JiraComment }) => { const configError = validateJiraConfig(); if (configError) { return { content: [{ type: "text", text: `Configuration error: ${configError}` }], }; } try { await jira.issueComments.addComment({ issueIdOrKey: ticketId, comment: comment.body, }); return { content: [{ type: "text", text: `Added comment to ${ticketId}` }], }; } catch (error) { return { content: [{ type: "text", text: `Failed to add comment: ${(error as Error).message}` }], }; } } );
- src/server.ts:316-319 (schema)Inline input schema object for the add_comment tool, including ticketId and comment (referencing CommentSchema).{ ticketId: z.string().describe("The Jira ticket ID"), comment: CommentSchema, },