Skip to main content
Glama

jira_get_comments

Read-only

Retrieve all comments from a Jira issue, including author, content, timestamps, and visibility settings. Supports pagination for issues with many comments.

Instructions

Retrieves all comments for a Jira issue. Returns comment author, content, timestamps, and visibility settings. Supports pagination for issues with many comments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueKeyYesIssue key to get comments for (e.g., PROJECT-123)
maxResultsNoMaximum number of comments to return (default: 50)
orderByNoSort order for comments: "created" (oldest first), "-created" (newest first)
startAtNoIndex of first comment to return (for pagination)

Implementation Reference

  • The handler function that executes the 'jira_get_comments' tool logic. It validates the input, calls the API helper, and formats the response.
    export async function handleGetComments(input: unknown): Promise<McpToolResponse> {
      try {
        const validated = validateInput(GetCommentsInputSchema, input);
    
        log.info(`Getting comments for issue ${validated.issueKey}...`);
    
        const options: {
          maxResults?: number;
          orderBy?: string;
          startAt?: number;
        } = {};
    
        if (validated.maxResults !== undefined) {
          options.maxResults = validated.maxResults;
        }
    
        if (validated.orderBy !== undefined) {
          options.orderBy = validated.orderBy;
        }
    
        if (validated.startAt !== undefined) {
          options.startAt = validated.startAt;
        }
    
        const comments = await getComments(validated.issueKey, options);
    
        log.info(`Retrieved ${comments.comments.length} comment(s) for ${validated.issueKey}`);
    
        return formatCommentsResponse(comments, validated.issueKey);
      } catch (error) {
        log.error('Error in handleGetComments:', error);
        return handleError(error);
      }
    }
  • Zod schema and TypeScript type for validating the input to 'jira_get_comments'. Accepts issueKey (required), maxResults, orderBy, and startAt.
    export const GetCommentsInputSchema = z.object({
      issueKey: z
        .string()
        .describe('Issue key to get comments for (e.g., PROJECT-123)')
        .refine((v) => isValidIssueKey(v), 'Invalid issue key format'),
      maxResults: z
        .number()
        .min(1)
        .max(100)
        .optional()
        .describe('Maximum number of comments to return (default: 50)'),
      orderBy: z
        .enum(['created', '-created', '+created'])
        .optional()
        .describe('Sort order for comments: "created" (oldest first), "-created" (newest first)'),
      startAt: z
        .number()
        .min(0)
        .optional()
        .describe('Index of first comment to return (for pagination)'),
    });
    
    export type GetCommentsInput = z.infer<typeof GetCommentsInputSchema>;
  • src/index.ts:144-149 (registration)
    Registration of 'jira_get_comments' tool on the MCP server, mapping the tool name to its description, input schema, and handler.
      name: TOOL_NAMES.GET_COMMENTS,
      description: tools.getCommentsTool.description!,
      inputSchema: GetCommentsInputSchema,
      handler: tools.handleGetComments,
      annotations: { readOnlyHint: true },
    },
  • Tool definition object with name (from TOOL_NAMES.GET_COMMENTS), description, and input schema used for registration.
    export const getCommentsTool: Tool = {
      name: TOOL_NAMES.GET_COMMENTS,
      description:
        'Retrieves all comments for a Jira issue. Returns comment author, content, timestamps, and visibility settings. Supports pagination for issues with many comments.',
      inputSchema: {
        type: 'object',
        properties: {
          issueKey: {
            type: 'string',
            description: 'Issue key to get comments for (e.g., PROJECT-123)',
          },
          maxResults: {
            type: 'number',
            description: 'Maximum number of comments to return (default: 50, max: 100)',
            minimum: 1,
            maximum: 100,
          },
          orderBy: {
            type: 'string',
            enum: ['created', '-created', '+created'],
            description:
              'Sort order for comments: "created" or "+created" (oldest first), "-created" (newest first)',
          },
          startAt: {
            type: 'number',
            description: 'Index of first comment to return (for pagination, default: 0)',
            minimum: 0,
          },
        },
        required: ['issueKey'],
      },
    };
  • The API helper function that makes the actual Jira REST API call to GET /rest/api/3/issue/{issueKey}/comment to retrieve comments.
    export async function getComments(
      issueKey: string,
      options: {
        maxResults?: number;
        orderBy?: string;
        startAt?: number;
      } = {}
    ): Promise<JiraCommentsResponse> {
      const params: Record<string, any> = {};
    
      if (options.maxResults !== undefined) {
        params.maxResults = options.maxResults;
      }
    
      if (options.orderBy !== undefined) {
        params.orderBy = options.orderBy;
      }
    
      if (options.startAt !== undefined) {
        params.startAt = options.startAt;
      }
    
      const config: AxiosRequestConfig = {
        method: 'GET',
        url: `/issue/${issueKey}/comment`,
        params,
      };
    
      return await makeJiraRequest<JiraCommentsResponse>(config);
    }
Behavior4/5

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

Annotations provide readOnlyHint=true. The description adds value by specifying returned fields (author, content, timestamps, visibility) and pagination behavior. No contradictions found.

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?

Two concise sentences: first defines purpose, second enriches with return data and pagination. No extraneous words. Front-loaded 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 read-only list tool with no output schema, the description compensates by listing return fields and noting pagination. Missing error conditions or authentication notes, but overall adequate given low complexity.

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?

All 4 parameters are fully described in the schema (100% coverage). The description adds no additional parameter meaning beyond affirming pagination support, which is already in the schema. 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?

The description clearly states the tool retrieves all comments for a Jira issue, using a specific verb and resource. It distinguishes from siblings like jira_add_comment (write) and jira_get_issue (different resource).

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

Usage Guidelines3/5

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

The description mentions pagination support but does not explicitly guide when to use this tool over alternatives (e.g., jira_get_issue for a more compact view). Usage context is implied but not elaborated with when-not or exclusions.

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