Replace Text in a Template


Changes one passage of wording inside a template or template part — such as the footer copyright line — without rewriting the rest, staged in the theme draft. Refuses when the text is missing or appears more than once unless replace_all is set, and refuses any change that would unbalance the block markup.

Also known as: change footer text, edit copyright, change header wording.

Property Value
Ability slug mosmcp/theme-text-replace
Wire tool name mosmcp__theme-text-replace
Category Theme: Templates and Styles (mosmcp-theme-blocks)
Plan Free

 

Required access

Requirement Value
Capability edit_theme_options
Minimum default role Administrator (Shop manager too when WooCommerce is active)
Annotations readOnly: false · destructive: false · idempotent: false · openWorld: false

 

Input schema

Field Type Required Default Description
type string (one of template, part) Yes — Whether slug names a template or a template part.
slug string Yes — Template or part slug, for example "footer".
find_text string Yes — The exact wording to change.
replace_with string Yes — The new wording.
replace_all boolean false Change every occurrence instead of requiring exactly one.
whole_word boolean false Only match whole words.

 

Output schema

Field Type Required Description
staged boolean Yes
target string
change string
draft object Yes
draft.exists boolean
draft.change_count integer
draft.templates string[]
draft.template_parts string[]
draft.global_styles string
draft.patterns string[]
draft.files string[]
draft.site_identity string[] Pending logo and site icon changes.
draft.custom_css string[] Pending change to the Customizer's Additional CSS. A block theme's Additional CSS is part of global styles.
draft.theme_settings string[] Pending theme (Customizer) settings.
draft.created string
draft.updated string
draft.preview_ready boolean
next_step string
notes string[]
occurrences integer
match_mode string

 

Example

Sample prompt
Change the footer copyright from 2024 to 2026.

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 293,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__theme-text-replace",
    "arguments": {
      "input": {
        "type": "part",
        "slug": "footer",
        "find_text": "(c) 2024 Example Co",
        "replace_with": "(c) 2026 Example Co"
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 293,
  "result": {
    "isError": false,
    "structuredContent": {
      "staged": true,
      "target": "the template part \"footer\"",
      "change": "content updated",
      "draft": {
        "exists": true,
        "change_count": 1,
        "templates": [],
        "template_parts": [
          "footer (update)"
        ],
        "global_styles": "",
        "patterns": [],
        "files": [],
        "created": "2026-09-29 10:12:04",
        "updated": "2026-09-29 10:14:37",
        "preview_ready": true
      },
      "next_step": "Nothing has changed on the live site yet. Preview the draft with mosmcp/theme-draft-preview, then publish it with mosmcp/theme-draft-publish.",
      "notes": [],
      "occurrences": 1,
      "match_mode": "exact"
    }
  }
}

 

Edge cases / errors

  • find_text not present -> refused with mosmcp_text_not_found (with near-miss suggestions); present more than once without replace_all -> mosmcp_multiple_matches.
  • Replacement that would unbalance the block markup -> refused with mosmcp_blocks_would_break.
  • Text found only inside a referenced theme pattern -> the pattern's blocks are copied into the part and edited there (the theme's pattern file is untouched), with a note.
  • Staged in the theme draft; nothing changes for visitors until it is published.

 


<< Previous Next >>
List Theme Templates Reset Global Styles

For more information about the Secure MCP Server for WordPress plugin, explore the following resources:

Product Overview | Pricing | Try for Free | Documentation

If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.