Add per_page pagination support to list_workflows and list_label MCP wrappers#33819
Merged
Conversation
Contributor
|
Hey
If you'd like guidance on the next steps, you can use this prompt:
|
…l MCP wrappers - Add shared mcp-scripts wrapper (.github/workflows/shared/github-mcp-pagination-wrappers.md) that defines list_workflows and list_label tools with per_page (default 10) and page parameters calling GitHub REST API directly - Add skill scripts for standalone CLI use: - .github/skills/github-workflows-query/query-workflows.sh - .github/skills/github-labels-query/query-labels.sh Both support INPUT_* env vars (mcp-scripts convention) and --flag CLI args - Add 15 vitest regression tests confirming per_page=1 returns exactly one item - Update .github/aw/github-mcp-server.md to document per_page/page on actions_list Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add per page pagination support to MCP wrappers
Add per_page pagination support to list_workflows and list_label MCP wrappers
May 21, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds per_page/page pagination support for the list_workflows and list_label GitHub MCP wrappers by introducing shell-based mcp-scripts tools that call the GitHub REST API, plus adds two standalone “skill” scripts and updates MCP server documentation.
Changes:
- Added a shared
mcp-scriptswrapper file defininglist_workflowsandlist_labelwith validatedper_page/pageand normalized JSON responses. - Added two skill packages (
github-workflows-query,github-labels-query) with shell scripts and usage docs for paginated REST queries. - Updated
.github/aw/github-mcp-server.mddocumentation to includemethod,per_page,page(andresource_id) foractions_list.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/shared/github-mcp-pagination-wrappers.md |
Introduces list_workflows and list_label mcp-scripts wrappers using gh api with pagination. |
.github/skills/github-workflows-query/SKILL.md |
Documents usage/parameters/output for the workflows pagination skill script. |
.github/skills/github-workflows-query/query-workflows.sh |
Implements REST-backed workflow listing with per_page/page parameters. |
.github/skills/github-labels-query/SKILL.md |
Documents usage/parameters/output for the labels pagination skill script. |
.github/skills/github-labels-query/query-labels.sh |
Implements REST-backed label listing with per_page/page parameters. |
.github/aw/github-mcp-server.md |
Updates actions_list parameter documentation to include pagination/method fields. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 6/6 changed files
- Comments generated: 3
Comment on lines
+68
to
+78
| if ! [[ "$PER_PAGE" =~ ^[0-9]+$ ]] || [[ "$PER_PAGE" -lt 1 ]] || [[ "$PER_PAGE" -gt 100 ]]; then | ||
| echo '{"error": "per_page must be between 1 and 100"}' >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| RESPONSE=$(gh api "repos/${OWNER}/${REPO}/actions/workflows?per_page=${PER_PAGE}&page=${PAGE}") | ||
|
|
||
| echo "$RESPONSE" | jq \ | ||
| --argjson per_page "$PER_PAGE" \ | ||
| --argjson page "$PAGE" \ | ||
| '{ |
Comment on lines
+68
to
+78
| if ! [[ "$PER_PAGE" =~ ^[0-9]+$ ]] || [[ "$PER_PAGE" -lt 1 ]] || [[ "$PER_PAGE" -gt 100 ]]; then | ||
| echo '{"error": "per_page must be between 1 and 100"}' >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| RESPONSE=$(gh api "repos/${OWNER}/${REPO}/labels?per_page=${PER_PAGE}&page=${PAGE}") | ||
|
|
||
| echo "$RESPONSE" | jq \ | ||
| --argjson per_page "$PER_PAGE" \ | ||
| --argjson page "$PAGE" \ | ||
| '{ |
Comment on lines
189
to
193
| | Tool | Purpose | Key Parameters | | ||
| |------|---------|----------------| | ||
| | `actions_get` | Get details of a specific workflow run | `owner`, `repo`, `run_id` | | ||
| | `actions_list` | List GitHub Actions workflows and runs | `owner`, `repo`, `workflow_id` | | ||
| | `actions_list` | List GitHub Actions workflows and runs | `owner`, `repo`, `method`, `resource_id`, `per_page`, `page` | | ||
| | `actions_run_trigger` | Trigger a workflow run | `owner`, `repo`, `workflow_id`, `ref`, `inputs` | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both
list_workflowsandlist_labelGitHub MCP tools silently ignoreper_page:list_labelhardcodes GraphQLlabels(first: 100)with no pagination schema;list_workflows(a deprecated alias foractions_list) doesn't surfaceper_pageto callers. Every agent call pays full token cost regardless of how many items are needed.Changes
New shared mcp-scripts wrapper
.github/workflows/shared/github-mcp-pagination-wrappers.md— defineslist_workflowsandlist_labelas shell-based MCP tools that call the GitHub REST API directly with properper_pagesupport. Import into any workflow to activate:per_page=10, acceptpage, validate the 1–100 range, and return structured JSON includingper_pageandpagein the response.Skill scripts
.github/skills/github-workflows-query/query-workflows.sh— callsGET /repos/{owner}/{repo}/actions/workflows?per_page={n}&page={n}; returnstotal_count,per_page,page,workflows[].github/skills/github-labels-query/query-labels.sh— callsGET /repos/{owner}/{repo}/labels?per_page={n}&page={n}; returnslabels[],item_count,per_page,pageBoth scripts support
INPUT_*env vars (mcp-scripts convention) and--flagCLI args interchangeably.Documentation
.github/aw/github-mcp-server.md— addsmethod,per_page,pageto the documented parameters ofactions_list(canonical tool behind thelist_workflowsalias)Tests
actions/setup/js/github_mcp_pagination_wrappers.test.cjs— 15 vitest regression tests; key cases:per_page=1returns exactly one item, defaultper_page=10is applied, out-of-range values are rejected, and response shapes are validated for both tools