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
| Name | Required | Description | Default |
|---|---|---|---|
| find | Yes | Exact substring to find in element content. | |
| limit | No | Max elements to touch (default 200). | |
| types | No | Element types to scan. Default: all four. | |
| dry_run | No | Preview only — report matches without writing (default false). Do this first. | |
| replacement | Yes | Replacement ("" removes the substring). | |
| case_sensitive | No | Case-sensitive match (default false). |