drive_file_read
Retrieve a Google Drive file's metadata or content by its ID. Export Docs, Sheets, and Slides content, download other files, and write binary content to a local path.
Instructions
Read a single Drive file by id. format: "metadata" (default) returns only metadata (including md5Checksum/sha1Checksum/sha256Checksum when available); format: "content" additionally fetches the file's actual content — exported for Google-native files (Docs/Sheets/Slides/...; see export_mime_type), downloaded as-is otherwise. Folders and shortcuts are rejected with an actionable error in content mode. Text content is returned inline; binary content is refused inline and requires output_file. When output_file is set, writes the content to that path and returns a short YAML summary instead of the inline body. Set verify: true (only with format: "content", only for non-Google-native files) to locally recompute the SHA-256 checksum of the fetched bytes and check it against Drive's reported sha256Checksum, failing clearly on a mismatch. Read-only. Mirrors omni-dev drive read. Output is YAML.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | `metadata` (default) returns only the file's metadata; `content` additionally fetches its actual content — exported for Google-native files (Docs/Sheets/Slides/...), downloaded as-is otherwise. | |
| verify | No | Only valid with `format: "content"`. When true, locally recomputes the SHA-256 checksum of the fetched bytes and checks it against Drive's reported `sha256Checksum`. Only supported for non-Google- native files — Drive never returns a checksum for exported content, so this errors immediately on a Google-native file. Fails clearly on a mismatch or a missing checksum. | |
| account | No | Selects a named Drive account instead of the ambient `--account`/`OMNI_DEV_DRIVE_ACCOUNT` resolution — e.g. `work`. Omit to use the resolved default account (or the legacy single-account credentials, if no named accounts are configured). Call `drive_account_list` to discover configured names. | |
| file_id | Yes | Drive file id (from `drive_search`, or the `id` segment of a Drive URL). Required. | |
| output_file | No | Only valid with `format: "content"`. When set, writes the fetched content to this path and returns a short YAML summary instead of the inline body — required for binary content (this tool refuses to return it inline), and recommended for large files that would exceed the response size limit. | |
| export_mime_type | No | Export MIME type for a Google-native file's content — only relevant with `format: "content"`, ignored otherwise. Defaults: Google Docs -> text/markdown, Sheets -> text/csv (first sheet only), Slides -> text/plain. Required for every other Google-native type (Forms, Drawings, Apps Script, Sites, ...); the error names the file's actually supported export MIME types. |