Skip to main content
Glama

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. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources