Skip to main content
Glama

Get pull request diff

get_pr_diff
Read-only

Retrieve a pull request's changed files and unified diff hunks, trimming patches to a character budget and skipping lock/build files so you can review changes and request omitted files.

Instructions

Get the changed files and unified diff hunks of a pull request. Patches are trimmed to whole hunks within a character budget; lock files and build output are skipped. Every file is listed, and files without a patch have an 'omitted' reason. If 'truncated' is true, call again with 'files' to read specific files in full.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "owner": "<owner>",
      "repo": "<repo>",
      "pullNumber": "<pullNumber>"
    },
    "name": "get_pr_diff"
  }
}

Input Schema

NameRequiredDescriptionDefault
repoYesRepository name, e.g. 'next.js'
filesNoOnly return these file paths. Use this to drill into files that were truncated or omitted in an earlier call.
ownerYesRepository owner (user or org), e.g. 'vercel'
maxCharsNoCharacter budget for all patches combined (roughly 4 characters per token)
pullNumberYesPull request number

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and openWorldHint, yet the description still adds substantive behavior: hunks are trimmed to whole-hunk boundaries within a character budget, lock files and build output are silently skipped, and omitted files always carry a reason. What it does not cover is whether the diff reflects the full PR or only the latest commit, and permission implications for private repos.

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?

Four short sentences, each carrying a distinct fact: what is returned, how patches are bounded, how omissions are surfaced, and the remediation path. The truncation workaround is placed last, where an agent needs it after the first call.

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

Completeness5/5

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

Without an output schema the description carries the return-shape burden itself, and it does: file listing, hunk content, omission reasons, and the truncated flag are all described, so an agent knows exactly what comes back and how to continue.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% so the baseline is 3, and the description earns above baseline by explaining the intended use of 'files' as a drill-down for truncated or omitted entries and by tying 'maxChars' to the character-budget trimming behavior of patches.

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?

States a specific verb and resource ('Get the changed files and unified diff hunks of a pull request') and scopes the output precisely, which cleanly separates it from siblings like summarize_pr and check_pr_risk that operate on the same PR but return different artifacts.

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?

Gives a concrete follow-up rule for the truncation case ('If truncated is true, call again with files'), which is real usage guidance, but says nothing about when to reach for this tool instead of summarize_pr or check_pr_risk, leaving the sibling choice implicit.

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