Skip to main content
Glama
Google Workspace MCP Server

Google Workspace MCP Server

by mutallipp

Get Doc Content

get_doc_content
Read-onlyIdempotent

Retrieves text from a Google Doc or Drive file by document ID, including tab or heading sections, with optional context for links, tables, and footnotes so you can read indexed content ready for editing.

Instructions

Retrieves content of a Google Doc or a Drive file (like .docx) identified by document_id.

  • Native Google Docs: Fetches content via Docs API.

  • Office files (.docx, etc.) stored in Drive: Downloads via Drive API and extracts text.

By default, native Google Docs text is index-aligned with the document: empty paragraphs are preserved and every non-text element that occupies an index (inline object, page break, footnote reference, ...) is rendered as one U+FFFC placeholder per index. The document body starts at index 1, so an offset n into the text that follows "--- CONTENT ---" is document index n + 1, and that index can be passed straight to format_text or delete_text. Tables and multi-tab documents interleave separators, so alignment holds up to the first table or tab header.

Set preserve_context=True for readable link destinations, internal targets, smart-chip values, table boundaries, headers, footers, footnotes, and object context exposed by the Docs API. This output is plain text, not Markdown, and its offsets must not be used as document editing indices. Comments, revision history, exact visual layout, and chip details hidden by the API are not included. Use get_doc_as_markdown for formatting or comments.

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": {
      "user_google_email": "<user_google_email>",
      "document_id": "<document_id>"
    },
    "name": "get_doc_content"
  }
}

Input Schema

NameRequiredDescriptionDefault
tab_idNoOptional ID of a single tab to read (from inspect_doc_structure). When given, only that tab's content is returned with no tab separator, so the default output stays index-aligned with that tab. When omitted, every tab is returned with "--- TAB: ... ---" markers. Pass "" to read every tab of a URL that carries ?tab=. This filters output only: the whole document is still fetched.
headingNoText of a body heading (case-insensitive, must match exactly one) whose section to return instead of the whole document: the heading and everything below it up to the next heading of equal or shallower level. The header reports the section's start index s, and in the default output offset n is document index n + s. Native Google Docs only; tab_id is required when the doc has multiple tabs.
document_idYesID of the Google Doc or Drive file (or full URL). A Docs URL's ?tab= selects that tab unless tab_id is also specified.
heading_levelNoOptional 1-6 heading level to narrow the heading match.
preserve_contextNoInclude readable semantic annotations for native Docs. Defaults to False to retain index alignment. Office extraction is unaffected. With tab_id, only the selected tab is rendered.
user_google_emailYesUser's Google email address
suggestions_view_modeNoHow to render suggestions in the returned content: - "DEFAULT_FOR_CURRENT_ACCESS": Default based on user's access level - "SUGGESTIONS_INLINE": Suggested changes appear inline in the document - "PREVIEW_SUGGESTIONS_ACCEPTED": Preview as if all suggestions were accepted - "PREVIEW_WITHOUT_SUGGESTIONS": Preview as if all suggestions were rejectedDEFAULT_FOR_CURRENT_ACCESS

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.8.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare read-only, idempotent, non-destructive and open-world, so the safety profile is covered. The description goes well beyond that, disclosing non-obvious behavior: empty paragraphs preserved, one U+FFFC per index-occupying element, body starting at index 1, the n+1 offset mapping, and the fact that alignment breaks at the first table or tab header. It also warns that preserve_context offsets must not be used as editing indices, which is a real failure mode an agent would otherwise hit.

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?

The first line front-loads purpose and the two API paths, and the dense index-alignment paragraph is genuinely load-bearing rather than filler. It is long and occasionally repetitive about tab/table alignment limits, which keeps it from a perfect score, but every section maps to a decision the caller must make.

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 seven-parameter read tool with an output schema and full annotation coverage, this is complete: input semantics, output framing markers, fidelity limits, and the downstream editing contract are all stated. An agent has everything needed to call it correctly and to interpret the returned indices.

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. The description still adds meaning the schema cannot convey: the relationship between text offsets and document indices, why preserve_context trades alignment for readability, and how heading section offsets shift by the section start index. These are semantic consequences of parameter choices rather than restatements of the field docs.

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?

It names a specific verb and resource (retrieves content of a Google Doc or Drive file) and immediately splits the two internal paths: native Docs via the Docs API versus Office files downloaded through the Drive API. It also differentiates itself from the closest sibling by stating that get_doc_as_markdown is the tool for formatting or comments, so an agent can pick between them without opening either 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 concrete selection guidance for the trickiest parameter split: default mode for index-aligned editing, preserve_context=True for readable links, tables, headers, footers and footnotes, and directs formatting/comment needs to get_doc_as_markdown. It also states exclusions (comments, revision history, exact visual layout, hidden chip details). It stops short of a full when-not-to-use statement for other content-retrieval siblings, so it is clear context rather than complete routing.

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