github / github/github-mcp-server

pull_request_read get_files always returns full patches

オープン
#3,236 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug llm-context-window performance
主要言語
Go
スター
33k
フォーク
5k
平均マージ
2日 1時間
マージ済み PR(30日)
52

説明

### Describe the bug

`pull_request_read` with `method: get_files` always includes the full `patch` for every file, and offers no way to ask for filenames only. A 21-file pull request returned roughly 370 KB when only the paths were needed.

In the source, `convertToMinimalPRFiles` populates `MinimalPRFile.Patch` unconditionally, and `get_files` has no field-selection parameter. Several other tools do have one, for example `listPullRequestsItemFieldEnum` and `listCommitsItemFieldEnum`, so the mechanism already exists elsewhere in the codebase.

### Affected version

Unknown. Observed through a hosted GitHub MCP integration on 2026-09-06, where the server version is not exposed to me. The code references above are from the repository's default branch on that date and may not match the build that was serving the request.

### Steps to reproduce the behavior

1. Call `pull_request_read` with `method: get_files` for a pull request touching a reasonable number of files.
2. Observe that every entry carries its full `patch`, with no option to omit it.

### Expected vs actual behavior

Expected: a way to request file metadata without patches, for example a `fields` parameter matching the pattern used by the list tools.

Actual: patches are always included, so a caller that only needs the list of changed paths pays the full diff in context.

Possibly related to #2122, which is closed but describes the same class of oversized `pull_request_read` payloads.

### Logs

None captured beyond the returned payload size.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start at the pull_request_read entry point for method get_files and inspect convertToMinimalPRFiles, which currently populates MinimalPRFile.Patch unconditionally. Compare the existing listPullRequestsItemFieldEnum and listCommitsItemFieldEnum field-selection mechanisms, then verify that callers can request file metadata without patches and that the default behavior remains clear.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
go
領域
api
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。