Skip to content

fix: add supportsAllDrives to gdrive_read_file for Shared Drive support#24

Open
miyamoto-kenji wants to merge 3 commits intoisaacphi:mainfrom
miyamoto-kenji:fix/support-shared-drives-in-read-file
Open

fix: add supportsAllDrives to gdrive_read_file for Shared Drive support#24
miyamoto-kenji wants to merge 3 commits intoisaacphi:mainfrom
miyamoto-kenji:fix/support-shared-drives-in-read-file

Conversation

@miyamoto-kenji
Copy link
Copy Markdown

Summary

  • gdrive_read_file returns 404 for files stored in Shared Drives because supportsAllDrives: true is missing from files.get() calls
  • gdrive_search already sets supportsAllDrives: true, includeItemsFromAllDrives: true, and corpora: "allDrives", so Shared Drive files appear in search results but cannot be read
  • This PR adds supportsAllDrives: true to both files.get() calls in readGoogleDriveFile (metadata fetch and content download)

Steps to reproduce

  1. Store a file in a Google Shared Drive
  2. Use gdrive_search to find the file — it appears in results with correct fileId
  3. Use gdrive_read_file with the same fileId — returns MCP error 404: File not found

Fix

Added supportsAllDrives: true to the two drive.files.get() calls in tools/gdrive_read_file.ts:

  • Line 47: metadata fetch (fields: "mimeType,name")
  • Line 87: content download (alt: "media")

This aligns gdrive_read_file with the existing behavior of gdrive_search, which already supports Shared Drives.

Reference

Google Drive API documentation — files.get:

Whether the requesting application supports both My Drives and shared drives. (Default: false)

🤖 Generated with Claude Code

miyamoto-kenji and others added 3 commits March 28, 2026 08:18
gdrive_read_file fails with 404 when reading files stored in Shared
Drives (formerly Team Drives), because the Google Drive API requires
`supportsAllDrives: true` on `files.get()` calls to access Shared
Drive files.

gdrive_search already sets supportsAllDrives, includeItemsFromAllDrives,
and corpora: "allDrives", so files in Shared Drives appear in search
results. However, gdrive_read_file does not set supportsAllDrives,
causing a confusing situation where files can be found but not read.

This commit adds supportsAllDrives: true to both files.get() calls in
readGoogleDriveFile (metadata fetch and content download).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PDFや画像などのバイナリファイルがBase64文字列として返されていたため、
Claude Codeで直接読み取れなかった。バイナリファイルは /tmp/gdrive-downloads/ に
保存してファイルパスを返すようにし、Read toolで読めるようにした。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- supportsAllDrives / includeItemsFromAllDrives を files.list() に追加
- Drive APIクエリ演算子(in parents, mimeType等)をそのまま渡せるように変更

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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