Skip to main content
Glama

get_pull_request_review_comments

Fetch detailed line-by-line review comments for any GitHub pull request to analyze code feedback.

Instructions

Get review comments (line-by-line code comments) for a specific pull request.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner
repoYesRepository name
pullNumberYesPull request number
sortNoSort comments by created or updated time
directionNoSort direction
sinceNoOnly show comments updated after this time (ISO 8601 format)
per_pageNoResults per page (default 10, max 100)
pageNoPage number (default 1)

Implementation Reference

  • The async handler function that executes the tool logic: calls octokit.rest.pulls.listReviewComments with the provided parameters, formats the results as markdown, and returns them.
    	async ({
    		owner,
    		repo,
    		pullNumber,
    		sort,
    		direction,
    		since,
    		per_page,
    		page,
    	}) => {
    		try {
    			const response = await octokit.rest.pulls.listReviewComments({
    				owner,
    				repo,
    				pull_number: pullNumber,
    				sort,
    				direction,
    				since,
    				per_page,
    				page,
    			})
    
    			const comments = response.data
    
    			if (comments.length === 0) {
    				return {
    					content: [
    						{
    							type: "text",
    							text: "No review comments found for this pull request.",
    						},
    					],
    				}
    			}
    
    			// Format as clean markdown
    			let markdown = `# Review Comments for Pull Request #${pullNumber}\n\n`
    			markdown += `Showing ${comments.length} review comment(s) - Page ${page}\n`
    			if (comments.length === per_page) {
    				markdown += `*Note: More results may be available. Use 'page' parameter to see next page.*\n`
    			}
    			markdown += `\n`
    
    			comments.forEach((comment, index) => {
    				markdown += `## Comment ${index + 1}\n\n`
    				markdown += `- **Author:** ${comment.user?.login || "Unknown"}\n`
    				markdown += `- **File:** ${comment.path}\n`
    
    				if (comment.line) {
    					markdown += `- **Line:** ${comment.line}\n`
    				}
    
    				if (comment.start_line && comment.start_line !== comment.line) {
    					markdown += `- **Lines:** ${comment.start_line}-${comment.line}\n`
    				}
    
    				markdown += `- **Side:** ${comment.side || "RIGHT"}\n`
    				markdown += `- **Created:** ${new Date(comment.created_at).toLocaleDateString()}\n`
    
    				if (comment.updated_at !== comment.created_at) {
    					markdown += `- **Updated:** ${new Date(comment.updated_at).toLocaleDateString()}\n`
    				}
    
    				if (comment.commit_id) {
    					markdown += `- **Commit:** ${comment.commit_id.substring(0, 7)}\n`
    				}
    
    				if (comment.in_reply_to_id) {
    					markdown += `- **Reply to:** Comment #${comment.in_reply_to_id}\n`
    				}
    
    				markdown += `\n**Comment:**\n${comment.body}\n`
    
    				if (comment.html_url) {
    					markdown += `\n**URL:** ${comment.html_url}\n`
    				}
    
    				markdown += `\n---\n\n`
    			})
    
    			return {
    				content: [{ type: "text", text: markdown }],
    			}
    		} catch (e: any) {
    			return {
    				content: [{ type: "text", text: `Error: ${e.message}` }],
    			}
    		}
    	},
    )
  • Zod schema definitions for input validation: owner, repo, pullNumber (required), and optional sort, direction, since, per_page, page.
    {
    	owner: z.string().describe("Repository owner"),
    	repo: z.string().describe("Repository name"),
    	pullNumber: z.number().describe("Pull request number"),
    	sort: z
    		.enum(["created", "updated"])
    		.optional()
    		.describe("Sort comments by created or updated time"),
    	direction: z.enum(["asc", "desc"]).optional().describe("Sort direction"),
    	since: z
    		.string()
    		.optional()
    		.describe(
    			"Only show comments updated after this time (ISO 8601 format)",
    		),
    	per_page: z
    		.number()
    		.optional()
    		.default(10)
    		.describe("Results per page (default 10, max 100)"),
    	page: z
    		.number()
    		.optional()
    		.default(1)
    		.describe("Page number (default 1)"),
    },
  • Registration of the tool using server.tool() with the name 'get_pull_request_review_comments' and descriptive text.
    // Tool: Get Pull Request Review Comments
    server.tool(
    	"get_pull_request_review_comments",
    	"Get review comments (line-by-line code comments) for a specific pull request.",
    	{
    		owner: z.string().describe("Repository owner"),
    		repo: z.string().describe("Repository name"),
    		pullNumber: z.number().describe("Pull request number"),
    		sort: z
    			.enum(["created", "updated"])
    			.optional()
    			.describe("Sort comments by created or updated time"),
    		direction: z.enum(["asc", "desc"]).optional().describe("Sort direction"),
    		since: z
    			.string()
    			.optional()
    			.describe(
    				"Only show comments updated after this time (ISO 8601 format)",
    			),
    		per_page: z
    			.number()
    			.optional()
    			.default(10)
    			.describe("Results per page (default 10, max 100)"),
    		page: z
    			.number()
    			.optional()
    			.default(1)
    			.describe("Page number (default 1)"),
    	},
    	async ({
    		owner,
    		repo,
    		pullNumber,
    		sort,
    		direction,
    		since,
    		per_page,
    		page,
    	}) => {
    		try {
    			const response = await octokit.rest.pulls.listReviewComments({
    				owner,
    				repo,
    				pull_number: pullNumber,
    				sort,
    				direction,
    				since,
    				per_page,
    				page,
    			})
    
    			const comments = response.data
    
    			if (comments.length === 0) {
    				return {
    					content: [
    						{
    							type: "text",
    							text: "No review comments found for this pull request.",
    						},
    					],
    				}
    			}
    
    			// Format as clean markdown
    			let markdown = `# Review Comments for Pull Request #${pullNumber}\n\n`
    			markdown += `Showing ${comments.length} review comment(s) - Page ${page}\n`
    			if (comments.length === per_page) {
    				markdown += `*Note: More results may be available. Use 'page' parameter to see next page.*\n`
    			}
    			markdown += `\n`
    
    			comments.forEach((comment, index) => {
    				markdown += `## Comment ${index + 1}\n\n`
    				markdown += `- **Author:** ${comment.user?.login || "Unknown"}\n`
    				markdown += `- **File:** ${comment.path}\n`
    
    				if (comment.line) {
    					markdown += `- **Line:** ${comment.line}\n`
    				}
    
    				if (comment.start_line && comment.start_line !== comment.line) {
    					markdown += `- **Lines:** ${comment.start_line}-${comment.line}\n`
    				}
    
    				markdown += `- **Side:** ${comment.side || "RIGHT"}\n`
    				markdown += `- **Created:** ${new Date(comment.created_at).toLocaleDateString()}\n`
    
    				if (comment.updated_at !== comment.created_at) {
    					markdown += `- **Updated:** ${new Date(comment.updated_at).toLocaleDateString()}\n`
    				}
    
    				if (comment.commit_id) {
    					markdown += `- **Commit:** ${comment.commit_id.substring(0, 7)}\n`
    				}
    
    				if (comment.in_reply_to_id) {
    					markdown += `- **Reply to:** Comment #${comment.in_reply_to_id}\n`
    				}
    
    				markdown += `\n**Comment:**\n${comment.body}\n`
    
    				if (comment.html_url) {
    					markdown += `\n**URL:** ${comment.html_url}\n`
    				}
    
    				markdown += `\n---\n\n`
    			})
    
    			return {
    				content: [{ type: "text", text: markdown }],
    			}
    		} catch (e: any) {
    			return {
    				content: [{ type: "text", text: `Error: ${e.message}` }],
    			}
    		}
    	},
    )
Behavior2/5

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

Annotations are absent, so the description should disclose behavioral traits. It only states the basic action without mentioning pagination, sorting behavior, or what happens when parameters are omitted. It is underinformative for a tool with 8 parameters.

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, concise sentence that front-loads the main action and context. No unnecessary words.

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?

Despite having 8 parameters and no output schema, the description only covers the basic purpose. It does not explain return values, pagination behavior, or how parameters like sorting and filtering affect results. The description is insufficient for complete understanding.

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?

Schema description coverage is 100%, so the baseline is 3. The description does not add any extra meaning beyond what the schema already provides for each parameter.

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 'Get review comments (line-by-line code comments) for a specific pull request.' It uses a specific verb ('Get') and resource ('review comments'), and distinguishes itself from the sibling tool 'get_pull_request_comments' by specifying 'line-by-line code comments'.

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 implies it is for review comments rather than general PR comments, but does not explicitly state when to use it or when to use alternatives like 'get_pull_request_comments' or 'get_pull_request_review_comment'. No exclusion criteria are provided.

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/hithereiamaliff/mcp-github'

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