Skip to content

Add batch/pagination support to Google Drive list-files and download-file#21429

Merged
michelle0927 merged 4 commits into
masterfrom
mcp/google-drive-issue-21206
Jul 21, 2026
Merged

Add batch/pagination support to Google Drive list-files and download-file#21429
michelle0927 merged 4 commits into
masterfrom
mcp/google-drive-issue-21206

Conversation

@michelle0927

@michelle0927 michelle0927 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

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. pageSize is aligned to the number still needed, so the returned nextPageToken lands 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 Token input + returns { files, count, nextPageToken, isComplete } — pass the previous run's nextPageToken back in to continue where it stopped (stateless cursor).
  • Replaced the additionalProps()-based filterType with a static optional prop.

Design note: the issue suggested persisting the cursor via a Data Store. Pipedream doesn't allow a data_store prop to be optional (it would become mandatory on every run, including simple "list everything" calls), so this uses a stateless pageToken in/out instead — fully optional and equally able to resume across runs.

⚠️ Output shape change: list-files now returns an object ({ files, ... }) instead of a bare array. Bumped as a minor version.

download-file (0.1.27 → 0.2.0)

  • Files (fileIds, string[]) — download multiple files in a single run. The legacy single File (fileId) is retained for backwards compatibility; both are merged and de-duped.
  • A single file returns the original object shape; a batch returns { files, count }. Errors if Destination File Path is set with multiple files.

Testing

Published both to a private registry and ran targeted MCP evals — 5/5 passed:

  • list-files: folder listing; Max Results cap (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

  • New Features
    • Download multiple Google Drive files in one run (deduplicated), while preserving the existing single-file flow.
    • List files with selectable match type, per-run Max Results limiting, and Page Token pagination with resume support.
  • Bug Fixes
    • Improved export-format option handling for downloads when selecting batches.
    • Added validation for download/list input rules and limits.
  • Chores
    • Updated action versions and user-facing descriptions; listing results now return { files, count, nextPageToken, isComplete } to reflect pagination state.

…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>
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Jul 21, 2026 2:53pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 515641ea-af28-41a5-9a79-8ed851623f70

📥 Commits

Reviewing files that changed from the base of the PR and between f928c58 and 5997a56.

📒 Files selected for processing (1)
  • components/google_drive/package.json

📝 Walkthrough

Walkthrough

Google 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.

Changes

Google Drive actions

Layer / File(s) Summary
Download File batching and compatibility
components/google_drive/actions/download-file/download-file.mjs
Adds Files batch input, combines it with legacy File selection, validates batch constraints, reuses shortcut/export handling, and returns single-file or { files, count } results.
List Files filtering and pagination
components/google_drive/actions/list-files/list-files.mjs, components/google_drive/package.json
Adds filter and pagination inputs, supports pageToken resumption and maxResults limits, returns pagination metadata, and increments the package version.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

Download File batch flow

sequenceDiagram
  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
Loading

List Files pagination flow

sequenceDiagram
  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
Loading

Suggested reviewers: ashwins01, mariano-pd, vetrivigneshwaran

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding batch and pagination support to the Google Drive actions.
Description check ✅ Passed The PR description covers the summary, version changes, testing, and issue closure, though the checklist template isn't fully filled out.
Linked Issues check ✅ Passed The changes address #21206 by adding a per-run limit and resume cursor, enabling fixed-size file processing from large folders.
Out of Scope Changes check ✅ Passed The changes stay focused on the Google Drive actions and package version bump, with no obvious unrelated code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mcp/google-drive-issue-21206

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between e71e7d4 and d2be2ae.

📒 Files selected for processing (3)
  • components/google_drive/actions/download-file/download-file.mjs
  • components/google_drive/actions/list-files/list-files.mjs
  • components/google_drive/package.json

Comment thread components/google_drive/actions/list-files/list-files.mjs Outdated
Comment thread components/google_drive/actions/list-files/list-files.mjs Outdated
Comment thread components/google_drive/package.json Outdated
michelle0927 and others added 2 commits July 20, 2026 17:33
…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
ashwins01 previously approved these changes Jul 21, 2026

@ashwins01 ashwins01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, except for just this one version change.

Comment thread components/google_drive/package.json Outdated
Co-authored-by: Ashwin Srinivas <103921345+ashwins01@users.noreply.github.com>
@michelle0927

Copy link
Copy Markdown
Collaborator Author

MCP Eval Results — google_drive (PR-scoped)

5/5 passed (100%) | 2.6 avg tool calls | 63.9s
Model: claude-haiku-4-5-20251001 | Registry: private | Run against the republished list-files (v1.0.0) and download-file (v0.2.0)

# Eval Status Tools What it verifies
23 [list-files] List files in a folder ✅ pass 2 Folder-scoped listing returns all 4 files
24 [list-files] Cap results with Max Results ✅ pass 2 maxResults returns exactly 2, response flags more remain
25 [list-files] Resume with page token ✅ pass 3 Passing nextPageToken back fetches the next page with no overlap
26 [download-file] Download a single file ✅ pass 2 Backwards-compatible single-file download
27 [download-file] Download multiple files in one run ✅ pass 4 One download-file call with 3 file IDs downloads all three (batch path)

Each eval also called a find-folder/find-file helper to resolve names to IDs before the target tool — expected for these prompts.

Evals run via MCP against the two changed tools published to a private registry. Covers the new maxResults cap, stateless pageToken resume, and multi-file batch download.

🤖 Generated with Claude Code

@michelle0927
michelle0927 merged commit e33cee4 into master Jul 21, 2026
9 checks passed
@michelle0927
michelle0927 deleted the mcp/google-drive-issue-21206 branch July 21, 2026 15:42
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.

Google Drive

2 participants