Skip to content

Add pagination support to GraphQL-based tools #683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2f95120
initial pagination for `ListDiscussions`
mattdholloway Jul 15, 2025
d464ac1
redo category id var cast
mattdholloway Jul 15, 2025
d745f5c
add GraphQL pagination support for discussion comments and categories
mattdholloway Jul 15, 2025
83c0a74
remove pageinfo returns
mattdholloway Jul 15, 2025
f47e554
fix out ref for linter
mattdholloway Jul 15, 2025
c9d6e1f
update docs
mattdholloway Jul 15, 2025
88f1255
Merge branch 'main' into add-pagination-graphql
mattdholloway Jul 15, 2025
9a08648
move to unified pagination for consensus on params
mattdholloway Jul 16, 2025
5c8b4a7
update docs
mattdholloway Jul 16, 2025
6bb5daf
refactor pagination handling
mattdholloway Jul 16, 2025
6d00394
update docs
mattdholloway Jul 16, 2025
d2dd8f2
linter fix
mattdholloway Jul 16, 2025
3cab7b1
conv rest to gql params for safe lint
mattdholloway Jul 16, 2025
f701670
add nolint
mattdholloway Jul 16, 2025
30e01f4
add error handling for perPage value in ToGraphQLParams
mattdholloway Jul 16, 2025
b454926
refactor pagination error handling
mattdholloway Jul 16, 2025
98fd144
unified params for rest andn graphql and rennamed to be uniform for g…
mattdholloway Jul 16, 2025
1099990
add 'after' for pagination
mattdholloway Jul 16, 2025
752499b
update docs
mattdholloway Jul 16, 2025
548d4d7
Update pkg/github/discussions.go
mattdholloway Jul 17, 2025
592940e
Update pkg/github/discussions.go
mattdholloway Jul 17, 2025
b09612e
Update pkg/github/discussions_test.go
mattdholloway Jul 17, 2025
e21635c
update default page size const
mattdholloway Jul 17, 2025
2d36b04
Merge branch 'main' into add-pagination-graphql
mattdholloway Jul 17, 2025
985f8b2
reduce default pagination size from 100 to 30 in discussion tests
mattdholloway Jul 17, 2025
5d795ec
update pagination for reverse and total
mattdholloway Jul 17, 2025
7877d8d
update pagination to remove from discussions
mattdholloway Jul 18, 2025
f870807
updated README
mattdholloway Jul 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,21 +581,21 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
- `repo`: Repository name (string, required)

- **get_discussion_comments** - Get discussion comments
- `after`: Cursor for pagination. Use the endCursor from the previous page's PageInfo for GraphQL APIs. (string, optional)
- `discussionNumber`: Discussion Number (number, required)
- `owner`: Repository owner (string, required)
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
- `repo`: Repository name (string, required)

- **list_discussion_categories** - List discussion categories
- `after`: Cursor for pagination, use the 'after' field from the previous response (string, optional)
- `before`: Cursor for pagination, use the 'before' field from the previous response (string, optional)
- `first`: Number of categories to return per page (min 1, max 100) (number, optional)
- `last`: Number of categories to return from the end (min 1, max 100) (number, optional)
- `owner`: Repository owner (string, required)
- `repo`: Repository name (string, required)

- **list_discussions** - List discussions
- `after`: Cursor for pagination. Use the endCursor from the previous page's PageInfo for GraphQL APIs. (string, optional)
- `category`: Optional filter by discussion category ID. If provided, only discussions with this category are listed. (string, optional)
- `owner`: Repository owner (string, required)
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
- `repo`: Repository name (string, required)

</details>
Expand Down
16 changes: 8 additions & 8 deletions pkg/github/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ func ListWorkflows(getClient GetClientFn, t translations.TranslationHelperFunc)

// Set up list options
opts := &github.ListOptions{
PerPage: pagination.perPage,
Page: pagination.page,
PerPage: pagination.PerPage,
Page: pagination.Page,
}

workflows, resp, err := client.Actions.ListWorkflows(ctx, owner, repo, opts)
Expand Down Expand Up @@ -200,8 +200,8 @@ func ListWorkflowRuns(getClient GetClientFn, t translations.TranslationHelperFun
Event: event,
Status: status,
ListOptions: github.ListOptions{
PerPage: pagination.perPage,
Page: pagination.page,
PerPage: pagination.PerPage,
Page: pagination.Page,
},
}

Expand Down Expand Up @@ -503,8 +503,8 @@ func ListWorkflowJobs(getClient GetClientFn, t translations.TranslationHelperFun
opts := &github.ListWorkflowJobsOptions{
Filter: filter,
ListOptions: github.ListOptions{
PerPage: pagination.perPage,
Page: pagination.page,
PerPage: pagination.PerPage,
Page: pagination.Page,
},
}

Expand Down Expand Up @@ -1025,8 +1025,8 @@ func ListWorkflowRunArtifacts(getClient GetClientFn, t translations.TranslationH

// Set up list options
opts := &github.ListOptions{
PerPage: pagination.perPage,
Page: pagination.page,
PerPage: pagination.PerPage,
Page: pagination.Page,
}

artifacts, resp, err := client.Actions.ListWorkflowRunArtifacts(ctx, owner, repo, runID, opts)
Expand Down
Loading
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy