Skip to content

fix(mcp): omit nextCursor when no more pages in tools/list#50

Open
KQAR wants to merge 1 commit intoChesterRa:mainfrom
KQAR:fix/mcp-tools-list-infinite-pagination
Open

fix(mcp): omit nextCursor when no more pages in tools/list#50
KQAR wants to merge 1 commit intoChesterRa:mainfrom
KQAR:fix/mcp-tools-list-infinite-pagination

Conversation

@KQAR
Copy link
Contributor

@KQAR KQAR commented Mar 3, 2026

Previously, tools/list always returned "nextCursor": "" even when all tools fit in a single page. Cursor-agent treats any present nextCursor (including empty string) as "more pages available", causing an infinite pagination loop (~170k requests in 55s) that exhausts the V8 heap and crashes with OOM.

Only include nextCursor in the response when there are actually more pages to fetch.

Made-with: Cursor

Previously, tools/list always returned `"nextCursor": ""` even when
all tools fit in a single page. Cursor-agent treats any present
nextCursor (including empty string) as "more pages available",
causing an infinite pagination loop (~170k requests in 55s) that
exhausts the V8 heap and crashes with OOM.

Only include nextCursor in the response when there are actually
more pages to fetch.

Made-with: Cursor
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