Skip to main content
Glama

vault_patch

Apply exact find-and-replace edits to Obsidian vault files, supporting one or multiple sequential patches. Validates each match and auto-commits changes to git after successful application.

Instructions

Surgical find-and-replace in a vault file with auto git commit.

Supports single or multi-replacement. For a single replacement, provide find and replace. For multiple replacements, provide patches — a list of {"find": "...", "replace": "..."} dicts applied in sequence. Do not mix both modes.

Each find value must appear exactly once in the file (after prior patches in the list have been applied). If any patch fails validation, no changes are written.

Uses 3-pass cascading match: exact → body-only → whitespace-normalized.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
findNoExact text to find (single mode). Empty = not set. (Use `find`/`replace`, NOT `old_string`/`new_string` — those are accepted as aliases.)
pathYesRelative path to the file within the project.
commitNoIf True, commit synchronously before returning. Defaults to False, which queues the path for the reconciler. See ``vault_write`` docstring for the durability contract.
patchesNoList of {"find", "replace"} dicts (multi mode).
projectYesProject slug or '_meta' for cross-project content.
replaceNoReplacement text (single mode). Empty = not set.
new_stringNoAlias of `replace` (#151). Prefer `replace`.
old_stringNoAlias of `find` (#151). Prefer `find`.
idempotency_keyNoOptional at-most-once token. If set, a retry with the same key is a no-op after the first apply (ADR-013). Empty (default) disables idempotency.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Beyond the annotations (readOnly=false, idempotentHint=false, destructiveHint=false), the description discloses critical behavior: auto git commit, 3-pass cascading match, uniqueness requirement, and atomic failure semantics ('If any patch fails validation, no changes are written'). It also references the durability contract in vault_write, providing valuable context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and front-loaded with a one-sentence summary, followed by a short bulleted list of usage rules and matching behavior. Every sentence earns its place, and technical details are grouped logically.

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 9 parameters, rich schema descriptions, an output schema, and annotations, the description still contributes the essential behavioral contract: validation atomicity, matching cascades, and commit durability. The reference to the vault_write docstring for the durability contract avoids duplication while pointing to the needed detail.

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?

The input schema already has 100% descriptive coverage, so the baseline is 3; the description adds value by clarifying the two mutually exclusive modes (find/replace vs patches), the 'applied in sequence' semantics, and the uniqueness rule that governs patch validation. It does not need to repeat every schema field, but it explains the relationships between parameters.

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?

Description opens with a specific verb+resource: 'Surgical find-and-replace in a vault file with auto git commit,' clearly distinguishing it from siblings like vault_write, vault_delete, and vault_commit. It further specifies single/multi modes and matching algorithm, leaving no ambiguity about what the tool does.

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?

The description gives concrete conditions for use: single vs multi replacement, 'Do not mix both modes,' the requirement that each find appear exactly once, and all-or-nothing validation. It does not explicitly name sibling alternatives with 'use X instead,' but the context makes it obvious this is the targeted-edit tool.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mlorentedev/hive'

If you have feedback or need assistance with the MCP directory API, please join our Discord server