feat: implement cursor pagination for dependabot alerts#2651
Conversation
…lated documentation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates the list_dependabot_alerts tool to use cursor-based pagination and to surface pagination metadata (next cursor) in the tool response.
Changes:
- Switched
list_dependabot_alertsfrom page-based pagination (page) to cursor pagination (after). - Updated the tool response format to wrap alerts with
pageInfo(includingnextCursor/hasNextPage). - Updated tests, tool snapshots, and README to reflect the new pagination input and output shape.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/github/dependabot.go | Implements cursor pagination for Dependabot alerts and returns alerts plus pageInfo envelope. |
| pkg/github/dependabot_test.go | Updates tests to use after and validates pageInfo.nextCursor/hasNextPage behavior. |
| pkg/github/toolsnaps/list_dependabot_alerts.snap | Updates the tool input schema snapshot to remove page and add after. |
| README.md | Updates documented inputs for list_dependabot_alerts to replace page with after. |
| response := map[string]any{ | ||
| "alerts": alerts, | ||
| "pageInfo": buildPageInfo(resp), | ||
| } | ||
|
|
||
| r, err := json.Marshal(response) | ||
| if err != nil { |
There was a problem hiding this comment.
This is intentionally changed to match the repo's existing cursor-pagination response pattern. The previous bare-array response could not support Dependabot cursor pagination end-to-end because the next cursor is only available from the response Link header. Returning { alerts, pageInfo } gives callers a usable pageInfo.nextCursor for subsequent requests.
| WithCursorPagination(schema) | ||
| // The Dependabot alerts REST endpoint uses cursor pagination via the response's | ||
| // Link header (surfaced as pageInfo.nextCursor), not GraphQL. Override the shared | ||
| // cursor description, which otherwise refers to a GraphQL PageInfo. | ||
| schema.Properties["after"].Description = "Forward pagination cursor from the previous response's pageInfo.nextCursor." |
Summary
Why
Fixes #2649 #2648
What changed
Fixes
list_dependabot_alertspagination by switching it from page-based pagination to cursor-based pagination.pageparameter fromlist_dependabot_alerts.afterandperPage.pageInfo, so callers can usepageInfo.nextCursorfor the next page.MCP impact
Prompts tested (tool changes only)
Security / limits
Tool renaming
deprecated_tool_aliases.goNote: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.
Lint & tests
./script/lint./script/testDocs