Skip to content

feat(sdk): return paged list results so models stop repeating the same page - #119

Merged
HugoRCD merged 1 commit into
mainfrom
feat/sdk-paged-list-context
Aug 31, 2026
Merged

feat(sdk): return paged list results so models stop repeating the same page#119
HugoRCD merged 1 commit into
mainfrom
feat/sdk-paged-list-context

Conversation

@HugoRCD

@HugoRCD HugoRCD commented Aug 31, 2026

Copy link
Copy Markdown
Member

🔗 Linked issue

📚 Description

REST list tools used to return a bare array with no hasMore, and several schemas (listCommits, listIssues, listPullRequests, …) dropped page — unknown page inputs were stripped by Zod, so every call returned page 1. That made it cheap for a model to loop the same list until a length cutoff.

List tools now return { items, hasMore, page, perPage, nextPage } (object-shaped lists add the same paging fields next to checkRuns / runs / …). When hasMore, call with nextPage or raise maxPages. getRepositoryTree accepts a path prefix; tree listings and large diffs are capped in the model-facing output.

This changes the execute result shape for previously array-valued list tools (result.items instead of mapping the array directly).

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Test plan

  • pnpm --filter @github-tools/sdk test (pagination + model-output caps)
  • Call listCommits twice: first page has hasMore/nextPage; second call with nextPage returns a different window
  • Confirm listCommits({ page: 2 }) is not stripped (Zod accepts page)
  • getRepositoryTree with path filters entries; recursive trees over 200 entries set truncated / entriesOmitted in toModelOutput

…e page

REST list tools now expose hasMore and nextPage, restore page on schemas that dropped it, and cap tree/diff payloads in toModelOutput.
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
github-tools-docs Ready Ready Preview, v0 Aug 31, 2026 8:45am
github-tools-test-agent Ready Ready Preview, v0 Aug 31, 2026 8:45am

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@HugoRCD HugoRCD self-assigned this Aug 31, 2026
@HugoRCD
HugoRCD merged commit 8bcb3fb into main Aug 31, 2026
15 checks passed
@HugoRCD
HugoRCD deleted the feat/sdk-paged-list-context branch August 31, 2026 08:53
@github-actions github-actions Bot mentioned this pull request Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant