Skip to main content
Glama
Obsidian CDP MCP Server

Obsidian CDP MCP Server

obsidian_patch_file

Apply partial search-and-replace edits to a file, enabling small changes without sending the entire file content.

Instructions

Apply partial edits to a file using search and replace. More efficient than write_file for small changes as it doesn't require sending the entire file content.

IMPORTANT: Before calling this tool, you MUST first output a diff visualization in your response to show the user what changes will be made. Use this format:

- old line to be removed
+ new line to be added

This helps the user understand the changes before they are applied.

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": {
      "path": "<path>",
      "patches": "<patches>"
    },
    "name": "obsidian_patch_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesPath to the file relative to vault root
patchesYesArray of patch operations to apply in order

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.9.2

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations, the description carries the full burden: it does establish that this is a mutation via search-and-replace and adds a real behavioral requirement (emit a diff before calling). It omits what happens when old_string is absent or matches multiple times, whether changes are atomic across the patch array, or what the call returns.

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

Conciseness3/5

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

Purpose is front-loaded in one crisp sentence, but the mandatory diff-visualization block with a fenced example occupies over half the text and reads as an agent workflow directive rather than tool documentation. That content is directionally useful but disproportionately long relative to the tool explanation.

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

Completeness3/5

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

For a 2-parameter, fully-described-schema mutation tool with no annotations and no output schema, the core contract is covered, but failure modes (no match, ambiguous match) and the return value are unaddressed. The pre-call diff requirement is the main behavioral addition and it is stated clearly.

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 path, patches, old_string and new_string are already fully documented including the empty-string deletion convention and in-order application. The description adds only the conceptual framing of search-and-replace, no syntax or edge-case meaning beyond the schema.

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 ("Apply partial edits to a file") plus the mechanism ("using search and replace"), and explicitly contrasts with the sibling obsidian_write_file. An agent can distinguish it from write_file without opening either schema.

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?

Names the alternative (write_file) and the condition that favors this tool (small changes, avoids sending whole file content), which implicitly routes large rewrites to write_file. It stops short of explicit "do not use when" cases such as non-unique old_string matches or multi-file edits.

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