Skip to main content
Glama
markdown-vault-mcp

markdown-vault-mcp

by pvliesdonk

Replace Text Across Notes

replace_text
Destructive

Replace text or regex matches across many Markdown notes with a dry-run preview and per-note diffs, then write the planned changes.

Instructions

Replace every match of one text or regular expression in the bodies of many notes; returns a preview with per-note diffs, or each note's outcome.

Use edit for one change in one note. Frontmatter is never matched. A call with dry_run true returns a plan; the same arguments with dry_run false and that plan write each note still as the dry run showed it.

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": {
      "pattern": "<pattern>"
    },
    "name": "replace_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
planNoThe plan the dry run returned; needed when dry_run is false.
pathsNoNotes to cover, by path.
regexNoTreat pattern as a regular expression.
dry_runNoTrue previews and writes nothing; false writes the plan.
foldersNoFolders whose notes are all covered, recursively; `""` is the whole vault. Paths with a part starting with `.` are left out.
patternYesExact text to find, or a Python regular expression when regex is true.
replacementNoText each match becomes; with regex, `\1` and `\g<name>` insert capture groups.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv7.1.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false, and idempotentHint=false, so safety framing is partly covered. The description adds real context beyond them: the preview/diff return, the frontmatter exclusion, and the plan-token protocol that guarantees the write matches what was previewed. It stops short of covering partial-failure or ordering behavior.

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?

Purpose is front-loaded in the first sentence, followed by the routing rule and the workflow note; no filler sentences. The third sentence is slightly convoluted in its phrasing ('that plan write each note still as the dry run showed it') but each sentence carries distinct information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 7 fully documented parameters, an output schema, and annotations covering the safety profile, the description fills the remaining gaps an agent needs: bulk scope, the edit alternative, the dry-run/plan sequence, and the frontmatter boundary. Nothing essential to calling it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/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, but the description adds cross-parameter meaning the schema only implies: dry_run true yields a plan, and the same arguments with dry_run false plus that plan perform the write. That relationship is operational knowledge, not a restatement.

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 and resource ('Replace every match of one text or regular expression in the bodies of many notes') and scopes it to bodies, not frontmatter. It also says what comes back (per-note diffs or outcomes), so an agent can distinguish it from single-note editing without opening a 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?

Explicitly routes the single-change case elsewhere ('Use edit for one change in one note') and states a hard exclusion ('Frontmatter is never matched'). It also documents the two-step workflow that governs when dry_run/plan should be used versus a direct write.

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