Skip to main content
Glama
raalarcon9705

raalarcon-jira-mcp-server

create_comment

Add a comment to a Jira issue with plain text or Markdown formatting. Mentions users with @[accountId:displayName] and optionally restrict visibility to roles or groups.

Instructions

Add a comment to 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). Returns comment ID and creation details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueKeyYesIssue key (e.g., "PROJ-123") to add the comment to.
bodyYesComment content. Can be 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).
visibilityNoOptional visibility settings to restrict comment access to specific roles or groups.

Implementation Reference

  • src/index.ts:44-44 (registration)
    Tool 'create_comment' is registered via createCommentTools() which returns a Tool object with name 'create_comment'. The tools list is served through the ListToolsRequestSchema handler.
    const commentTools = createCommentTools(this.jiraClient);
  • src/index.ts:79-84 (registration)
    Routing: when CallToolRequestSchema receives a tool call with name starting with 'create_comment', it routes to handleCommentTool().
      name.startsWith('create_comment') ||
      name.startsWith('get_comments') ||
      name.startsWith('update_comment') ||
      name.startsWith('delete_comment')
    ) {
      return await handleCommentTool(name, args || {}, this.jiraClient);
  • Handler for 'create_comment': validates args via createCommentSchema, calls jiraClient.createComment(), returns success message with comment ID.
    case 'create_comment': {
      const validatedArgs = createCommentSchema.cast(args);
      const comment = await jiraClient.createComment(validatedArgs);
      return {
        content: [
          {
            type: 'text',
            text: `Comment ${comment.id} created successfully`,
          },
        ],
      };
    }
  • Yup validation schema for create_comment: requires issueKey (string) and body (string that gets transformed to ADF format), optional visibility object.
    export const createCommentSchema = yup.object({
      issueKey: yup.string().required('Issue key 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),
    });
  • JiraClient.createComment() method: calls jira.issueComments.addComment() with the issueKey, ADF body, and optional visibility. Returns the API response.
    async createComment(input: CreateCommentInput) {
      try {
        // The schema now handles the conversion from string to ADF
        // So input.body is already an ADF object
        const adfBody = input.body as AddComment['comment'];
    
        const response = await this.jira.issueComments.addComment({
          issueIdOrKey: input.issueKey,
          visibility: input.visibility,
          comment: adfBody
        });
        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,
            body: input.body,
            visibility: input.visibility
          }
        };
        console.error('Comment creation error details:', JSON.stringify(errorDetails, null, 2));
        throw new Error(`Failed to create comment: ${JSON.stringify(errorDetails, null, 2)}`);
      }
    }
Behavior3/5

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

No annotations provided, so the description carries full burden. It discloses Markdown-to-ADF conversion, mention format, and return value (comment ID and creation details). However, missing permission requirements, idempotency, error handling, or behavior for invalid issue keys.

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

Conciseness4/5

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

Five sentences, each adding distinct information: purpose, formatting support, conversion, mentions, and return value. Front-loaded with core action. Concise without waste, though could be slightly more structured.

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

Completeness3/5

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

Adequately covers main aspects for creation but lacks explanation of ADF, visibility options, error conditions, or constraints like rate limits. With no output schema, describing return value is helpful. Overall sufficient for simple use but not comprehensive.

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

Parameters4/5

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

Input schema provides 100% coverage with descriptions. The description adds value by specifying mention syntax (@[accountId:displayName]) and confirming Markdown conversion for the body parameter. This extra context enhances usability beyond schema.

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

Purpose4/5

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

The description clearly states 'Add a comment to a Jira issue', specifying the verb and resource. It differentiates from sibling tools like get_comments, delete_comment, and update_comment by focusing on creation. However, it does not explicitly contrast with these alternatives.

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 explicit guidance on when to use this tool versus alternatives. While it mentions using get_users for account IDs, it lacks prerequisites, context for visibility, or when not to use it.

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

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