list_issue_comments
Retrieve all comments from a GitHub issue to track discussions and gather feedback for project management.
Instructions
List all comments on a GitHub issue
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issueNumber | Yes | ||
| perPage | No |
Implementation Reference
- The core handler function that executes the tool logic by calling the GitHub API to list comments for a specific issue.async listIssueComments(data: { issueNumber: number; perPage?: number; }): Promise<Array<{ id: number; body: string; user: string; createdAt: string; updatedAt: string }>> { try { const octokit = this.factory.getOctokit(); const config = this.factory.getConfig(); const response = await octokit.rest.issues.listComments({ owner: config.owner, repo: config.repo, issue_number: data.issueNumber, per_page: data.perPage || 100 }); return response.data.map(comment => ({ id: comment.id, body: comment.body || '', user: comment.user?.login || 'unknown', createdAt: comment.created_at, updatedAt: comment.updated_at })); } catch (error) { throw this.mapErrorToMCPError(error); } }
- Tool definition including name, description, input schema, and usage examples.export const listIssueCommentsTool: ToolDefinition<ListIssueCommentsArgs> = { name: "list_issue_comments", description: "List all comments on a GitHub issue", schema: listIssueCommentsSchema as unknown as ToolSchema<ListIssueCommentsArgs>, examples: [ { name: "Get all comments", description: "Retrieve all comments for an issue", args: { issueNumber: 42 } }, { name: "Get recent comments", description: "Retrieve the 20 most recent comments", args: { issueNumber: 42, perPage: 20 } } ] };
- Zod schema for input validation defining required issueNumber and optional perPage.export const listIssueCommentsSchema = z.object({ issueNumber: z.number().int().positive("Issue number must be a positive integer"), perPage: z.number().int().positive().max(100).default(100).optional(), }); export type ListIssueCommentsArgs = z.infer<typeof listIssueCommentsSchema>;
- src/infrastructure/tools/ToolRegistry.ts:217-217 (registration)Registration of the listIssueCommentsTool in the central ToolRegistry singleton.this.registerTool(listIssueCommentsTool);
- src/index.ts:329-330 (handler)MCP server request handler that dispatches tool calls to the ProjectManagementService.case "list_issue_comments": return await this.service.listIssueComments(args);