Skip to main content
Glama

create_pull_request_review_comment

Post a review comment on specific lines in a pull request diff to discuss code changes.

Instructions

Create a review comment (line-by-line code comment) on a pull request.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner
repoYesRepository name
pullNumberYesPull request number
bodyYesComment body
commit_idYesSHA of the commit to comment on
pathYesRelative path to the file being commented on
lineNoLine number for single-line comment
start_lineNoStart line for multi-line comment
sideNoSide of diff (LEFT for deletion, RIGHT for addition)RIGHT
start_sideNoStart side for multi-line comment
in_reply_toNoID of review comment to reply to

Implementation Reference

  • Tool 'create_pull_request_review_comment' is registered via server.tool() in the registerPullRequestTools function.
    server.tool(
    	"create_pull_request_review_comment",
  • Input schema definition using Zod: owner, repo, pullNumber, body, commit_id, path, line, start_line, side, start_side, in_reply_to.
    {
    	owner: z.string().describe("Repository owner"),
    	repo: z.string().describe("Repository name"),
    	pullNumber: z.number().describe("Pull request number"),
    	body: z.string().describe("Comment body"),
    	commit_id: z.string().describe("SHA of the commit to comment on"),
    	path: z.string().describe("Relative path to the file being commented on"),
    	line: z
    		.number()
    		.optional()
    		.describe("Line number for single-line comment"),
    	start_line: z
    		.number()
    		.optional()
    		.describe("Start line for multi-line comment"),
    	side: z
    		.enum(["LEFT", "RIGHT"])
    		.optional()
    		.default("RIGHT")
    		.describe("Side of diff (LEFT for deletion, RIGHT for addition)"),
    	start_side: z
    		.enum(["LEFT", "RIGHT"])
    		.optional()
    		.describe("Start side for multi-line comment"),
    	in_reply_to: z
    		.number()
    		.optional()
    		.describe("ID of review comment to reply to"),
    },
  • Handler function that calls octokit.rest.pulls.createReviewComment and formats the response as markdown.
    	async ({
    		owner,
    		repo,
    		pullNumber,
    		body,
    		commit_id,
    		path,
    		line,
    		start_line,
    		side,
    		start_side,
    		in_reply_to,
    	}) => {
    		try {
    			const response = await octokit.rest.pulls.createReviewComment({
    				owner,
    				repo,
    				pull_number: pullNumber,
    				body,
    				commit_id,
    				path,
    				line,
    				start_line,
    				side,
    				start_side,
    				in_reply_to,
    			})
    
    			// Format response as clean markdown
    			const comment = response.data
    			let markdown = `# Review Comment Created for Pull Request #${pullNumber}\n\n`
    			markdown += `- **Comment ID:** ${comment.id}\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.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`
    			markdown += `\n**URL:** ${comment.html_url}\n`
    
    			return {
    				content: [{ type: "text", text: markdown }],
    			}
    		} catch (e: any) {
    			return {
    				content: [{ type: "text", text: `Error: ${e.message}` }],
    			}
    		}
    	},
    )
  • The function registerPullRequestTools wraps all pull request tool registrations, including this tool.
    export function registerPullRequestTools(server: McpServer, octokit: Octokit) {
Behavior2/5

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

No annotations are provided, and the description only states the basic action. It fails to disclose important behavioral aspects like permissions required, whether it creates a new review or adds to an existing one, rate limits, or the effect of replying (in_reply_to parameter).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that captures the core purpose without excess. However, it could be slightly improved by mentioning multi-line comment capability without adding much length.

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

Completeness3/5

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

Given the tool has 11 parameters, no output schema, and no annotations, the description is minimal. It lacks details about return values, interaction with reviews, and multi-line comment semantics. It is adequate but leaves gaps that a more comprehensive description would fill.

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?

The input schema has 100% coverage with descriptions for all parameters, so the baseline is 3. The description adds no additional meaning beyond the schema, e.g., it does not explain how line/start_line define multi-line comments or the meaning of side/start_side.

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 action ('Create'), the resource ('review comment'), and specifies it is a line-by-line comment on a pull request. This effectively distinguishes it from sibling tools like 'add_issue_comment' and 'get_pull_request_review_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 use for adding inline comments to PRs but does not explicitly state when to use this tool versus alternatives, such as using 'add_issue_comment' for general PR comments or for replying. It lacks guidance on prerequisites or context.

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