fix: add supportsAllDrives to gdrive_read_file for Shared Drive support#24
Open
miyamoto-kenji wants to merge 3 commits intoisaacphi:mainfrom
Open
fix: add supportsAllDrives to gdrive_read_file for Shared Drive support#24miyamoto-kenji wants to merge 3 commits intoisaacphi:mainfrom
miyamoto-kenji wants to merge 3 commits intoisaacphi:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gdrive_read_filereturns 404 for files stored in Shared Drives becausesupportsAllDrives: trueis missing fromfiles.get()callsgdrive_searchalready setssupportsAllDrives: true,includeItemsFromAllDrives: true, andcorpora: "allDrives", so Shared Drive files appear in search results but cannot be readsupportsAllDrives: trueto bothfiles.get()calls inreadGoogleDriveFile(metadata fetch and content download)Steps to reproduce
gdrive_searchto find the file — it appears in results with correct fileIdgdrive_read_filewith the same fileId — returnsMCP error 404: File not foundFix
Added
supportsAllDrives: trueto the twodrive.files.get()calls intools/gdrive_read_file.ts:fields: "mimeType,name")alt: "media")This aligns
gdrive_read_filewith the existing behavior ofgdrive_search, which already supports Shared Drives.Reference
Google Drive API documentation — files.get:
🤖 Generated with Claude Code