Skip to main content
Glama

Replace words in a Google Doc

replace_text_in_google_doc
Destructive

Change every place some exact words appear in a Google Doc to other words — a name, a price, a date. Returns how many places changed; 0 means the words weren't found and nothing changed. Read the document first if you aren't sure of the exact wording.

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": {
      "mailbox": "<mailbox>",
      "documentId": "<documentId>",
      "find": "<find>",
      "replaceWith": "<replaceWith>"
    },
    "name": "replace_text_in_google_doc"
  }
}

Input Schema

NameRequiredDescriptionDefault
findYesThe exact words to find
mailboxYesEmail address of the connected Gmail/Google Workspace mailbox to act on. Call list_authorized_mailboxes to see available options.
matchCaseNoOnly where the capitals match too. Default false.
documentIdYesThe Google Doc's id, from search_gdrive_items or list_gdrive_items
replaceWithYesWhat to put in their place (empty removes them)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4/5.0
Behavior4/5

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

The annotations already declare destructiveHint=true and readOnlyHint=false, so the safety class is known. The description adds value beyond them by disclosing return semantics ('Returns how many places changed') and the failure case ('0 means the words weren't found and nothing changed'), which matters because no output schema exists.

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?

Three short sentences, front-loaded with the core action, then the return contract, then the verification advice. The concrete examples of replaceable values earn their space and nothing is redundant.

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 5-parameter tool with full schema coverage, the definition covers the return value and the no-op case, which is what the missing output schema would otherwise need to supply. Minor gaps remain: nothing says whether formatting is preserved or what happens when the caller lacks edit access.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so 'find', 'replaceWith' and 'matchCase' are already documented at the field level. The description reinforces that the matching is on exact words and gives examples ('a name, a price, a date'), but adds little syntax or format detail beyond the schema baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The definition gives a concrete verb phrase ('Change every place some exact words appear ... to other words') paired with the specific resource (a Google Doc). The phrase 'every place' signals whole-document scope, which implicitly separates it from an unnamed section-scoped sibling, but no sibling is named explicitly.

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?

It provides one clear conditional: 'Read the document first if you aren't sure of the exact wording', which is a useful prerequisite before calling this tool, since a miss produces zero changes. It does not list alternatives or state when not to use this tool.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources