Skip to main content
Glama

add_comment

Add comments to JIRA issues to provide updates, clarify requirements, or document progress within project workflows.

Instructions

Add a comment to a JIRA issue

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueIdOrKeyYesThe ID or key of the issue to add the comment to
bodyYesThe content of the comment (plain text)

Implementation Reference

  • Primary MCP tool handler for 'add_comment'. Validates input (issueIdOrKey, body) and delegates to JiraApiService.addCommentToIssue, returning JSON response.
    case "add_comment": { if ( !args.issueIdOrKey || typeof args.issueIdOrKey !== "string" || !args.body || typeof args.body !== "string" ) { throw new McpError( ErrorCode.InvalidParams, "issueIdOrKey and body are required", ); } const response = await this.jiraApi.addCommentToIssue( args.issueIdOrKey, args.body, ); return { content: [ { type: "text", text: JSON.stringify(response, null, 2) }, ], };
  • Core implementation that converts plain text to ADF, POSTs to JIRA API to add comment, and returns cleaned response.
    async addCommentToIssue( issueIdOrKey: string, body: string ): Promise<AddCommentResponse> { const adfBody = this.createAdfFromBody(body); const payload = { body: adfBody, }; const response = await this.fetchJson<JiraCommentResponse>( `/rest/api/3/issue/${issueIdOrKey}/comment`, { method: "POST", body: JSON.stringify(payload), } ); return { id: response.id, author: response.author.displayName, created: response.created, updated: response.updated, body: this.extractTextContent(response.body.content), }; }
  • src/index.ts:246-264 (registration)
    Tool registration in MCP server's listTools handler, defining name, description, and input schema.
    { name: "add_comment", description: "Add a comment to a JIRA issue", inputSchema: { type: "object", properties: { issueIdOrKey: { type: "string", description: "The ID or key of the issue to add the comment to", }, body: { type: "string", description: "The content of the comment (plain text)", }, }, required: ["issueIdOrKey", "body"], additionalProperties: false, }, },
  • TypeScript interface defining the structure of the response from addCommentToIssue.
    export interface AddCommentResponse { id: string; author: string; created: string; updated: string; body: string; // Return plain text for simplicity }
  • Helper to convert plain text comment to ADF format required by JIRA API.
    private createAdfFromBody(text: string): AdfDoc { return { version: 1, type: "doc", content: [ { type: "paragraph", content: [ { type: "text", text: text, }, ], }, ], };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cosmix/jira-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server