jira_get_comments
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
| Name | Required | Description | Default |
|---|---|---|---|
| issueKey | Yes | Issue key to get comments for (e.g., PROJECT-123) | |
| maxResults | No | Maximum number of comments to return (default: 50) | |
| orderBy | No | Sort order for comments: "created" (oldest first), "-created" (newest first) | |
| startAt | No | Index of first comment to return (for pagination) |
Implementation Reference
- src/tools/get-comments.ts:46-79 (handler)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); } } - src/tools/get-comments.ts:13-44 (registration)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'], }, };