MCPcopy
hub / github.com/github/github-mcp-server / OptionalPaginationParams

Function OptionalPaginationParams

pkg/github/params.go:396–414  ·  view source on GitHub ↗

OptionalPaginationParams returns the "page", "perPage", and "after" parameters from the request, or their default values if not present, "page" default is 1, "perPage" default is 30. In future, we may want to make the default values configurable, or even have this function returned from `withPaginat

(args map[string]any)

Source from the content-addressed store, hash-verified

394// function returned from `withPagination`, where the defaults are provided alongside
395// the min/max values.
396func OptionalPaginationParams(args map[string]any) (PaginationParams, error) {
397 page, err := OptionalIntParamWithDefault(args, "page", 1)
398 if err != nil {
399 return PaginationParams{}, err
400 }
401 perPage, err := OptionalIntParamWithDefault(args, "perPage", 30)
402 if err != nil {
403 return PaginationParams{}, err
404 }
405 after, err := OptionalParam[string](args, "after")
406 if err != nil {
407 return PaginationParams{}, err
408 }
409 return PaginationParams{
410 Page: page,
411 PerPage: perPage,
412 After: after,
413 }, nil
414}
415
416// OptionalCursorPaginationParams returns the "perPage" and "after" parameters from the request,
417// without the "page" parameter, suitable for cursor-based pagination only.

Callers 15

GetCommitFunction · 0.85
ListCommitsFunction · 0.85
ListBranchesFunction · 0.85
ListTagsFunction · 0.85
ListReleasesFunction · 0.85
ListStarredRepositoriesFunction · 0.85
IssueReadFunction · 0.85
prepareSearchArgsFunction · 0.85
ListNotificationsFunction · 0.85
ActionsListFunction · 0.85
SearchRepositoriesFunction · 0.85

Calls 1

Tested by 1