Google Drive.
Prerequisites
- Create a Google Cloud project or use an existing project
- Enable the Google Drive API
- Authorize credentials for desktop app
- pip install -U google-api-python-client google-auth-httplib2 google-auth-oauthlib
Retrieve the Google Docs
By default, theGoogleDriveRetriever expects the credentials.json file to be ~/.credentials/credentials.json, but this is configurable using the GOOGLE_ACCOUNT_FILE environment variable.
The location of token.json uses the same directory (or use the parameter token_path). Note that token.json will be created automatically the first time you use the retriever.
GoogleDriveRetriever can retrieve a selection of files with some requests.
By default, If you use a folder_id, all the files inside this folder can be retrieved to Document.
You can obtain your folder and document id from the URL:
- Folder: drive.google.com/drive/u/0/folders/1yucgL9WGgWZdM1TOuKkeghlPizuzMYb5 -> folder id is "1yucgL9WGgWZdM1TOuKkeghlPizuzMYb5"
- Document: docs.google.com/document/d/1bfaMQ18_i56204VaQDVeAFpqEijJTgvurupdEDiaUQw/edit -> document id is "1bfaMQ18_i56204VaQDVeAFpqEijJTgvurupdEDiaUQw"
root is for your personal home.
Document.
- text/text
- text/plain
- text/html
- text/csv
- text/markdown
- image/png
- image/jpeg
- application/epub+zip
- application/pdf
- application/rtf
- application/vnd.google-apps.document(GDoc)
- application/vnd.google-apps.presentation(GSlide)
- application/vnd.google-apps.spreadsheet(GSheet)
- application/vnd.google.colaboratory(Notebook colab)
- application/vnd.openxmlformats-officedocument.presentationml.presentation(PPTX)
- application/vnd.openxmlformats-officedocument.wordprocessingml.document(DOCX)
GoogleDriveRetriever.
But, the corresponding packages must be installed.
| Template | Description | 
|---|---|
| gdrive-all-in-folder | Return all compatible files from a folder_id | 
| gdrive-query | Search queryin all drives | 
| gdrive-by-name | Search file with name query | 
| gdrive-query-in-folder | Search queryinfolder_id(and sub-folders in_recursive=true) | 
| gdrive-mime-type | Search a specific mime_type | 
| gdrive-mime-type-in-folder | Search a specific mime_typeinfolder_id | 
| gdrive-query-with-mime-type | Search querywith a specificmime_type | 
| gdrive-query-with-mime-type-and-folder | Search querywith a specificmime_typeand infolder_id | 
PromptTemplate
Use Google Drive ‘description’ metadata
Each Google Drive has adescription field in metadata (see the details of a file).
Use the snippets mode to return the description of selected files.
Connect these docs programmatically to Claude, VSCode, and more via MCP for    real-time answers.