Skip to content

Refactor Google Drive Server: Transition to Tool-Based Architecture with Enhanced File Handling #1353

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

MMoshtaghi
Copy link

Description

This PR transitions the server from a resource-based architecture to a tool-based architecture. It introduces new tools for interacting with Google Drive, improves error handling, and adds support for file downloads to a configurable directory.

Server Details

  • Server: Google Drive (example-servers/gdrive)
  • Changes to: Tools and resource handling logic

Motivation and Context

The changes simplify the server's architecture by focusing on tools rather than resources. This makes the server more modular, user-friendly, and aligned with its intended use cases. Additionally, the introduction of a configurable download directory enhances flexibility.

How Has This Been Tested?

The changes have been tested with an LLM client to ensure the following scenarios work as expected:

  • Listing files with pagination
  • Searching for files using a query
  • Downloading files to the specified directory
  • Exporting Google Docs/Sheets/Slides to appropriate formats

Breaking Changes

Yes, this change removes the ListResourcesRequestSchema and ReadResourceRequestSchema handlers. Users will need to update their MCP client configurations to use the new tools (gdrive_list_all, gdrive_search, and gdrive_read_file).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follow MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

  • Added the dotenv package to manage environment variables.
  • Introduced the GDRIVE_DOWNLOAD_DIRECTORY environment variable for specifying the download directory.

Copy link

@moonray moonray left a comment

Choose a reason for hiding this comment

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

Confirmed working

@olaservo olaservo added enhancement New feature or request server-gdrive Reference implementation for the Google Drive MCP server - src/gdrive labels Apr 18, 2025
Copy link
Member

@olaservo olaservo left a comment

Choose a reason for hiding this comment

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

Thanks for the PR - should we make this backwards compatible? I think we could still introduce these enhancements without breaking changes?

@MMoshtaghi
Copy link
Author

MMoshtaghi commented Apr 18, 2025

@olaservo

Yes, we could, and I made it backward compatible now.

  • Now we have 2 unnecessary resources (ListResourcesRequestSchema, ReadResourceRequestSchema) to which the model has no access and will never use.
  • I also changed the name of gdrive_search tool back to search

@MMoshtaghi MMoshtaghi requested a review from olaservo April 18, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server-gdrive Reference implementation for the Google Drive MCP server - src/gdrive
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants