Skip to main content
Glama

replace_text

Find and replace text throughout a document and return how many replacements were made, letting you update repeated content with optional case-sensitive matching and document targeting.

Instructions

Find and replace text throughout the document. Returns the number of replacements made.

Input Schema

NameRequiredDescriptionDefault
findYesText to find.
replaceYesReplacement text.
matchCaseNoCase-sensitive search. Default false.
documentIdNoTarget document ID from list_documents. Optional when only one document is connected.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.0

TDQS

B3.3/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose two useful traits: replacement spans the whole document, and the return value is a replacement count. It omits reversibility/undo, whether tables, headers and footers are included, what happens on zero matches, and any permission requirements for a mutation tool.

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?

Two short sentences, action front-loaded and the return behavior stated second. No filler or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Return behavior is covered despite no output schema, and parameters are fully described in the schema. But for an unannotated mutation, the description leaves scope questions (headers/footers/tables, all-occurrences vs first-only semantics, undo) unanswered.

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, replace, matchCase and documentId are all documented, including the single-document default. The description adds nothing beyond the schema, which is acceptable at this coverage level but not better than 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?

States a specific verb (find and replace) and resource (text throughout the document), plus the return value. It does not name or differentiate from siblings like replace_in_sheet, set_paragraph_text, or search_document, but 'throughout the document' scopes it clearly enough to be actionable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this versus set_paragraph_text (targeted edit), search_document (read-only lookup), or replace_in_sheet (spreadsheet equivalent). The agent must infer the choice from names alone.

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