Skip to main content
Glama

mediawiki_find_replace

Destructive

Replace text on one MediaWiki page by finding exact strings or regex patterns, previewing changes, then applying them safely.

Instructions

PREFERRED for simple text changes on a single page.

USE WHEN: User says "replace X with Y", "fix the typo", "change the version number", "update the name".

NOT FOR: Creating/rewriting pages (use mediawiki_edit_page). Not for multi-page updates (use mediawiki_bulk_replace). Not for formatting (use mediawiki_apply_formatting).

PARAMETERS:

  • title: Page name (required)

  • find: Text to find (required)

  • replace: Replacement text (required)

  • all: Replace all occurrences (default false = first only)

  • use_regex: Treat find as regex (default false)

  • preview: Preview changes without saving. Omit to preview (default true, for safety); set preview=false to apply.

  • summary: Edit summary

RETURNS: Match count and preview of changes. Set preview=false to apply. Includes revision ID, diff URL, and undo instructions.

NOTE: Requires authentication (bot password) to apply changes. Anonymous sessions cannot edit.

Input Schema

NameRequiredDescriptionDefault
allNoReplace all occurrences (default: first only)
findYesText to find (exact match or regex if use_regex=true)
minorNoMark as minor edit
titleYesPage title to edit
previewNoPreview changes without applying them. Omitted means preview (the safe default): the edit is not saved and the diff is returned. Set false to apply the change.
replaceYesReplacement text
summaryNoEdit summary
rationaleYesRequired one-sentence explanation of why you are making this change. Stored in the audit log for post-hoc intent reconstruction.
use_regexNoTreat 'find' as a Go RE2 regex. Characters like . [ ] * + ? ( ) have special meaning; escape with backslash for literal match. Max 500 chars.

Output Schema

NameRequiredDescriptionDefault
undoNo
titleYes
changesNo
messageYes
previewYes
successYes
revisionNo
match_countYes
revision_idNo
replace_countYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.36.0
    • changedInput schema / properties / preview / description
      Previous value: -"Preview changes without saving"New value: +"Preview changes without applying them. Omitted means preview (the safe default): the edit is not saved and the diff is returned. Set false to apply the change."
    • changedInput schema / properties / preview / type
      Previous value: -"boolean"New value: +[
      +  "null",
      +  "boolean"
      +]
  2. Changed2 schema fields changedv1.31.0
    • addedInput schema / properties / rationale
      Added value: +{
      +  "description": "Required one-sentence explanation of why you are making this change. Stored in the audit log for post-hoc intent reconstruction.",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "title",
      -  "find",
      -  "replace"
      -]New value: +[
      +  "rationale",
      +  "title",
      +  "find",
      +  "replace"
      +]
  3. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations declare destructiveHint=true and idempotentHint=false, and the description adds context annotations cannot carry: the safe-by-default preview behavior (omitted preview = no save), the requirement of bot-password authentication, and that anonymous sessions cannot apply edits. It also notes undo instructions and revision IDs on return, which is meaningful for a destructive mutation.

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 routing decision and broken into scannable USE WHEN / NOT FOR / PARAMETERS / RETURNS / NOTE blocks with no filler prose. Minor redundancy: 'Set preview=false to apply' appears in both the parameter entry and the RETURNS line.

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?

Covers the routing, the destructive-edit safety model, and the auth prerequisite, and an output schema exists so return details need not be repeated. Slightly incomplete in that its parameter enumeration skips two schema parameters including the required 'rationale', but the 100% schema coverage compensates.

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 description coverage is 100%, so every parameter is already documented in the schema; the description's parameter list largely restates it (e.g., 'all: Replace all occurrences (default false = first only)') and adds no syntax or format detail beyond the schema. It also omits the required 'rationale' and the 'minor' flag from its own parameter list. Baseline 3 applies.

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 plus scope: 'simple text changes on a single page,' and labels itself PREFERRED. It explicitly distinguishes itself from mediawiki_edit_page, mediawiki_bulk_replace, and mediawiki_apply_formatting, so an agent can route without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides both a USE WHEN block with concrete trigger phrases ('replace X with Y', 'fix the typo') and a NOT FOR block naming the correct sibling for each excluded case. This is explicit when/when-not/alternative guidance with nothing left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.