Skip to content

Pagination not working well #430

Open
@SamMorrowDrums

Description

@SamMorrowDrums
Collaborator

Often models seem to fall paginated tools with the same arguments repeatedly. If you explicitly tell the to stop and paginate through they seek to get it.

Suggestions:

  • maybe make pagination arguments required
  • edit the pagination field descriptions
  • possibly edit the descriptions of paginated tools too, to ensure the model understands it can/should page through.

Activity

williammartin

williammartin commented on May 26, 2025

@williammartin
Collaborator

Can you provide an example prompt that currently causes issues?

asiermartinez

asiermartinez commented on Jun 2, 2025

@asiermartinez

I encountered the same issue using the prompt: "Get all open pull requests for github/github-mcp-server and calculate the total number." The process gets stuck in an infinite loop, repeatedly making the same API calls.

SamMorrowDrums

SamMorrowDrums commented on Jun 10, 2025

@SamMorrowDrums
CollaboratorAuthor
Can you create a static html page showcasing all the contributors to the GitHub MCP project the repo is github/github-mcp-server? Please page through all merged PRs and make an SVG illustration showing the timeline of contributions, and if possible also show the user avatars and maybe profile links?

I used this prompt, and it kept getting page 1. Basically any pagination attempt often fails.

neilconway

neilconway commented on Jul 5, 2025

@neilconway

I encountered the same issue using the prompt: "Get all open pull requests for github/github-mcp-server and calculate the total number." The process gets stuck in an infinite loop, repeatedly making the same API calls.

I tried a similar prompt and got similarly suboptimal behavior. Telling the model about pagination in the prompt seemed to help, e.g.,:

Note: by default, the `list_pull_requests` tool returns at most 30 pull requests
per call. Up to 100 pull requests can be returned in a single call by specifying
`perPage`. To return more pull requests, you should make multiple calls and use
pagination via the `page` parameter. You can tell when you have reached the end
of the pull requests when the number of returned pull requests is < `perPage`.

There is some discussion about adding support for paginated tool results in the MCP spec: modelcontextprotocol/modelcontextprotocol#799

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @asiermartinez@neilconway@williammartin@SamMorrowDrums@tonytrg

        Issue actions

          Pagination not working well · Issue #430 · github/github-mcp-server