Skip to content

API Reference parrot_tools.google.drive

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.google.drive

View source

Google Drive tools for agents (FEAT-608, Module 7).

Class GoogleDriveToolkit

Google Drive tools delegating to :class:GoogleDriveFileManager.

Parameter Type Default Description
manager Optional[GoogleDriveFileManager] None Existing Drive manager. When supplied, it takes precedence.
google_client Optional[GoogleClient] None Authenticated client to adopt into a built manager.
root_id Optional[str] None Optional Drive folder id to use as the root.
root_path str '' Optional Drive path to use as the root.
shared_drive_id Optional[str] None Optional shared-drive id.
prefix str '' Drive-relative prefix beneath the configured root.
credentials Optional[Union[str, Dict[str, Any], Path]] None Google credential configuration for a built manager.
auth_mode str 'service_account' Google authentication mode.
scopes Optional[Union[str, List[str]]] None Optional Google OAuth scopes.
download_dir Optional[Union[str, Path]] None Local destination directory for downloads.
upload_root Optional[Union[str, Path]] None Local directory that confines upload_file sources. Defaults to download_dir so only files the toolkit itself downloaded (or the operator placed there) can be uploaded.
max_results int 50 Default maximum search results.
**kwargs Any {} Additional :class:AbstractToolkit configuration.

Attributes:

Attribute Type Description
tool_prefix str
auto_open bool
upload_root Path

Method GoogleDriveToolkit.list_files

List a Google Drive folder without recursing.

list_files(path: str = '', pattern: str = '*', include_folders: bool = False) -> Dict[str, Any]

Parameter Type Default Description
path str '' Folder path relative to the configured root.
pattern str '*' Glob pattern matched against entry names.
include_folders bool False Whether sub-folders are included.

Returns: Dict[str, Any] — A mapping containing entries, their count, and the requested path.

Method GoogleDriveToolkit.search_files

Search Google Drive files beneath an optional path prefix.

search_files(keywords: Optional[Union[str, List[str]]] = None, extension: Optional[str] = None, prefix: Optional[str] = None, max_results: Optional[int] = None) -> Dict[str, Any]

Parameter Type Default Description
keywords Optional[Union[str, List[str]]] None One or more filename keywords.
extension Optional[str] None Optional filename extension filter.
prefix Optional[str] None Optional Drive path beneath which to search.
max_results Optional[int] None Result limit applied after Drive filtering.

Returns: Dict[str, Any] — A mapping containing matching files, count, and truncation status.

Method GoogleDriveToolkit.download_file

Download a Drive file into the toolkit's local download directory.

download_file(path: str, destination_name: Optional[str] = None) -> Dict[str, Any]

Parameter Type Default Description
path str Drive-relative source file path.
destination_name Optional[str] None Optional local filename replacing the source basename.

Returns: Dict[str, Any] — A mapping describing the downloaded local file.

Method GoogleDriveToolkit.upload_file

Upload a local file to Google Drive.

source_path is resolved relative to :attr:upload_root and must not escape it (path traversal, symlinks pointing outside, absolute paths, NUL bytes are all rejected).

upload_file(source_path: str, destination: str, conflict_behavior: Optional[ConflictBehavior] = None) -> Dict[str, Any]

Parameter Type Default Description
source_path str Relative path under upload_root to the local file.
destination str Drive-relative destination path.
conflict_behavior Optional[ConflictBehavior] None Optional per-upload conflict policy. Applied under a lock so concurrent calls with different policies do not interfere.

Returns: Dict[str, Any] — A mapping describing the uploaded Drive file.

Raises:

  • ValueError — If source_path escapes the upload root.
  • FileNotFoundError — If the resolved file does not exist.

Method GoogleDriveToolkit.share_file

Create a Google Drive sharing permission and return its file link.

share_file(path: str, scope: ShareScope = 'user', role: ShareRole = 'reader', email_address: Optional[str] = None, domain: Optional[str] = None, expiry: int = 0) -> Dict[str, Any]

Parameter Type Default Description
path str Drive-relative file path.
scope ShareScope 'user' Permission scope.
role ShareRole 'reader' Permission role.
email_address Optional[str] None Recipient address for user or group permissions.
domain Optional[str] None Recipient domain for domain permissions.
expiry int 0 Optional permission expiry in seconds.

Returns: Dict[str, Any] — A mapping describing the created share permission.

Method GoogleDriveToolkit.get_file_link

Return a file's Drive web link without changing its permissions.

get_file_link(path: str) -> Dict[str, Any]

Parameter Type Default Description
path str Drive-relative file path.

Returns: Dict[str, Any] — A mapping containing the path and its web link.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally