Skip to main content
Glama
Google Workspace MCP Server - Control Gmail, Calendar, Docs, Sheets, Slides, Chat, Forms & Drive

Google Workspace MCP Server - Control Gmail, Calendar, Docs, Sheets, Slides, Chat, Forms & Drive

Get Doc Content

get_doc_content
Read-onlyIdempotent

Retrieves Google Doc or Drive file text by ID, preserving index alignment for native Docs and extracting text from Office files to support reading and 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. Changed2 schema fields changedv2.4.2
    • addedInput schema / properties / heading
      Added value: +{
      +  "default": null,
      +  "description": "Text of a body heading (case-insensitive, must match exactly one)\nwhose section to return instead of the whole document: the heading and\neverything below it up to the next heading of equal or shallower level.\nThe header reports the section's start index s, and in the default\noutput offset n is document index n + s. Native Google Docs only;\ntab_id is required when the doc has multiple tabs.",
      +  "type": "string"
      +}
    • addedInput schema / properties / heading_level
      Added value: +{
      +  "default": null,
      +  "description": "Optional 1-6 heading level to narrow the heading match.",
      +  "type": "integer"
      +}
  2. Changed2 schema fields changedv2.2.0
    • changedInput schema / properties / document_id / description
      Previous value: -"ID of the Google Doc (or full URL)"New value: +"ID of the Google Doc or Drive file (or full URL). A Docs\nURL's ?tab= selects that tab unless tab_id is also specified."
    • changedInput schema / properties / tab_id / description
      Previous value: -"Optional ID of a single tab to read (from inspect_doc_structure).\nWhen given, only that tab's content is returned with no tab separator,\nso the default output stays index-aligned with that tab. When\nomitted, every tab is returned with \"--- TAB: ... ---\" markers."New value: +"Optional ID of a single tab to read (from inspect_doc_structure).\nWhen given, only that tab's content is returned with no tab separator,\nso the default output stays index-aligned with that tab. When\nomitted, every tab is returned with \"--- TAB: ... ---\" markers.\nPass \"\" to read every tab of a URL that carries ?tab=. This\nfilters output only: the whole document is still fetched."
  3. Changed2 schema fields changedv1.28.0
    • removedInput schema / properties / tab_id / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedInput schema / properties / tab_id / type
      Added value: +"string"
  4. Changed2 schema fields changedv1.27.0
    • addedInput schema / properties / preserve_context
      Added value: +{
      +  "default": false,
      +  "description": "Include readable semantic annotations for native Docs.\nDefaults to False to retain index alignment. Office extraction is\nunaffected. With tab_id, only the selected tab is rendered.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / tab_id / description
      Previous value: -"Optional ID of a single tab to read (from inspect_doc_structure).\nWhen given, only that tab's content is returned with no tab separator,\nso the content stays index-aligned with that tab. When omitted, every\ntab is returned separated by \"--- TAB: ... ---\" markers."New value: +"Optional ID of a single tab to read (from inspect_doc_structure).\nWhen given, only that tab's content is returned with no tab separator,\nso the default output stays index-aligned with that tab. When\nomitted, every tab is returned with \"--- TAB: ... ---\" markers."
  5. Changed1 schema field changedv1.26.0
    • addedInput schema / properties / tab_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Optional ID of a single tab to read (from inspect_doc_structure).\nWhen given, only that tab's content is returned with no tab separator,\nso the content stays index-aligned with that tab. When omitted, every\ntab is returned separated by \"--- TAB: ... ---\" markers."
      +}
  6. Changed11 schema fields changedv1.0.1
    • addedInput schema / additionalProperties
      Added value: +false
    • removedInput schema / properties / docs_service
      Removed value: -{
      -  "title": "docs_service",
      -  "type": "string"
      -}
    • addedInput schema / properties / document_id / description
      Added value: +"ID of the Google Doc (or full URL)"
    • removedInput schema / properties / document_id / title
      Removed value: -"Document Id"
    • removedInput schema / properties / drive_service
      Removed value: -{
      -  "title": "drive_service",
      -  "type": "string"
      -}
    • addedInput schema / properties / suggestions_view_mode
      Added value: +{
      +  "default": "DEFAULT_FOR_CURRENT_ACCESS",
      +  "description": "How to render suggestions in the returned content:\n- \"DEFAULT_FOR_CURRENT_ACCESS\": Default based on user's access level\n- \"SUGGESTIONS_INLINE\": Suggested changes appear inline in the document\n- \"PREVIEW_SUGGESTIONS_ACCEPTED\": Preview as if all suggestions were accepted\n- \"PREVIEW_WITHOUT_SUGGESTIONS\": Preview as if all suggestions were rejected",
      +  "type": "string"
      +}
    • addedInput schema / properties / user_google_email / description
      Added value: +"User's Google email address"
    • removedInput schema / properties / user_google_email / title
      Removed value: -"User Google Email"
    • changedInput schema / required
      Previous value: -[
      -  "drive_service",
      -  "docs_service",
      -  "user_google_email",
      -  "document_id"
      -]New value: +[
      +  "user_google_email",
      +  "document_id"
      +]
    • removedInput schema / title
      Removed value: -"get_doc_contentArguments"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "result": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "result"
      +  ],
      +  "type": "object",
      +  "x-fastmcp-wrap-result": true
      +}
  7. First observedv1.0.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