Skip to main content
Glama

drive_docs_replace

Find and replace literal text in a Google Doc; dry-run previews changes, and real writes require a lease.

Instructions

Replace literal text in a Google Doc; use drive_docs_append to add text at the end. Mirrors omni-dev drive docs replace. Case-sensitive by default. Example: document_id, search:"draft", replace:"final", dry_run:true. occurrences is a body-only estimate excluding headers/footers/footnotes; zero still sends a real request, and occurrences_changed is authoritative. stale-revision means reread and retry through the complete engine, which may then refuse a stale lease. dry_run defaults to false. Dry-run first: previews need no lease. Real writes require an operator allow rule and a lease unless require_lease:false. Acquire with drive_lease_acquire. A lease permits repeated writes to one file until expiry. refused-lease-stale needs a fresh backup: release with omni-dev drive lease release or wait for expiry before acquiring (acquire reuses stale live tokens too). Cancellation/timeout is not rollback; inspect state before retrying, especially append. Output is complete tagged YAML; refusals/failures set is_error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
leaseNoToken from drive_lease_acquire or omni-dev drive lease acquire. Not needed for dry_run or operator require_lease:false rules; any supplied token is still validated.
searchYesLiteral text to find, e.g. draft; not a regular expression. Required.
accountNoSelects a named Drive account instead of the ambient `--account`/`OMNI_DEV_DRIVE_ACCOUNT` resolution — e.g. `work`. Omit to use the resolved default account (or the legacy single-account credentials, if no named accounts are configured). Call `drive_account_list` to discover configured names.
dry_runNoPreview without mutating or requiring a lease. Default false; preview first.
replaceYesReplacement text, e.g. final. Empty deletes matches. Required.
document_idYesDocument id from /d/<ID>/ in a Docs URL, e.g. 1a2B3c4D. Required.
ignore_caseNoCase-insensitive search. Default false (case-sensitive).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.45.0

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and delivers: case-sensitive default, occurrences being a body-only estimate vs occurrences_changed being authoritative, zero still sending a real request, dry_run default false, lease/allow-rule requirements, refused-lease-stale recovery, and the critical warning that cancellation/timeout is not rollback. This is far beyond what annotations would normally provide.

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 and the sibling alternative are front-loaded, and the sentences are information-dense with no filler. It is long, and the lease/stale-revision sentences are packed together without visual structure, but nearly every clause carries operational weight for a no-annotation mutation tool.

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?

With 7 params, no annotations, and no output schema, the description compensates fully: it explains the lease lifecycle, the output contract ('complete tagged YAML; refusals/failures set is_error'), and retry/recovery semantics. An agent has everything needed to call it correctly and interpret results.

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 value with a concrete example invocation (document_id, search:'draft', replace:'final', dry_run:true) and reiterates the case-sensitivity and dry_run-default semantics in context. It adds some meaning beyond the schema but does not elaborate each parameter's edge behavior.

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?

Opens with a specific verb+resource ('Replace literal text in a Google Doc') and immediately names the sibling it is not: drive_docs_append for appending. An agent can distinguish it from other drive_docs_* tools without opening any schema.

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 between this tool and drive_docs_append, states 'Dry-run first: previews need no lease', and details when a lease is required (real writes unless require_lease:false). It gives the acquire/release workflow via named siblings (drive_lease_acquire, drive lease release), covering when-to-use and prerequisites.

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