Delete Span
vault_delete_spanDelete a contiguous block of whole lines from a note by short anchor substrings, so table rows, callouts, or list runs can be removed without reproducing exact text.
Instructions
Delete a contiguous block of whole lines from a note's body by referencing short anchor substrings instead of reproducing the full block text. Properties are kept as written, and body line breaks are saved as LF. With first_match: true, a repeated call deletes the next match, so after a timeout or lost response, re-read the note before retrying.
Example: vault_delete_span({ path: "Tracker.md", start_anchor: "| 2024-03-02 | Acme" }) — deletes the one table row whose line contains that fragment. Example: vault_delete_span({ path: "Notes/Plan.md", start_anchor: "> [!warning] Stale", end_anchor: "remove after launch" }) — deletes from the start anchor line through the end anchor line.
When to use: Removing a block you have already read — a table row, callout, or run of list items — where reproducing it exactly as old_text would be error-prone. Prefer vault_replace_in_note for small in-place edits. To replace a block, use vault_replace_span (one atomic step).
Parameters:
An anchor matches a body line (any line below the properties block).
end_anchor is searched at or after the start line and must be unique among those lines. If start_anchor and end_anchor match the same line, only that one line is deleted.
A span that includes a code block's opening fence can't end at a plain closing fence (```): the end anchor is ambiguous, and first_match: true would end the span at the opening fence; to remove such a block, use vault_replace_in_note with new_text: "".
Behavior:
Where the removed lines stood, blank lines never double: the text above and below ends up separated by the wider of the two runs of empty lines that stood there. So removing a table row leaves the table whole.
At the note's end, where no text follows, the run of empty lines above is kept one line shorter ("A\n\nB\n" without "B" → "A\n").
A line holding only spaces or tabs counts as text, not as an empty line.
Errors:
"note not found" — verify path with vault_list_notes
"path must end in …" — add the .md extension
"start anchor not found" / "end anchor not found" — no body line holds the fragment; verify with vault_read_note
"ambiguous start anchor …" / "ambiguous end anchor …" — the anchor matches multiple lines; use a longer fragment or set first_match: true
"absolute path blocked" / "path traversal blocked" / "hidden path blocked" — pass a vault-relative path with no dot-prefixed part
"concurrent write in progress" — a write to this note is in flight; re-read it and retry
"ENAMETOOLONG: …" or another filesystem error — the message says what to do
"the note would open with a properties block …" — a note without properties would start with --- lines around text that can't be properties; the error says how to avoid it
Returns: 'Deleted line(s) from : ""' — the removed lines joined by line breaks, cut at 80 characters with "…".
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>",
"start_anchor": "<start_anchor>"
},
"name": "vault_delete_span"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Vault-relative path to the note, including the ".md" extension (e.g. "Tracker.md", "Notes/Plan.md"). Use the exact letter case. | |
| end_anchor | No | Short substring of the block's LAST line, a body line (case-sensitive). Omit to delete just the single line containing start_anchor. | |
| first_match | No | If an anchor matches more than one line, delete using the first match instead of erroring (default: false — ambiguity is an error). | |
| start_anchor | Yes | Short, unique substring of the block's first line, a body line (case-sensitive). |