Skip to main content
Glama
Vault Cortex Obsidian MCP Server

Vault Cortex Obsidian MCP Server

Delete File

vault_delete_file
Destructive

Delete non-markdown files such as canvases, images, and PDFs from an Obsidian vault, following its trash setting and optionally pruning emptied folders.

Instructions

Delete a non-markdown file, moving it to the vault's .trash/ folder or removing it for good as the vault's Obsidian "Deleted files" setting directs.

Example: vault_delete_file({ path: "Scratch/draft.canvas" }) Example: vault_delete_file({ path: "attachments/old-screenshot.png", prune_empty_folders: true }) — also remove "attachments" if deleting the file empties it.

When to use: Removing a canvas, a Base, an image, a PDF or any other non-markdown file you no longer need. For .md notes use vault_delete_note. To replace a text file's content, use vault_write_file with overwrite: true instead.

Behavior:

  • The "Deleted files" setting decides the outcome, which the caller can't choose or see in advance:

    • "Move to system trash" moves the file to .trash/. Files this server moved there are deleted after its retention period (TRASH_RETENTION_DAYS: 30 days by default, never when set to none).

    • "Move to Obsidian trash" moves the file to .trash/ and keeps it forever.

    • "Permanently delete" removes the file for good.

  • Links and embeds to the file from notes and canvases become broken; for a canvas, list them first with vault_get_backlinks. Protected paths are refused: About Me/ and the daily notes folder (Daily Notes/ by default; vault_get_daily_note's path shows the folder in use; not protected when Obsidian's Daily Notes folder setting is the vault root or blank).

Parameters:

  • prune_empty_folders keeps a folder that holds any file, even a hidden .DS_Store. Pruning is best-effort: a folder that can't be removed never fails the call.

Errors:

  • "cannot delete protected path" — the path sits under a protected folder; ask the vault's owner to delete the file in Obsidian

  • "not a file: … is a markdown note" — the path ends in .md in any letter case; delete a note with vault_delete_note, and ask the vault's owner to delete a .MD file in Obsidian

  • "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 file is in flight; retry

  • "file not found: …" — no file exists at that path (a folder is not a file); verify the path with vault_list_files

  • "cannot move to trash … — 100 collisions in .trash/" — .trash/ holds this name and 100 numbered copies; ask the vault's owner to clear old copies, then retry

  • "cannot move to trash …" without "100 collisions" — the file stays put; ask the vault's owner to fix .trash/ (e.g. a plain file blocks a needed folder), then retry

  • "cannot delete …" (other than a protected path) — the file stays put; ask the vault's owner to fix the cause (e.g. permissions), then retry

  • "ENAMETOOLONG: …" or another filesystem error — the message says what to do; the file stays put

  • "cannot read trash config from .obsidian/app.json" — ask the vault's owner to repair it, then retry

  • "cannot read daily notes config from .obsidian/daily-notes.json" — the file that names the protected daily notes folder can't be parsed; ask the vault's owner to repair it, or the server's operator to set DAILY_NOTES_FOLDER or PROTECTED_PATHS, then retry

Returns: Confirmation message naming the outcome — "Deleted " for permanent removal, "Moved to trash (<.trash/ path>)" when the file landed in .trash/. Notes how many empty folders were pruned when any were.

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>"
    },
    "name": "vault_delete_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesVault-relative path of the file to delete, including its extension (e.g. "Boards/old.canvas"). Must NOT end in ".md", ".MD" or another casing of it. Use the exact letter case.
prune_empty_foldersNoWhen true, also remove parent folders the delete leaves empty. Default false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.2.0

TDQS

A4.5/5.0
Behavior4/5

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

Beyond the destructiveHint=true annotation, the description discloses that the outcome is dictated by the vault's 'Deleted files' setting and cannot be chosen or previewed by the caller, plus trash retention (30 days default, never when 'none'), protected paths, and the fact that inbound links/embeds break. The only minor gap is that backlink cleanup is left to a separate tool rather than described as part of this call's side effects, but the destructive semantics are unusually well covered.

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?

The sectioned layout (examples, when to use, behavior, parameters, errors, returns) is front-loaded and scannable, and each example earns its place. However the error catalog is very long, listing a dozen error strings including edge cases like ENAMETOOLONG and 100 trash collisions, which pushes the definition well past what most calls need and dilutes the critical protected-path and .md exclusions.

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?

For a destructive, non-idempotent, zero-output-schema tool, the definition covers outcome uncertainty, retention, protection rules, failure recovery per error string, and the exact return message formats. Nothing an agent needs in order to call it correctly or interpret the result 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 would be 3, but the description adds real meaning: prune_empty_folders keeps any folder containing a file even a hidden .DS_Store, and pruning is best-effort so a failed removal never fails the call. The path parameter is also clarified through the protected-path and vault-relative rules, going past the schema's bare format note.

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?

The first sentence gives a specific verb (delete) plus the exact resource scope (a non-markdown file) and states the resulting mechanics (moved to .trash/ or permanently removed). It explicitly carves itself away from vault_delete_note for .md notes, so an agent can distinguish it from siblings 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?

A dedicated 'When to use' block names the eligible file types (canvas, Base, image, PDF) and routes the agent elsewhere for two concrete alternatives: vault_delete_note for .md and vault_write_file with overwrite: true for replacing content. Both when-to-use and when-not-to-use are explicit.

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