Skip to main content
Glama

export_file

Read-only

Exports Google Drive files as in-memory content, converting Docs, Sheets, and Slides to a requested format for immediate processing.

Instructions

Export or download a file from Google Drive.

Prefer download_file when saving to disk — this tool returns raw base64-encoded bytes for binary formats (xlsx, pdf, docx, etc.) that require manual decoding. Use export_file only when you need the file content in-memory.

For Google Workspace files (Docs, Sheets, Slides) the file is converted to the requested format. For non-Google files the raw content is downloaded.

Supported export_format values: All Google types: 'pdf', 'html' Google Docs: 'txt', 'docx', 'odt', 'rtf', 'epub' Google Sheets: 'csv', 'xlsx', 'ods' Google Slides: 'pptx' Non-Google files: 'raw'

Args: file_id: The Google Drive file ID. export_format: One of the format strings above.

Returns: fileId, name, mime_type, format, encoding ('utf-8' or 'base64'), content. Text formats (txt, html, csv, rtf) are returned as plain strings; all others are base64-encoded bytes. Raises ValueError if the response exceeds a safety cap (see MAX_TOOL_RESPONSE_CHARS in docs/configuration.md for the configured default) — base64 encoding inflates raw file size by ~33%, so binary exports hit this cap at a much smaller file size than text ones. Call download_file instead for anything but small files; it writes raw bytes straight to disk with no base64/JSON overhead.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "file_id": "<file_id>",
      "export_format": "<export_format>"
    },
    "name": "export_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
file_idYes
export_formatYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only supply readOnlyHint=true, but the description adds substantial behavior beyond that: Workspace files are converted while non-Google files are downloaded raw, text formats return plain strings vs. base64 for everything else, and a ValueError is raised when the response exceeds a configured cap. It even explains the ~33% base64 inflation and why binary files hit the cap sooner — exactly the kind of failure-mode context an agent needs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well front-loaded: the primary action and the sibling preference come first, followed by format tables and return details. Minor redundancy — the download_file-for-large-files warning appears twice (opening paragraph and the ValueError note) — costs it a point but the structure remains scannable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite an output schema existing, the description still usefully clarifies encoding behavior and which formats are strings vs. bytes. Combined with the size-cap warning and format matrix, nothing an agent needs to invoke this correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% (params are bare strings with no descriptions, and export_format has no enum), so the description must carry the full burden — and it does, enumerating valid export_format values per Google type plus 'raw' for non-Google files. It also identifies file_id as the Drive file ID.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Export or download a file from Google Drive') and immediately contrasts itself with the `download_file` sibling, so an agent can distinguish the two without opening either schema. The scope (in-memory vs. disk) is made explicit in the first two sentences.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly names the alternative (`download_file`) and the condition that selects it ('Prefer download_file when saving to disk', 'Use export_file only when you need the file content in-memory'), repeated with a second concrete criterion (size cap / base64 overhead). Both when-to-use and when-not-to-use are covered.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools