Canonical: https://weaveos.com/reference/github/read-pull-request-diff

1. [Software capabilities](https://weaveos.com/reference)
2. /[GitHub](https://weaveos.com/reference/github)
3. /Read a GitHub pull request diff

GitHub capability

# Read a GitHub pull request diff

Use the diff media type for a raw REST response. The GitHub CLI and GitHub MCP server can fetch the same pull request changes from a terminal or agent.

Documentation reviewed November 26, 2026

## Ways to do it

API

### GET /repos/{owner}/{repo}/pulls/{pull\_number} with application/vnd.github.diff

Return the pull request’s diff as text using the Accept header.

- Requirements

  Repository owner, name, and pull request number. A fine-grained token for a private repository needs Pull requests read permission.

- Limitations

  A large diff can time out and return HTTP 5xx.

[Read source: GitHub REST API get a pull request ↗](https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request)

CLI

### gh pr diff \<pull-request>

Print the pull request diff. Use --name-only to list files or --patch to request patch format.

- Requirements

  GitHub CLI authenticated for the repository and a pull request reference.

- Limitations

  Using --name-only omits the changed lines.

Example

```
gh pr diff "$PR_NUMBER" --repo "$OWNER/$REPO" --color never
```

[Read source: GitHub CLI pull request diff ↗](https://cli.github.com/manual/gh_pr_diff)

MCP

### pull\_request\_read with method=get\_diff

Give an MCP client the owner, repository, and pull request number to retrieve its diff.

- Requirements

  GitHub MCP server with the pull request read tool enabled and repository access.

- Limitations

  Available only if the connected server exposes the tool or method. Check the client’s tool list before relying on it.

[Read source: GitHub MCP server tools ↗](https://github.com/github/github-mcp-server#tools)

## More from GitHub

[View all GitHub capabilities →](https://weaveos.com/reference/github)

- [Read GitHub Actions job logs↗](https://weaveos.com/reference/github/read-actions-job-logs)
- [Read checks on a GitHub pull request↗](https://weaveos.com/reference/github/read-pull-request-checks)
- [List GitHub Actions workflow runs↗](https://weaveos.com/reference/github/list-actions-workflow-runs)
- [Download GitHub Actions artifacts↗](https://weaveos.com/reference/github/download-actions-artifacts)
