Skip to content

Conversation

@feliche93
Copy link

Summary

  • Add move_drive_file function to enable moving files between Google Drive folders
  • Fix critical scope mapping bug where "drive" scope wasn't properly mapped in SCOPE_GROUPS
  • Update README documentation to include the new Extended tier tool

Changes Made

  1. New Function: move_drive_file in gdrive/drive_tools.py

    • Supports moving files between folders using Google Drive API v3
    • Includes keep_in_original parameter for copy vs move operations
    • Comprehensive error handling and validation
    • Proper authentication decorators
  2. Bug Fix: Fixed scope mapping in auth/service_decorator.py

    • Added missing "drive": DRIVE_SCOPE mapping to SCOPE_GROUPS
    • This was preventing the function from working due to scope validation errors
  3. Documentation: Updated README.md

    • Added move_drive_file to the Google Drive tools table
    • Classified as Extended tier tool

Test Plan

  • Function implements properly with Google Drive API v3
  • Authentication scope mapping works correctly
  • Local testing with Claude Desktop MCP integration successful
  • Error handling validates inputs and provides clear messages

🤖 Generated with Claude Code

- 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]>
@taylorwilsdon taylorwilsdon requested review from Copilot and taylorwilsdon and removed request for Copilot September 18, 2025 20:21
@taylorwilsdon taylorwilsdon self-assigned this Sep 18, 2025
@taylorwilsdon taylorwilsdon added the enhancement New feature or request label Sep 18, 2025
Copy link
Contributor

Copilot AI left a 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_file function 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")
Copy link

Copilot AI Sep 28, 2025

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.

Suggested change
@require_google_service("drive", "drive")
@require_google_service("drive", "drive_file")

Copilot uses AI. Check for mistakes.
Comment on lines +605 to +608
if (
destination_metadata.get("mimeType") != "application/vnd.google-apps.folder"
and destination_folder_id != "root"
):
Copy link

Copilot AI Sep 28, 2025

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.

Suggested change
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":

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants