Skip to main content
Glama

Text Analysis & Cleanup Tools (Tanod)

text_replace

Read-onlyIdempotent

utilpeek: Find and replace in text. To sort, dedupe or number lines use text_lines. Returns the text with find replaced: literally, or as a regular expression on RE2 only (linear time for any pattern: no backtracking, so no ReDoS; backreferences and lookaround are refused), with \1 / \g in the replacement; at most max_replacements (limit_reached reported). A pattern RE2 cannot compile is a 422 invalid_pattern (not charged). Typically under 0.5 s. Price: USD 0.001. Free: 10 utilpeek calls per IP per UTC day. The submitted text is never logged or stored.

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": {
      "text": "<text>",
      "find": "<find>",
      "replace": "<replace>"
    },
    "name": "text_replace"
  }
}

Input Schema

NameRequiredDescriptionDefault
findYesLiteral text, or an RE2 pattern (mode=regex; no backreferences or lookaround; \p{L} for letters).
modeNoliteral (default: find is plain text) or regex (find is an RE2 pattern).literal
textYesThe text (at most 200,000 characters).
dot_allNoregex: . also matches a newline.
replaceYesReplacement; regex mode: \1..\99, \g<name>, \\ for a backslash.
multilineNoregex: ^ and $ match at line breaks.
case_sensitiveNoMatch letter case exactly; false ignores case.
max_replacementsNoReplace at most this many matches, first to last (1-10,000, default 10,000).

Output Schema

NameRequiredDescriptionDefault
modeNo
textNo
errorNoOnly on an error result: an object {code, message}, or the reason string of an x402 PaymentRequired object.
engineNo
sourceNo
replacementsNo
limit_reachedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changed
    • changedInput schema / properties / case_sensitive / description
      Previous value: -"Match letter case exactly (default true); false ignores case."New value: +"Match letter case exactly; false ignores case."
    • removedInput schema / properties / case_sensitive / title
      Removed value: -"Case Sensitive"
    • removedInput schema / properties / dot_all / title
      Removed value: -"Dot All"
    • removedInput schema / properties / find / title
      Removed value: -"Find"
    • removedInput schema / properties / max_replacements / title
      Removed value: -"Max Replacements"
    • removedInput schema / properties / mode / title
      Removed value: -"Mode"
    • removedInput schema / properties / multiline / title
      Removed value: -"Multiline"
    • removedInput schema / properties / replace / title
      Removed value: -"Replace"
    • removedInput schema / properties / text / title
      Removed value: -"Text"
    • removedInput schema / title
      Removed value: -"text_replaceArguments"
  2. Changed4 schema fields changed
    • addedInput schema / properties / case_sensitive / description
      Added value: +"Match letter case exactly (default true); false ignores case."
    • addedInput schema / properties / max_replacements / description
      Added value: +"Replace at most this many matches, first to last (1-10,000, default 10,000)."
    • addedInput schema / properties / mode / description
      Added value: +"literal (default: find is plain text) or regex (find is an RE2 pattern)."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "engine": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "error": {
      +      "description": "Only on an error result: an object {code, message}, or the reason string of an x402 PaymentRequired object."
      +    },
      +    "limit_reached": {
      +      "type": [
      +        "boolean",
      +        "null"
      +      ]
      +    },
      +    "mode": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "replacements": {
      +      "type": [
      +        "integer",
      +        "null"
      +      ]
      +    },
      +    "source": {
      +      "type": [
      +        "object",
      +        "null"
      +      ]
      +    },
      +    "text": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    }
      +  },
      +  "type": "object"
      +}
  3. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description adds substantial context beyond them: RE2 linear-time matching with no backtracking, refusal of backreferences and lookaround, the 422 invalid_pattern error being uncharged, sub-0.5 s latency, price and free-tier limits, and a no-logging/no-storage guarantee. That is exactly the kind of behavioral detail annotations cannot carry.

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?

Dense and front-loaded: purpose first, then the sibling diversion, then regex mechanics, then limits/pricing/privacy. Every sentence carries information, though the pricing and free-tier clauses are somewhat crammed into an otherwise tight paragraph.

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 an output schema present, return values need not be explained, and the description still covers error behavior, rate/limit behavior, latency, and privacy. For an 8-parameter text transformation tool this leaves no material gap an agent would need before calling it.

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 already 100%, so the baseline is 3, but the description adds real meaning on top: replacement backreference syntax (\1 / \g<name>), the semantics of max_replacements (first-to-last, with limit_reached reported), and the fact that a non-compiling RE2 pattern yields 422. Mode-specific behavior is left to the schema but the description reinforces it.

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 ("Find and replace in text") and immediately scopes it against the sibling text_lines for sort/dedupe/number operations. An agent can distinguish this tool from text_lines without opening either schema.

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?

Explicitly names the alternative tool (text_lines) and the operations that belong there, which is clear routing guidance. It does not spell out exclusions such as when to prefer literal over regex mode or when a different text tool would be better suited, but the primary diversion case is covered.

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.