Add batch/pagination support to Google Drive list-files and download-file#21429
Conversation
…file Resolves the request in issue #21206 to process large folders in set batches. list-files (0.3.1 -> 0.4.0): - Add `maxResults` to cap how many files are returned per run. pageSize is aligned to the remaining count so the returned nextPageToken lands exactly after the last kept file — no files are skipped when resuming. - Add `pageToken` input and return `{ files, count, nextPageToken, isComplete }` so a run can resume where a previous run stopped (stateless cursor). - Replace the `additionalProps()`-based `filterType` with a static optional prop. download-file (0.1.27 -> 0.2.0): - Add `fileIds` (string[]) to download multiple files in a single run; keep the single `fileId` for backwards compatibility. A single file returns the original object shape; a batch returns `{ files, count }`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughGoogle Drive actions now support multi-file downloads and bounded, resumable file listing. Download results preserve the legacy single-file shape, while batch downloads return counts and per-file results. Package version metadata was incremented. ChangesGoogle Drive actions
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)Download File batch flowsequenceDiagram
participant DownloadFile
participant GoogleDriveAPI
participant Result
DownloadFile->>GoogleDriveAPI: Resolve shortcuts and download or export files
GoogleDriveAPI-->>DownloadFile: File content and metadata
DownloadFile->>Result: Return single-file or batch result
List Files pagination flowsequenceDiagram
participant Caller
participant ListFiles
participant GoogleDriveAPI
Caller->>ListFiles: Provide filters, maxResults, and pageToken
ListFiles->>GoogleDriveAPI: Request remaining files
GoogleDriveAPI-->>ListFiles: Files and nextPageToken
ListFiles-->>Caller: Return files and pagination state
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@components/google_drive/actions/list-files/list-files.mjs`:
- Around line 11-12: Update the action version from 0.4.0 to the next major
version to reflect the breaking return-value change, and update the matching
version in the Google Drive component’s package.json.
- Around line 123-126: Update the maxResults validation in the list-files action
to coerce this.maxResults with Number before checking it. Validate the coerced
value as a positive integer, preserving the existing undefined handling and
ConfigurationError message.
In `@components/google_drive/package.json`:
- Line 3: Update the version in the app package.json from the patch bump 1.12.3
to at least the required minor version 1.13.0, matching the largest component
version change. Leave the component version updates unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1c2fded9-cca9-4f5a-a492-30279f51283d
📒 Files selected for processing (3)
components/google_drive/actions/download-file/download-file.mjscomponents/google_drive/actions/list-files/list-files.mjscomponents/google_drive/package.json
…e minor
- list-files 0.4.0 -> 1.0.0: the return value changed from an array to an
object ({ files, count, nextPageToken, isComplete }), a breaking change.
- Coerce `maxResults` with Number() before validating so integer values passed
as strings (e.g. via MCP tool input) are accepted; undefined still means no cap.
- Bump components/google_drive/package.json 1.12.3 -> 1.13.0 to reflect the
feature additions.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ashwins01
left a comment
There was a problem hiding this comment.
LGTM, except for just this one version change.
Co-authored-by: Ashwin Srinivas <103921345+ashwins01@users.noreply.github.com>
MCP Eval Results — google_drive (PR-scoped)5/5 passed (100%) | 2.6 avg tool calls | 63.9s
Each eval also called a
🤖 Generated with Claude Code |
Summary
Adds batch / pagination support to the Google Drive list-files and download-file actions so large folders can be processed in set batches, per the request in #21206.
list-files(0.3.1 → 0.4.0)Max Results— caps how many files are returned per run.pageSizeis aligned to the number still needed, so the returnednextPageTokenlands exactly after the last kept file — no files are skipped when resuming (a naive "fetch a full page then trim" approach would drop the remainder).Page Tokeninput + returns{ files, count, nextPageToken, isComplete }— pass the previous run'snextPageTokenback in to continue where it stopped (stateless cursor).additionalProps()-basedfilterTypewith a static optional prop.download-file(0.1.27 → 0.2.0)Files(fileIds, string[]) — download multiple files in a single run. The legacy singleFile(fileId) is retained for backwards compatibility; both are merged and de-duped.{ files, count }. Errors ifDestination File Pathis set with multiple files.Testing
Published both to a private registry and ran targeted MCP evals — 5/5 passed:
list-files: folder listing;Max Resultscap (returned exactly 2, flagged more remain); page-token resume (fetched next page with no overlap).download-file: single-file (backwards compat); batch (one call with 3 file IDs returned all three).Closes #21206
🤖 Generated with Claude Code
Summary by CodeRabbit
Max Resultslimiting, andPage Tokenpagination with resume support.{ files, count, nextPageToken, isComplete }to reflect pagination state.