Skip to content

docs: distill mcp-pagination strategy into github-mcp-server.md - #49081

Merged
pelikhan merged 1 commit into
mainfrom
copilot/distillate-pagination-strategy
Jul 30, 2026
Merged

docs: distill mcp-pagination strategy into github-mcp-server.md#49081
pelikhan merged 1 commit into
mainfrom
copilot/distillate-pagination-strategy

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Pagination guidance was only in workflow-level shared files (mcp-pagination.md, github-mcp-pagination-wrappers.md), not in the canonical GitHub MCP instruction file consulted by agents. This adds a dedicated ## Pagination section to .github/aw/github-mcp-server.md.

Changes

  • Token limit context — MCP responses cap at 25k tokens; unpaginated calls force costly retry turns
  • perPage defaults by item type — 10–20 (detailed), 50–100 (simple lists), 1–5 (exploratory)
  • Tool-specific guidancelist_pull_requests, pull_request_read, list_issues, issue_read, search_*, search_repositories
  • Pagination loop pattern — iterate page until total_count/has_next_page exhausted; process incrementally
  • Known tool quirkslist_label ignores perPage (hardcoded GraphQL first: 100); list_workflows uses snake_case per_page; both have wrapper fixes in shared/github-mcp-pagination-wrappers.md
  • Error recognition — concrete oversized-response error strings and the fix (perPage: 10)

Add a ## Pagination section to .github/aw/github-mcp-server.md that
distills the guidance from .github/workflows/shared/mcp-pagination.md:
- 25k token limit context
- perPage defaults by item type (detailed vs simple vs exploratory)
- Tool-specific guidance for PRs, issues, and search
- Pagination loop pattern
- Known tool quirks (list_label / list_workflows wrappers)
- Oversized-response error messages

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review July 30, 2026 07:06
Copilot AI review requested due to automatic review settings July 30, 2026 07:06
@pelikhan
pelikhan merged commit 50bbdb9 into main Jul 30, 2026
1 check passed
@pelikhan
pelikhan deleted the copilot/distillate-pagination-strategy branch July 30, 2026 07:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds canonical GitHub MCP pagination guidance, including response limits, page sizing, tool quirks, and recovery steps.

Changes:

  • Documents recommended pagination sizes and tool-specific defaults.
  • Adds pagination-loop and oversized-response guidance.
  • Describes wrappers for pagination inconsistencies.
Show a summary per file
File Description
.github/aw/github-mcp-server.md Adds GitHub MCP pagination guidance.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

.github/aw/github-mcp-server.md:411

  • This recovery step is too broad for the generic oversized-response error: not every tool or method supports perPage (for example, a non-paginated diff request). Retrying with an unsupported parameter will fail again rather than reduce the payload.
add `perPage: 10` (or smaller) and retry.
  • Files reviewed: 1/1 changed files
  • Comments generated: 4
  • Review effort level: Medium


---

## Pagination
| Simple list operations (commits, branches, labels) | 50–100 |
| Exploratory / schema-discovery queries | 1–5 |

Always pass an explicit `perPage` value. Do **not** rely on server defaults.
Comment on lines +399 to +402
Two built-in GitHub MCP tools ignore standard pagination parameters:

- **`list_label`** — uses a hardcoded GraphQL `labels(first: 100)` query; `perPage` is silently ignored. Use the `shared/github-mcp-pagination-wrappers.md` wrapper instead.
- **`list_workflows`** — uses snake_case `per_page` (inconsistent with every other list tool). Use the `shared/github-mcp-pagination-wrappers.md` wrapper for consistent camelCase `perPage` support.
### Pagination Loop (when all pages are needed)

```
page 1 → check total_count or has_next_page → fetch page 2, 3, … until done
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants