Skip to main content
Glama

export_revision

Export a historical revision of a Google Sheet or Doc to recover cell data or Markdown; find the revision ID with list_revisions first.

Instructions

Export a historical revision of a Google Sheets file (cell data) or a Google Doc (Markdown). Use list_revisions to find the revision_id.

Google Sheets: downloads the revision as XLSX and returns the values for the requested sheet and range. Typical recovery workflow:

  1. list_revisions → find the revision ID from the timestamp before data was lost

  2. export_revision → read the affected range from that revision

  3. batch_update_cells → write the recovered values back to the current sheet Each call downloads the full file, so a large spreadsheet may be slow.

Google Docs: returns the revision as Markdown, converted the same way as get_doc_as_markdown. The Docs API can only read a document's current state, so the revision is exported as DOCX, imported into a temporary Google Doc, converted, and the temporary Doc is deleted (trashed if this identity can't delete it), so this call writes to Drive even though it changes nothing of yours. Expect several seconds per call. Two revisions' exports diff cleanly, with these differences from get_doc_as_markdown's output:

  • A link to a heading in the document renders as "#slug" (GitHub style), not a docs.google.com URL. A link to a bookmark, or to a heading that doesn't render as one (e.g. a heading in a table cell), is dropped, leaving its text.

  • An image renders as "image:sha256-", so an unchanged image doesn't show up in a diff. No viewable URL is returned: the temporary Doc's image URLs stop working once it's deleted.

  • Comments aren't included: they aren't part of a revision.

Args: file_id: The Google Drive file ID of the spreadsheet or document. revision_id: The revision ID from list_revisions. range: Sheets only. A1 notation range to return, e.g. "A1:D20". Omit for all data. sheet: Sheets only. Sheet (tab) name. Defaults to the first sheet. local_path: Docs only. Local path to write the Markdown to instead of returning it inline (the raw Markdown text, UTF-8). A directory path writes <file_id>-r<revision_id>.md inside it; a path ending in '/' is a directory, created if missing. A file in place of a parent directory, or at a path ending in '/', raises ValueError before the export; an existing file at a plain file path is replaced. Bypasses the response-size cap.

Returns: Sheets: revisionId, modifiedTime, sheet name, range, and values as a list of rows. Docs: revisionId, modifiedTime, and markdown, plus warning if the temporary Doc couldn't be removed (it names the Doc's ID). With local_path, local_path and bytes_written replace markdown. Raises ValueError for a file that is neither a Sheet nor a Doc, for an argument that doesn't apply to the file's type, for a revision ID that no longer exists, for a local_path with a non-directory component (checked before the export), or if a Docs response exceeds the size cap without local_path.

Note: For a Doc, a user identity (OAuth, or ADC with user credentials) creates the temporary Doc in My Drive root, not shared with anyone. That needs room in My Drive and permission to create files there, even when the default folder is a Shared Drive. A service account has no My Drive storage, so it uses the default folder, which must be a Shared Drive: that drive's members can open the copy while the export runs.

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>",
      "revision_id": "<revision_id>"
    },
    "name": "export_revision"
  }
}

Input Schema

NameRequiredDescriptionDefault
rangeNo
sheetNo
file_idYes
local_pathNo
revision_idYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.9.6

TDQS

A4.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false and destructiveHint=false, so the bar is lower, and the description adds real context: it explains why a read-shaped tool writes to Drive (temporary Doc creation and deletion, trashed if no delete permission) and flags slowness ('several seconds per call', 'downloads the full file'). However, the Annotation Contradiction check is not triggered but the note is nuanced: the honest disclosure that the call creates and then deletes a temporary Doc in My Drive root, needing storage and create permission, is exactly the behavioral context annotations cannot convey. The description does not, however, describe pagination or failure retry behavior beyond raising ValueError. A 3 reflects solid added context but not exhaustive behavioral coverage.

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?

Purpose and the 'use list_revisions to find the revision_id' routing line are front-loaded, then per-type sections, then Args/Returns/Note. Every block is on-topic, but the Docs rendering-difference bullets are long and the Note about service-account My Drive storage is dense; the definition is thorough rather than tight.

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 tool with two divergent modes, a 5-parameter schema at 0% coverage, and an output schema, the description covers what is needed: when to use it, per-mode arguments, return shapes for both modes (including the local_path substitution and the warning field), the error conditions, and the identity/permission caveat. Nothing an agent needs to call it correctly appears to be 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 description coverage is 0%, so the description carries the full burden and does: range is 'A1 notation ... e.g. "A1:D20". Omit for all data.', sheet defaults to the first sheet, file_id and revision_id are tied to their sources, and local_path gets extensive semantics (directory path expands to <file_id>-r<revision_id>.md, trailing slash means directory and is created, existing file replaced, non-directory component raises ValueError before the export). That is meaningful detail well beyond the bare schema types.

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 first sentence names a specific verb and resource and splits the two target types: 'Export a historical revision of a Google Sheets file (cell data) or a Google Doc (Markdown)'. It also immediately distinguishes itself from list_revisions by pointing there for the ID, so an agent can separate it from siblings without opening a schema.

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?

It gives an explicit three-step recovery workflow naming list_revisions (step 1) and batch_update_cells (step 3) as the surrounding alternatives, and states which arguments apply to which file type ('Sheets only', 'Docs only'). It also steers the agent toward local_path when responses are large via 'Bypasses the response-size cap'.

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