Skip to main content
Glama
Google Workspace MCP Server

Google Workspace MCP Server

by mutallipp

Modify Doc Text

modify_doc_text
Destructive

Apply formatting while inserting or replacing Google Doc text in one operation; edit sections by heading or append to a segment without calculating indices.

Instructions

Modifies text in a Google Doc - can insert/replace text and/or apply formatting in a single operation.

TIP: To append text to the end of the document without calculating indices, set end_of_segment=true. This avoids index calculation errors.

HEADING MODE: Pass heading instead of start_index to edit the body below a heading, up to the next heading of equal or shallower level. text is rendered as Markdown and replaces that body; end_of_segment=true appends instead. Formatting parameters without text format the whole body.

For ordinary header/footer text, prefer update_doc_headers_footers. Only pass segment_id when you already have a real header/footer/footnote segment ID from inspect_doc_structure output. Do not guess IDs such as "kix.header" or "kix.footer".

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": "modify_doc_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
boldNoWhether to make text bold (True/False/None to leave unchanged)
textNoNew text to insert or replace with (optional - can format existing text without changing it). Rendered as Markdown when heading is set.
italicNoWhether to make text italic (True/False/None to leave unchanged)
tab_idNoOptional document tab ID to target (required with heading when the doc has multiple tabs)
headingNoText of a body heading (case-insensitive, must match exactly one) whose section to edit instead of start_index/end_index
link_urlNoHyperlink URL (http/https)
end_indexNoEnd position for text replacement/formatting (if not provided with text, text is inserted)
font_sizeNoFont size in points
underlineNoWhether to underline text (True/False/None to leave unchanged)
clear_linkNoRemove hyperlink from the target range
segment_idNoOptional header/footer/footnote segment ID to target
small_capsNoWhether to apply small caps
text_colorNoForeground text color (#RRGGBB)
write_modeNo"EDIT" (default) applies the change directly; "SUGGEST" records it as a suggested edit that collaborators can accept or rejectEDIT
document_idYesID of the document to update
font_familyNoFont family name (e.g., "Arial", "Times New Roman")
font_weightNoFont weight (100-900 in steps of 100; requires font_family)
start_indexNoStart position for operation using Docs API indices from inspect_doc_structure. For the main body, 0 is also accepted as an alias for the first writable position. Required unless heading is set.
heading_levelNoOptional 1-6 heading level to narrow the heading match
strikethroughNoWhether to strike through text (True/False/None to leave unchanged)
end_of_segmentNoInsert text at the end of the targeted segment instead of start_index
baseline_offsetNoOne of NONE, SUPERSCRIPT, SUBSCRIPT
background_colorNoBackground/highlight color (#RRGGBB)
user_google_emailYesUser's Google email address

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.8.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare mutation (readOnlyHint=false, destructiveHint=true), but the description adds real behavioral context the annotations cannot: heading mode replaces the entire body up to the next equal-or-shallower heading, and write_mode=SUGGEST records the change as a reviewable suggested edit rather than applying it. It stops short of covering permission/auth needs or how concurrent edit conflicts are handled, so it is strong but not exhaustive.

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?

Front-loaded with a one-line purpose, then clearly labeled TIP, HEADING MODE, and header/footer sections, so an agent can scan to the relevant part. Slightly redundant where it restates end_of_segment behavior already in the schema, keeping it just short of maximal.

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?

For a 24-parameter mutation tool with an output schema and full annotation coverage, the description covers the addressing modes, the append shortcut, suggest-vs-edit behavior, and the segment-ID safety rule. What is missing is comparatively minor, such as what happens when heading matches nothing or multiple headings, but the heading_level parameter's presence partly mitigates that.

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, but the description adds cross-parameter meaning the schema cannot: heading and start_index are alternative addressing modes, end_of_segment overrides index calculation, text is Markdown-rendered only in heading mode, and formatting-only calls affect the whole section body. That materially reduces misuse of the 24 parameters beyond their individual descriptions.

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 ('Modifies text in a Google Doc') plus the combined scope ('insert/replace text and/or apply formatting in a single operation'), which distinguishes it from tools that only write elements or only format. It also explicitly routes header/footer work to update_doc_headers_footers, so an agent can separate it from the nearest sibling.

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?

Gives explicit when-to-use routing: use heading mode instead of start_index to edit a section body, use end_of_segment=true to append without computing indices, prefer update_doc_headers_footers for ordinary header/footer text, and only pass segment_id from inspect_doc_structure output rather than guessing IDs. These are concrete selections between modes and between sibling tools, including an explicit 'do not guess' exclusion.

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