Skip to main content
Glama
Google Workspace MCP Server

Google Workspace MCP Server

by ChinmayNakwa

Batch Update Doc

batch_update_doc
Destructive

Applies multiple document edits, such as text insertion, formatting, tables, and page breaks, in one atomic batch update to keep changes consistent.

Instructions

Executes multiple low-level document operations in a single atomic batch update.

For normal header/footer text, prefer update_doc_headers_footers. Only use create_header_footer here for advanced section-break layouts.

RECOMMENDED WORKFLOW FOR BUILDING DOCUMENTS:

To avoid index calculation errors, build documents in phases:

PHASE 1 - INSERT ALL CONTENT (use end_of_segment=true, no index math): Append text, section breaks, and page breaks sequentially. Each operation appends to the end of the body. No index needed. Example batch: [ {"type": "insert_text", "end_of_segment": true, "text": "Report Title\n"}, {"type": "insert_text", "end_of_segment": true, "text": "\nExecutive Summary\n"}, {"type": "insert_text", "end_of_segment": true, "text": "Revenue grew 15%.\n"}, {"type": "insert_section_break", "end_of_segment": true, "section_type": "NEXT_PAGE"}, {"type": "insert_text", "end_of_segment": true, "text": "Detailed Analysis\n"} ]

PHASE 2 - CREATE HEADERS/FOOTERS (if needed): For normal header/footer text, use update_doc_headers_footers (it auto-creates if missing and writes the content for you). Only include create_header_footer operations in a batch when you are intentionally managing advanced section-break-specific layouts.

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>",
      "operations": "<operations>"
    },
    "name": "batch_update_doc"
  }
}

Input Schema

NameRequiredDescriptionDefault
operationsYesList of operation dicts. Each operation MUST have a 'type' field. All operations accept an optional 'tab_id' to target a specific tab.
document_idYesID of the document to update
user_google_emailYesUser's Google email address

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.2.1

TDQS

A4.4/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false, and idempotentHint=false, so the safety profile is covered. The description adds the valuable 'atomic' property and index-avoidance advice, but omits key batch semantics an agent needs: whether operations apply sequentially, whether indices are computed against the original or mutated document, and what happens on partial failure.

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 is stated in the first sentence, then routing, then a clearly labelled two-phase workflow. It is longer than typical but front-loaded and the length is justified by the tool's complexity; the header separators aid scanning rather than adding noise.

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 an extremely complex 29-variant operation tool, the description covers the dominant usage pattern (append-only document building), defers header/footer work to a sibling, and avoids duplicating return values since an output schema exists. Only minor gaps (non-append index sourcing via inspect_doc_structure) remain, and those are documented in the schema's segment_id/anchor params.

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 description coverage is 100% and all 29 operation variants are documented in the schema, so the baseline is met by structured data alone. The description nonetheless adds real meaning over the schema by showing a literal example operations array and explaining the end_of_segment=true pattern that avoids index math.

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 ('Executes multiple low-level document operations in a single atomic batch update') and immediately distinguishes itself from the sibling update_doc_headers_footers by naming the case where the sibling should be preferred instead.

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 routes the agent: normal header/footer text goes to update_doc_headers_footers, while create_header_footer here is reserved for 'advanced section-break layouts'. It also supplies a concrete phased workflow for the primary use case (building documents), so when-to-use is unambiguous.

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