Skip to main content
Glama

Get pull request diff

get_pull_request_diff
Read-only

Read a pull request's unified diff, optionally limited to one file's hunks by exact path. Use it to review code changes with truncation control via max_bytes.

Instructions

Read a pull request's unified diff (owner/repo/index). Pass file_path for just that file's hunks — the exact path from list_pull_request_files, matching either side of a rename. Without it the whole diff is returned, truncated at 64 KiB (raise with max_bytes).

Input Schema

NameRequiredDescriptionDefault
repoYesRepository name.
indexYesPull request number within the repository.
ownerYesRepository owner — user or organization.
file_pathNoReturn only this file's hunks. Matches either side of a rename, and must be the exact path as listed by `list_pull_request_files` (no globs). Omit for the whole diff.
max_bytesNoCap on the returned diff in bytes (default 65536), applied at a line boundary. Ignored when `file_path` selects a single file.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.22.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and openWorldHint, so the safety profile is covered; the description additionally surfaces the non-obvious truncation behavior (64 KiB default, raise via max_bytes) that would otherwise silently corrupt an agent's reading of a large diff. Some of this duplicates the max_bytes schema text, and nothing is said about binary files or what an empty diff returns.

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?

Three sentences, front-loaded with the operation and the primary scoping override, with zero filler. Every clause either selects a mode or warns about a limit.

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 retrieval tool with a fully documented 5-parameter schema and no output schema, the description covers identification, scoping, discovery of valid paths, and truncation. It stops short of describing the returned diff's shape or failure behavior for missing paths/large binaries.

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 both optional parameters already explain themselves in detail, including rename matching and the file_path/max_bytes interaction. The description restates those semantics rather than adding new ones, so baseline 3 applies.

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 opening clause names a specific verb and resource ("Read a pull request's unified diff") and pins the identifier triple (owner/repo/index). It also differentiates from the closest sibling by pointing at list_pull_request_files as the source of valid file_path values.

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

Usage Guidelines4/5

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

It clearly states the two modes — pass file_path for a single file's hunks, omit it for the whole diff — and names list_pull_request_files as the prerequisite discovery tool. What is missing is any guidance on when to prefer this over get_pull_request or get_file_contents in an adjacent workflow.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.