Skip to content

Pagination broken: searchJiraIssuesUsingJql never returns nextPageToken or pagination metadata #118

Description

@atk-flywheel

Pagination broken: searchJiraIssuesUsingJql never returns nextPageToken or pagination metadata

Summary

The searchJiraIssuesUsingJql tool never returns pagination fields (nextPageToken, nextCursor, isLast) in its response,
making it impossible to paginate beyond the first page of results.
The totalCount field in the response reflects the number of results on the current page (equal to maxResults),
not the total number of matching issues, which makes it unusable for detecting whether more pages exist.

Environment

  • MCP endpoint: https://mcp.atlassian.com/v1/mcp
  • Tool: searchJiraIssuesUsingJql
  • Client: Claude Code (claude-code CLI)
  • Date observed: March 20, 2026
  • Jira Cloud instance: Confirmed on at least one production Jira Cloud tenant

Expected behavior (per MCP pagination spec)

Per the MCP Pagination specification,
servers should return a nextCursor field (or in the Atlassian MCP's case, nextPageToken) when more results exist.
Clients treat a missing cursor as the end of results.

The tool's input schema accepts a nextPageToken parameter,
and the skills documentation in this repo
instructs agents to "use nextPageToken from results" for pagination.
This confirms pagination was designed to work.

Actual behavior

The response envelope only contains three keys:

{
  "issues": {
    "totalCount": 20,
    "nodes": [ ... ],
    "webUrl": "https://..."
  }
}
  • No nextPageToken, nextCursor, or isLast field is returned, regardless of whether more results exist.

  • totalCount equals maxResults (or the number of nodes if fewer results exist), not the true total matching the JQL query.

  • Attempting to pass a value for the nextPageToken input parameter returns an error:

    {"errorMessages": ["The provided next page token is invalid or expired."], "errors": {}}

Reproduction steps

  1. Connect to the Atlassian MCP server

  2. Call searchJiraIssuesUsingJql with a JQL query that matches more results than maxResults:

    {
      "cloudId": "<your-cloud-id>",
      "jql": "project = <PROJECT> AND fixVersion = \"<version>\"",
      "fields": ["key", "summary"],
      "maxResults": 5
    }
  3. Observe the response:

    • totalCount equals 5 (matches maxResults, not the true total)
    • No nextPageToken or isLast field is present
    • Only nodes, totalCount, and webUrl keys exist
  4. Repeat with maxResults: 20 and maxResults: 100 on the same query:

    • totalCount changes to 20 and 100 respectively, always matching maxResults
    • No pagination metadata is ever returned
  5. Try passing nextPageToken: "5" or any value:

    • Returns error: "The provided next page token is invalid or expired."

Impact

  • Any JQL query returning more results than maxResults (max 100) silently drops results with no indication that more exist.
  • Agents following the documented pagination pattern (nextPageToken from results) will always see a missing token and conclude pagination is complete after the first page.
  • There is no workaround within the MCP tool itself. The only mitigation is to use JQL ORDER BY key ASC with AND key > "LAST-KEY" to manually paginate, but this is fragile and undocumented.

Likely root cause

This issue aligns with widely reported pagination problems in Atlassian's newer
/rest/api/3/search/jql endpoint, which replaced the deprecated /rest/api/2/search endpoint.
The newer endpoint has known issues with nextPageToken handling:

  • Tokens that return the first page in an infinite loop
  • Tokens returned as "expired" immediately
  • isLast never returning true
  • Pagination fields missing entirely from responses

The MCP server appears to be using this newer endpoint but not receiving
(or not forwarding) the pagination fields from the underlying API response.

Community references

These Atlassian Community threads document the same underlying API pagination issues:

Suggested fix

  1. Return nextPageToken (or nextCursor per the MCP spec) in the response when more results exist.
  2. Return the true totalCount of matching issues, not the count of the current page.
  3. If the underlying Jira API is not providing reliable pagination tokens, consider falling back to the deprecated /rest/api/2/search endpoint which uses offset-based pagination (startAt + total) reliably, or implement server-side cursor management.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions