Skip to main content
Glama

Export a doc to a file

export_doc

Export a Google Doc to a real file on disk as PDF, DOCX, TXT, HTML, EPUB, MD, or other formats with editor-matching layout; target one tab if needed.

Instructions

Export a Google Doc to a real file on disk — pdf (default), docx, odt, rtf, txt, html, epub, or md. Google renders it server-side (File > Download in the UI), so page setup, pagination and layout match the editor. A doc path exports every tab; a tab path (/folder/doc/tab) exports only that tab, through an endpoint Google does not document and rate-limits — if it fails the call is refused and says so, it never falls back to the whole doc. Returns the local path and byte size. Note: Drive refuses to export files larger than 10 MB.

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": {
      "path": "<path>",
      "dir": "<dir>"
    },
    "name": "export_doc"
  }
}

Input Schema

NameRequiredDescriptionDefault
dirYesabsolute local folder to save the export into (created if missing)
pathYesThe doc: a Drive id or URL, or /folder/doc. A tab path names its doc.
formatNodefault pdf
accountNoGoogle account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account.
filenameNooverride the filename (default: the doc’s title + extension)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.0.0
    • removedInput schema / properties / documentId
      Removed value: -{
      -  "type": "string"
      -}
    • addedInput schema / properties / path
      Added value: +{
      +  "description": "The doc: a Drive id or URL, or /folder/doc. A tab path names its doc.",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "documentId",
      -  "dir"
      -]New value: +[
      +  "path",
      +  "dir"
      +]
  2. Addedv0.5.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so well: it discloses server-side rendering, the undocumented and rate-limited tab endpoint, a refusal-without-fallback failure mode, and the 10 MB Drive export limit. It also states the return values (local path and byte size), which is important given there is no output schema.

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

Conciseness5/5

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

Despite covering formats, rendering behavior, tab semantics, failure mode, return values, and size limits, every sentence is front-loaded and information-dense with no filler. The ordering moves from what the tool does to how it behaves to what it returns.

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?

For a five-parameter export tool with no output schema and no annotations, the description supplies everything needed: format defaults, tab-path behavior, rate-limit and size constraints, failure semantics, and return values. Nothing an agent needs in order to call it correctly is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: it explains that a doc path exports every tab while a tab path exports only that tab, and that pdf is the default format. The remaining parameters (dir, account, filename) are left to the schema.

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?

The description opens with a specific verb and resource ('Export a Google Doc to a real file on disk'), enumerates supported formats, and clearly distinguishes its output from siblings like read_doc by emphasizing a real file on disk. An agent can identify exactly what this tool produces without opening the schema.

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

Usage Guidelines4/5

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

It gives clear context for when to use it (saving a doc as a file with editor-faithful layout) and explains the tab-path vs doc-path distinction. It stops short of explicitly naming alternatives such as read_doc for in-memory reading, so it earns a 4 rather than a 5.

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