Skip to main content
Glama

modx_replace_across

Search and replace text across MODX chunks, snippets, templates, and plugins in one call, with a dry-run preview to review exact changes before applying.

Instructions

Site-wide search & replace across code elements (chunk/snippet/template/plugin): find every element whose CONTENT contains find and replace ALL occurrences with replacement, in ONE call (no per-element reads/writes from your side). Honours static files vs DB. SUBSTRING match — find:"foo" also matches inside footer/food; make find specific. ALWAYS run dry_run:true FIRST and review the returned preview (the exact lines that would change) before the real run. case_sensitive defaults to TRUE here. Use for renames / URL / class changes across the codebase. (Does not touch resources — edit those individually.)

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": {
      "find": "<find>",
      "replacement": "<replacement>"
    },
    "name": "modx_replace_across"
  }
}

Input Schema

NameRequiredDescriptionDefault
findYesExact substring to find in element content.
limitNoMax elements to touch (default 200).
typesNoElement types to scan. Default: all four.
dry_runNoPreview only — report matches without writing (default false). Do this first.
replacementYesReplacement ("" removes the substring).
case_sensitiveNoCase-sensitive match (default false).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.4

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the safety burden well: it discloses one-call bulk semantics (no per-element reads/writes), substring rather than word matching, static-file vs DB handling, a default element cap, and exactly what the dry-run preview returns. It omits reversibility/backup behavior and any permission requirements for writing static files.

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?

Front-loaded with the core action, then safety warning, then caveats — a good ordering with no filler sentences. It is dense and parenthesis-heavy, and the 'no per-element reads/writes from your side' aside is more about the agent than the tool, but nothing is truly wasteful.

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 6-parameter bulk mutation tool with no annotations and no output schema, the description covers scope, matching mechanics, defaults, the preview return shape, and the required dry-run workflow. Remaining gaps are reverting a bad bulk replace and whether static-file writes need filesystem permissions.

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 the baseline is 3. The description usefully reinforces the substring semantics of `find` and the dry-run-first discipline for `dry_run`, but its claim that 'case_sensitive defaults to TRUE here' directly conflicts with the schema's 'default false', making one parameter actively ambiguous.

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?

States a specific verb+resource (site-wide search & replace) with an explicit scope (code elements: chunk/snippet/template/plugin) and an explicit boundary ('Does not touch resources — edit those individually'). An agent can tell immediately this is a bulk content mutation over code elements, not the per-element update tools or resource tools.

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?

Gives concrete use cases ('renames / URL / class changes across the codebase') and a mandatory workflow ('ALWAYS run dry_run:true FIRST'). It also carves out when-not ('Does not touch resources'). It never names a sibling alternative such as modx_search_code for read-only searching, so it stops short of the top score.

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