Skip to main content
Glama

Read pull request diff

gh_get_pr_diff
Read-onlyIdempotent

Fetch a bounded unified diff or patch for a pull request's exact commit SHAs, with truncation reporting and SHA-256 fingerprint. Read-only; no checkout, tests, or GitHub modifications.

Instructions

Read-only: return a bounded unified diff or patch for the exact immutable base and head commit SHAs currently identified by a pull request. The result reports truncation, byte counts, and a SHA-256 fingerprint. This tool never checks out code, runs tests, requests approval, or modifies GitHub.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoYesGitHub repository name.
ownerYesGitHub repository owner.
formatNoUnified diff or email-style patch output.diff
numberYesPull request number.
max_bytesNoMaximum UTF-8 bytes returned, capped by MCP_GH_MAX_PR_DIFF_BYTES. Omit to use the server cap.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatYes
numberYes
sha256Yes
contentYes
base_shaYes
head_shaYes
truncatedYes
total_bytesYes
bytes_returnedYes
Behavior4/5

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

Annotations already declare readOnlyHint=true, but the description adds significant transparency beyond that by stating it never checks out code, runs tests, requests approval, or modifies GitHub. It also discloses that the result reports truncation and byte counts, and includes a SHA-256 fingerprint, which is useful behavioral detail not captured in the schema.

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 two sentences with no redundancy. The first sentence front-loads the core function and output characteristics; the second immediately clarifies the read-only nature and non-modification stance. Every word earns its place.

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?

Given the moderate complexity (5 parameters, mostly simple), the description explains what the tool returns (bounded diff, truncation info, byte counts, fingerprint), its read-only nature, and its safety guarantees. An output schema exists, so return details are covered. The description is sufficient for an agent to select and invoke the tool correctly.

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?

Input schema covers all parameters with descriptions (100% coverage), so the baseline is 3. The description adds minimal parameter-specific nuance (e.g., 'bounded' hints at max_bytes behavior), but it does not elaborate on formats or defaults beyond what the schema already states, so it neither compensates nor degrades.

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?

Description clearly states the tool returns a bounded unified diff or patch for the exact base and head commit SHAs of a PR, distinguishing it from siblings that list PR metadata, files, or commits. It also specifies that it is read-only and never modifies state, making its purpose unambiguous.

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?

Provides clear context by describing exactly what it returns and explicitly listing actions it never performs (checkout, tests, approval, modifications), which helps agents avoid misuse. However, it does not explicitly name alternative tools for cases where a read-only diff is not suitable, so it lacks explicit when-not-to-use guidance.

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/fvanevski/gh_mcp'

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