Skip to main content
Glama

Edit a Google Doc

edit_doc

Replace an exact text snippet in a Google Doc with new content, using inline markdown for formatting and optional replace-all.

Instructions

Replace an exact unique snippet of text in a Google Doc (like a local file Edit). old_string is matched markup-tolerantly; ambiguous matches return surrounding context to disambiguate. new_string is interpreted as inline markdown (bold, italic, code, text). NOTE: this is a direct edit — the change is applied as live text, not a tracked suggestion (the Docs API cannot create suggestions). If the doc has pending suggestions from other reviewers, flag to the user that your edit will sit alongside them as an accepted change.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tabNoTarget a specific tab by tabId or title (from list_tabs). Defaults to the first tab.
accountNoGoogle account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account.
documentIdYesGoogle Doc id
new_stringYesreplacement text
old_stringYesexact text to replace (quote a unique slice from read_doc)
replace_allNoreplace every occurrence (default false)
Behavior5/5

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

With no annotations provided, the description fully carries the burden of behavioral disclosure. It thoroughly explains matching behavior ('markup-tolerantly', 'ambiguous matches return surrounding context'), the markdown interpretation of new_string, and critically that the edit is 'applied as live text, not a tracked suggestion'—a key nuance given sibling suggestion tools. It also advises flagging pending suggestions to the user.

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 compact and well-structured, with a clear main clause, supporting details about matching and markdown, and a critical note about suggestions. Every sentence serves a purpose, and key information is front-loaded.

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?

Given the tool's moderate complexity and lack of annotations/output schema, the description covers the most essential behavioral aspects, including matching strategy, markdown support, and direct-edit caveats. It does not mention what happens on no match or return values, but the schema and context signal together provide adequate coverage for an agent to use the tool effectively.

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 baseline is 3. The description adds significant value by explaining the semantics of old_string and new_string: matching tolerance, disambiguation context, and markdown interpretation. It does not elaborate on replace_all, tab, or account, but those are adequately described in the schema.

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 opens with a specific verb and resource: 'Replace an exact unique snippet of text in a Google Doc.' It clearly distinguishes this from other doc-editing siblings by focusing on targeted snippet replacement rather than full-document operations. The analogy 'like a local file Edit' further clarifies the intended granularity.

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?

The description provides clear context for when to use the tool: 'Replace an exact unique snippet' implies a targeted edit, distinguishing it from broader tools like overwrite_doc. However, it does not explicitly name alternatives or state when not to use it, so it falls short of a 5.

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/dasasian/gdocs-mcp'

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