Skip to main content
Glama

modify_doc_text

Insert, replace, or format text in Google Docs with options for markdown conversion and precise positioning.

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.

MARKDOWN MODE: Set format_as_markdown=True to parse text as markdown and insert it with native Docs formatting (headings, bold, italic, bullets, numbered lists). Works for both plain insertion and range replacement. When enabled, explicit formatting parameters (bold, italic, font_size, etc.) must NOT be set — markdown brings its own formatting.

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".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_google_emailYesUser's Google email address
document_idYesID of the document to update
start_indexYesStart 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.
end_indexNoEnd position for text replacement/formatting (if not provided with text, text is inserted)
textNoNew text to insert or replace with (optional - can format existing text without changing it)
tab_idNoOptional document tab ID to target
segment_idNoOptional header/footer/footnote segment ID to target
end_of_segmentNoInsert text at the end of the targeted segment instead of start_index
boldNoWhether to make text bold (True/False/None to leave unchanged)
italicNoWhether to make text italic (True/False/None to leave unchanged)
underlineNoWhether to underline text (True/False/None to leave unchanged)
strikethroughNoWhether to strike through text (True/False/None to leave unchanged)
font_sizeNoFont size in points
font_familyNoFont family name (e.g., "Arial", "Times New Roman")
font_weightNoFont weight (100-900 in steps of 100; requires font_family)
text_colorNoForeground text color (#RRGGBB)
background_colorNoBackground/highlight color (#RRGGBB)
link_urlNoHyperlink URL (http/https)
clear_linkNoRemove hyperlink from the target range
baseline_offsetNoOne of NONE, SUPERSCRIPT, SUBSCRIPT
small_capsNoWhether to apply small caps
format_as_markdownNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: it's a mutation tool (implied by 'modifies'), offers operational modes (insert/replace/format), includes practical tips to avoid errors (end_of_segment), and specifies constraints (markdown mode excludes explicit formatting). However, it lacks details on permissions, rate limits, or error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded with the core purpose, followed by organized tips and guidelines. Each sentence adds practical value without redundancy, such as explaining markdown mode constraints and sibling tool preferences, making it efficient and easy to parse.

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?

Given the tool's complexity (22 parameters, mutation operation) and no annotations, the description is highly complete: it covers purpose, usage guidelines, behavioral nuances, and parameter semantics. With an output schema present, it appropriately omits return value details, focusing on operational context and constraints.

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?

The schema description coverage is high (95%), so the baseline is 3. The description adds significant value by explaining the purpose and interactions of key parameters: it clarifies 'end_of_segment' for appending text, 'format_as_markdown' for markdown parsing with formatting exclusions, and 'segment_id' usage with real IDs. This compensates for the minimal gap in schema coverage.

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 description clearly states the tool's purpose with specific verbs ('modifies', 'insert/replace text', 'apply formatting') and resource ('Google Doc'), distinguishing it from sibling tools like 'update_doc_headers_footers' and 'insert_doc_markdown' by specifying it handles text and formatting in a single operation.

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?

The description provides explicit guidance on when to use this tool vs. alternatives: it names 'update_doc_headers_footers' for header/footer text, advises against guessing segment IDs, and references 'inspect_doc_structure' for obtaining IDs. It also includes tips for specific scenarios like appending text and markdown mode.

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

Install Server

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/HuntsDesk/ve-gws'

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