Skip to main content
Glama

Batch Update Doc

batch_update_doc
Destructive

Execute multiple Google Docs operations atomically in a single request. Insert, format, and restructure content to build or update documents reliably.

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.

Input Schema

TableJSON 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

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Install Server

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already carry the safety profile (readOnlyHint=false, destructiveHint=true), so the bar is lower. The description adds meaningful beyond-schema context: the atomic all-or-nothing guarantee of the batch, the explicit warning about 'index calculation errors,' and the phased-workflow strategy to avoid them. It doesn't cover rate limits or failure-mode details, but the atomicity and index-hazard disclosure are genuinely additive.

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 description is long, but the tool is genuinely complex (25+ operation types), and each section earns its place: purpose, sibling routing, then a structured workflow with a concrete example. The example batch is verbose but high-value, since it demonstrates the exact operation-dict format. Purpose and routing are front-loaded, though the workflow section could be tightened slightly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The output schema exists, so return values need no explanation; annotations cover the safety profile. For a tool of this complexity, the description addresses the single most dangerous failure mode (index calculation errors) with a prescriptive workflow. It does not explicitly compare against other doc-mutation siblings like insert_doc_elements or modify_doc_text, which would round it out, but the critical-path guidance is complete.

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%, so the baseline is 3. The description adds value beyond the schema by explaining how to use the most error-prone parameter (operations): the end_of_segment=true pattern, a concrete example batch showing the exact operation-dict shape, and guidance on when index math is needed versus avoided. This operational meaning complements the schema's per-field documentation rather than repeating it.

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 opening sentence states a specific verb ('Executes'), resource ('low-level document operations'), and scope ('single atomic batch update') that distinguishes it from the single-operation doc tools in its sibling set. The emphasis on 'multiple' and 'low-level' clearly separates it from higher-level tools like update_doc_headers_footers and modify_doc_text.

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?

Explicit routing guidance names the alternative tool and the condition that selects it: 'For normal header/footer text, prefer update_doc_headers_footers' and 'Only use create_header_footer here for advanced section-break layouts.' The RECOMMENDED WORKFLOW section further tells the agent exactly when and how to use this tool (phase-based building with end_of_segment=true) versus other approaches.

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

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/WorldCentralKitchen/google_workspace_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server