-
Notifications
You must be signed in to change notification settings - Fork 246
Add move_drive_file functionality for Google Drive #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add move_drive_file functionality for Google Drive #208
Conversation
- Add move_drive_file function to allow moving files between folders - Implement proper error handling and validation for file moves - Support both move and copy operations with keep_in_original parameter - Fix scope mapping bug where "drive" scope wasn't mapped in SCOPE_GROUPS - Update README.md to document the new Extended tier tool 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds functionality to move files between Google Drive folders and fixes a critical authentication bug. The core purpose is enabling file organization within Google Drive through a new move_drive_file tool.
- Adds a new
move_drive_filefunction with support for both move and copy operations - Fixes missing "drive" scope mapping that was preventing proper authentication
- Updates documentation to reflect the new Extended tier tool
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| gdrive/drive_tools.py | Adds move_drive_file function and applies code formatting improvements |
| auth/service_decorator.py | Fixes critical bug by adding missing "drive" scope to SCOPE_GROUPS mapping |
| README.md | Documents the new move_drive_file tool in the Google Drive tools table |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| @server.tool() | ||
| @handle_http_errors("move_drive_file", service_type="drive") | ||
| @require_google_service("drive", "drive") |
Copilot
AI
Sep 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scope 'drive' used in the decorator requires full Drive access, which is overly permissive for a move operation. Consider using 'drive_file' scope instead, which provides sufficient permissions for file operations while following the principle of least privilege.
| @require_google_service("drive", "drive") | |
| @require_google_service("drive", "drive_file") |
| if ( | ||
| destination_metadata.get("mimeType") != "application/vnd.google-apps.folder" | ||
| and destination_folder_id != "root" | ||
| ): |
Copilot
AI
Sep 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation logic incorrectly allows 'root' to bypass the folder type check. The root folder should have mimeType 'application/vnd.google-apps.folder', but this condition treats 'root' as a special case without proper validation. This could lead to unexpected behavior if 'root' is used incorrectly.
| if ( | |
| destination_metadata.get("mimeType") != "application/vnd.google-apps.folder" | |
| and destination_folder_id != "root" | |
| ): | |
| if destination_metadata.get("mimeType") != "application/vnd.google-apps.folder": |
Summary
move_drive_filefunction to enable moving files between Google Drive foldersSCOPE_GROUPSChanges Made
New Function:
move_drive_fileingdrive/drive_tools.pykeep_in_originalparameter for copy vs move operationsBug Fix: Fixed scope mapping in
auth/service_decorator.py"drive": DRIVE_SCOPEmapping toSCOPE_GROUPSDocumentation: Updated README.md
move_drive_fileto the Google Drive tools tableTest Plan
🤖 Generated with Claude Code