Skip to main content
Glama

jira_add_comment

Add comments to Jira issues with support for markdown, plain text, or ADF format, and optional visibility restrictions for groups or roles.

Instructions

Adds a comment to an issue. Supports visibility restrictions for groups or roles. Comment format is controlled by the "format" parameter (default: markdown). Returns the created comment with author details and timestamp.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueKeyYesIssue key to add comment to
bodyYesComment body text
visibilityNoComment visibility restrictions
formatNoComment format: "markdown" (converts Markdown to ADF), "adf" (use as-is ADF object), "plain" (converts plain text to ADF with basic formatting). Default: "markdown"markdown

Implementation Reference

  • The main handler function that validates input, calls the API helper to add a comment, and formats the response.
    export async function handleAddComment(input: unknown): Promise<McpToolResponse> {
      try {
        const validated = validateInput(AddCommentInputSchema, input);
    
        log.info(`Adding comment to issue ${validated.issueKey}...`);
    
        const comment = await addComment(
          validated.issueKey,
          validated.body,
          validated.visibility,
          validated.format
        );
    
        log.info(`Added comment to ${validated.issueKey}`);
    
        return formatCommentResponse(comment);
      } catch (error) {
        log.error('Error in handleAddComment:', error);
        return handleError(error);
      }
    }
  • src/index.ts:180-186 (registration)
    Tool registration in src/index.ts - maps TOOL_NAMES.ADD_COMMENT ('jira_add_comment') to addCommentTool schema and handleAddComment handler.
    {
      name: TOOL_NAMES.ADD_COMMENT,
      description: tools.addCommentTool.description!,
      inputSchema: AddCommentInputSchema,
      handler: tools.handleAddComment,
      annotations: { readOnlyHint: false },
    },
  • Zod validation schema defining the input shape: issueKey, body, optional visibility (type/value), and optional format (markdown/adf/plain, default 'markdown').
    export const AddCommentInputSchema = z.object({
      issueKey: z
        .string()
        .describe('Issue key to add comment to')
        .refine((v) => isValidIssueKey(v), 'Invalid issue key format'),
      body: z.string().min(1).describe('Comment body text'),
      visibility: z
        .object({
          type: z.enum(['group', 'role']).describe('Visibility type'),
          value: z.string().describe('Group name or role name'),
        })
        .optional()
        .describe('Comment visibility restrictions'),
      format: z
        .enum(['markdown', 'adf', 'plain'])
        .optional()
        .default('markdown')
        .describe(
          'Comment format: "markdown" (converts Markdown to ADF), "adf" (use as-is ADF object), "plain" (converts plain text to ADF with basic formatting). Default: "markdown"'
        ),
    });
  • API helper that converts the body to ADF format via ensureAdfDescription and POSTs to /issue/{issueKey}/comment.
    export async function addComment(
      issueKey: string,
      body: string,
      visibility?: { type: string; value: string },
      format?: 'markdown' | 'adf' | 'plain'
    ): Promise<JiraComment> {
      // Convert body to ADF format (Jira expects ADF for comments)
      const adfBody = ensureAdfDescription(body, format || 'markdown');
    
      const data: any = {
        body: adfBody,
      };
    
      if (visibility) {
        data.visibility = visibility;
      }
    
      const config: AxiosRequestConfig = {
        method: 'POST',
        url: `/issue/${issueKey}/comment`,
        data,
      };
    
      return await makeJiraRequest<JiraComment>(config);
    }
  • Formats the API response into a user-facing text message with author, timestamp, visibility, and comment content.
    export function formatCommentResponse(comment: JiraComment): McpToolResponse {
      const visibilityText = comment.visibility
        ? `\n**Visibility:** ${comment.visibility.type} - ${comment.visibility.value}`
        : '';
    
      return {
        content: [
          {
            type: 'text',
            text: `**Comment added successfully**
    
    **Author:** ${comment.author.displayName}
    **Created:** ${new Date(comment.created).toISOString()}${visibilityText}
    
    **Content:**
    ${comment.body}`,
          },
        ],
      };
Behavior4/5

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

Annotations indicate write operation (readOnlyHint=false). Description adds that the tool returns created comment with author and timestamp, which is transparent beyond what annotations provide. No contradictions.

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?

Three sentences covering purpose, features, and return value. Front-loaded with no wasted words. Efficient and well-structured.

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

Completeness5/5

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

Given 4 parameters (one nested), no output schema, the description adequately covers return behavior and key parameter nuances. Completes the tool's context.

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% with detailed parameter descriptions. Description adds minor value (default format) but mostly repeats schema info. Baseline 3 is appropriate.

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?

Description clearly states the verb 'Adds', the resource 'comment to an issue', and mentions key features (visibility, format). It distinguishes from sibling tools like jira_get_comments and jira_update_issue.

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

Usage Guidelines4/5

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

The description implies usage for adding comments, but does not explicitly state when to use this over alternatives like jira_update_issue or jira_get_comments. Context is clear but lacks exclusion guidance.

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

Install Server

Other Tools

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/freema/mcp-jira-stdio'

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