Skip to content

fix(mcp): a cut list page reports the rows it holds, not the page asked for (ZERNIO-1901) - #127

Merged
mikipalet merged 2 commits into
developfrom
fix/mcp-truncated-page-pagination
Nov 24, 2026
Merged

mikipalet merged 2 commits into
developfrom
fix/mcp-truncated-page-pagination

Conversation

@mikipalet

@mikipalet mikipalet commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Why

Feedback 6afec5e8235f576c53e34685 (ZERNIO-1901): list tools return 20 rows for limit=40 while pagination.limit stays 40 and total is unchanged.

The rows are cut in the MCP, not by the API: results over 80,000 characters are cut to the items that fit (src/late/mcp/response_format.py, #88), and the MCP's telemetry marks these calls truncated. It kept 20 of 40 items and said so only in the _truncated note, while pagination still described the page asked for. An agent that pages by page with its own limit then skips the cut items.

Evidence (Axiom zernio-mcp, this customer, 2026-11-19 08:00 to 10:30 UTC): posts_list_posts with limit 40 was cut in 38 of 41 calls (up to 99,513 characters before the cut), analytics_get_analytics in 3 of 39. No limit 20 call was cut.

What

  • A cut page that is numbered (page + limit) reports what it holds: limit is the kept count, page the equivalent page under it, pages is recomputed from total, hasMore is true when the API reported it. Following pagination reads every item once.
  • Responses with page and nextCursor (posts) are renumbered too and still lose nextCursor, which would skip the cut rows. Pages without page/limit keep the note, as before. The note now says to send limit and page together.

Follow-ups

  • posts_list_posts also takes offset, and the API answers page = floor(offset / limit) + 1. With an unaligned offset the rewritten page re-reads rows (it never skips any), as the note already did. A client that takes page from the response but keeps its own limit skips more from page 2 on than before; following both fields is right.
  • A call made with a cursor keeps page 1 in the API's answer, so a cut cursor page is renumbered from the top and following page re-reads rows (never skips); the note's cursor step is the right one there, as before.
  • The kept count is the largest divisor of the page size that fits, so a 40-item page that fits 32 is still cut to 20.

🤖 Generated with Claude Code

mikipalet and others added 2 commits November 24, 2026 11:51
…ed for (ZERNIO-1901)

A result over 80,000 characters keeps the first items that fit, aligned to a
divisor of the page size, but `pagination` still said limit=40 with the
untouched total while 20 items came back. An agent paging by `page` then
skipped the items that were cut. Only the `_truncated` note said so.

A cut page now carries the page and limit of the items it holds, `pages` from
`total`, and hasMore true, so following `pagination` reads every item once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rs below 1 are left alone

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mikipalet
mikipalet merged commit be2c486 into develop Nov 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant