Skip to main content
Glama
cosmix

JIRA MCP Server

by cosmix

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,
              },
            ],
          },
        ],
      };

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.0.0

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It does not disclose behavioral traits like whether the comment is appended, supports rich text, or requires specific permissions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no unnecessary words. Direct and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with two parameters, the description is adequate. No output schema, but the function is straightforward. Could mention if comment is appended or replaces.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and descriptions are clear. Description does not add additional meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Add a comment') and the resource ('JIRA issue'), with a specific verb and resource. It distinguishes from siblings like add_attachment and create_issue.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives, such as when to add attachment or update issue. No mention of prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.