Skip to main content
Glama

add_comment

Add comments to Jira issues to provide updates, document progress, or communicate with team members about specific tasks.

Instructions

Add a comment to a Jira issue

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueKeyYesThe issue key to comment on (e.g., PROJ-123)
commentYesThe comment in ADF format or plain string. Example ADF: {"type":"doc","version":1,"content":[{"type":"paragraph","content":[{"type":"text","text":"Comment text"}]}]}

Implementation Reference

  • The handler function that executes the add_comment tool. It validates inputs, converts plain text comments to ADF format if necessary, posts the comment to the Jira API, and returns success or formatted error response.
    async handleAddComment(args: any) {
      try {
        const { issueKey, comment } = args;
    
        if (!issueKey || !comment) {
          throw new Error('issueKey and comment are required');
        }
    
        // Handle comment body - convert to ADF format if it's plain text
        let commentBody;
        if (typeof comment === 'string') {
          // Convert plain text to Atlassian Document Format
          commentBody = {
            type: 'doc',
            version: 1,
            content: [
              {
                type: 'paragraph',
                content: [
                  {
                    type: 'text',
                    text: comment,
                  },
                ],
              },
            ],
          };
        } else {
          // Already in ADF format
          commentBody = comment;
        }
    
        const commentData = {
          body: commentBody,
        };
    
        const result = await this.apiClient.post(`/issue/${issueKey}/comment`, commentData);
    
        return {
          content: [
            {
              type: 'text',
              text: `✅ Comment added to ${issueKey} successfully!\n\n**Comment ID**: ${result.id}`,
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: JiraFormatters.formatError(error),
            },
          ],
          isError: true,
        };
      }
    }
  • The input schema and metadata definition for the add_comment tool, specifying required parameters and descriptions.
    {
      name: 'add_comment',
      description: 'Add a comment to a Jira issue',
      inputSchema: {
        type: 'object',
        properties: {
          issueKey: {
            type: 'string',
            description: 'The issue key to comment on (e.g., PROJ-123)',
          },
          comment: {
            description: 'The comment in ADF format or plain string. Example ADF: {"type":"doc","version":1,"content":[{"type":"paragraph","content":[{"type":"text","text":"Comment text"}]}]}',
          },
        },
        required: ['issueKey', 'comment'],
      },
    },
  • src/index.ts:122-123 (registration)
    The dispatch/registration point in the MCP server where tool calls to 'add_comment' are routed to the handler.
    case 'add_comment':
      return this.commentHandlers.handleAddComment(request.params.arguments);

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

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