Skip to main content
Glama
Dsazz

JIRA MCP Server

jira_get_issue_comments

Retrieve comments for a JIRA issue with configurable filters for quantity, date range, author, and internal visibility to analyze discussion history.

Instructions

Retrieves comments for a specific JIRA issue with configurable quantity and filtering options

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueKeyYes
maxCommentsNo
includeInternalNo
orderByNocreated
authorFilterNo
dateRangeNo

Implementation Reference

  • The GetIssueCommentsHandler class implements the core execution logic: validates parameters, fetches comments via use case, formats output using CommentsFormatter, and provides enhanced error messages.
    export class GetIssueCommentsHandler extends BaseToolHandler<
      GetIssueCommentsParams,
      string
    > {
      private formatter: CommentsFormatter;
    
      /**
       * Create a new GetIssueCommentsHandler with use case and validator
       *
       * @param getIssueCommentsUseCase - Use case for issue comment operations
       * @param issueCommentValidator - Validator for issue comment parameters
       */
      constructor(
        private readonly getIssueCommentsUseCase: GetIssueCommentsUseCase,
        private readonly issueCommentValidator: IssueCommentValidator,
      ) {
        super("JIRA", "Get Issue Comments");
        this.formatter = new CommentsFormatter();
      }
    
      /**
       * Execute the handler logic
       * Retrieves comments for a JIRA issue and formats them using the formatter
       *
       * @param params - Parameters for comment retrieval with progressive disclosure options
       */
      protected async execute(params: GetIssueCommentsParams): Promise<string> {
        try {
          // Step 1: Validate parameters
          const validatedParams =
            this.issueCommentValidator.validateGetCommentsParams(params);
          this.logger.info(
            `Getting comments for JIRA issue: ${validatedParams.issueKey}`,
          );
    
          // Step 2: Get comments using use case
          this.logger.debug("Retrieving comments with params:", {
            issueKey: validatedParams.issueKey,
            hasAuthorFilter: !!validatedParams.authorFilter,
            hasDateRange: !!validatedParams.dateRange,
            includeInternal: validatedParams.includeInternal,
            maxComments: validatedParams.maxComments,
          });
    
          const comments =
            await this.getIssueCommentsUseCase.execute(validatedParams);
    
          // Step 3: Create formatting context
          const context: CommentsContext = {
            issueKey: validatedParams.issueKey,
            totalComments: comments.length,
            maxDisplayed: comments.length,
          };
    
          // Step 4: Format the comments using the formatter
          return this.formatter.format({ comments, context });
        } catch (error) {
          this.logger.error(`Failed to get comments: ${error}`);
          throw this.enhanceError(error, params);
        }
      }
    
      /**
       * Enhance error messages for better user guidance
       */
      private enhanceError(error: unknown, params?: GetIssueCommentsParams): Error {
        const issueContext = params?.issueKey
          ? ` for issue ${params.issueKey}`
          : "";
    
        if (error instanceof JiraNotFoundError) {
          return new Error(
            `❌ **No Comments Found**\n\nNo comments found${issueContext}.\n\n**Solutions:**\n- Verify the issue key is correct\n- Check if the issue has any comments\n- Try including internal comments\n- Use \`jira_get_issue\` to verify the issue exists\n\n**Example:** \`jira_get_issue_comments issueKey="PROJ-123"\``,
          );
        }
    
        if (error instanceof JiraPermissionError) {
          return new Error(
            `❌ **Permission Denied**\n\nYou don't have permission to view comments${issueContext}.\n\n**Solutions:**\n- Check your JIRA permissions\n- Contact your JIRA administrator\n- Verify you have access to the issue\n- Use \`jira_get_issue\` to see accessible issues\n\n**Required Permissions:** Browse Projects`,
          );
        }
    
        if (error instanceof JiraApiError) {
          return new Error(
            `❌ **JIRA API Error**\n\n${error.message}\n\n**Solutions:**\n- Verify the issue key is valid\n- Check your filter parameters\n- Try with different filters\n\n**Example:** \`jira_get_issue_comments issueKey="PROJ-123" maxComments=5\``,
          );
        }
    
        if (error instanceof Error) {
          return new Error(
            `❌ **Comments Retrieval Failed**\n\n${error.message}${issueContext}\n\n**Solutions:**\n- Check your parameters are valid\n- Try a simpler query first\n- Verify your JIRA connection\n\n**Example:** \`jira_get_issue_comments issueKey="PROJ-123"\``,
          );
        }
    
        return new Error(
          `❌ **Unknown Error**\n\nAn unknown error occurred during comment retrieval${issueContext}.\n\nPlease check your parameters and try again.`,
        );
      }
    }
  • Zod schema defining input parameters for the tool, including required issueKey and optional filters like maxComments, author, date range.
    export const getIssueCommentsSchema = z.object({
      // Core parameters (required/essential)
      issueKey: issueKeySchema,
    
      // Basic options (most common use cases)
      maxComments: z.number().int().min(1).max(100).optional().default(10),
    
      // Advanced options (power user features)
      includeInternal: z.boolean().optional().default(false),
      orderBy: z.enum(["created", "updated"]).optional().default("created"),
      authorFilter: z.string().min(1).optional(),
      dateRange: z
        .object({
          from: z.string().datetime().optional(),
          to: z.string().datetime().optional(),
        })
        .optional(),
    });
  • Tool configuration object defining the name, description, input schema, and handler binding for registration.
      name: "jira_get_issue_comments",
      description: "Retrieves comments for a specific JIRA issue with configurable quantity and filtering options",
      params: getIssueCommentsSchema.shape,
      handler: tools.jira_get_issue_comments.handle.bind(tools.jira_get_issue_comments),
    },
  • Factory function creates and wraps the GetIssueCommentsHandler instance into the ToolHandler interface expected by the registry.
    const getIssueCommentsHandler = new GetIssueCommentsHandler(
      dependencies.getIssueCommentsUseCase,
      dependencies.issueCommentValidator,
    );
    
    const getAssignedIssuesHandler = new GetAssignedIssuesHandler(
      dependencies.getAssignedIssuesUseCase,
    );
    
    const createIssueHandler = new CreateIssueHandler(
      dependencies.createIssueUseCase,
    );
    
    const updateIssueHandler = new UpdateIssueHandler(
      dependencies.updateIssueUseCase,
    );
    
    const searchIssuesHandler = new SearchIssuesHandler(
      dependencies.searchIssuesUseCase,
    );
    
    return {
      jira_get_issue: {
        handle: async (args: unknown) => getIssueHandler.handle(args),
      },
      jira_get_issue_comments: {
        handle: async (args: unknown) => getIssueCommentsHandler.handle(args),
      },
  • Generic registration code that calls MCP server.tool() with the configuration from issue-tools.config.ts for all tools including jira_get_issue_comments.
    server.tool(
      toolName,
      config.description,
      config.params,
      adaptHandler(config.handler),
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'configurable quantity and filtering options,' which hints at customization but doesn't describe what the tool returns (e.g., comment objects, pagination, error handling), authentication needs, rate limits, or side effects. For a read operation with 6 parameters, this leaves significant gaps in understanding how the tool behaves beyond basic functionality.

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?

The description is a single, efficient sentence that front-loads the core purpose ('retrieves comments for a specific JIRA issue') and adds useful context ('with configurable quantity and filtering options'). There is no wasted verbiage or redundancy, making it highly concise and well-structured for quick comprehension.

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

Completeness2/5

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

Given the complexity (6 parameters, nested object, no output schema, and no annotations), the description is incomplete. It doesn't explain return values, error conditions, or behavioral details like pagination or authentication. For a tool with rich filtering options and no structured output documentation, this leaves the agent with insufficient context to use it effectively beyond basic invocation.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It mentions 'configurable quantity and filtering options,' which loosely maps to parameters like maxComments, authorFilter, and dateRange, but doesn't explain what each parameter does, their formats, or constraints. With 6 parameters (including a nested object), this adds minimal value beyond the schema, failing to clarify semantics like what 'includeInternal' means or how 'orderBy' affects results.

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 the verb ('retrieves') and resource ('comments for a specific JIRA issue'), making the purpose immediately understandable. It distinguishes from siblings like jira_get_issue (which gets issue details) and jira_get_worklogs (which gets worklogs). However, it doesn't explicitly contrast with jira_get_assigned_issues or search_jira_issues, which are about issues rather than comments.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an issue key), nor does it differentiate from potential overlapping tools like jira_get_issue (which might include comments) or search_jira_issues (which might search comments). Usage is implied by the purpose but not explicitly stated.

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

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