Skip to main content
Glama
maxkuminov

Obsidian MCP (pgvector + Ollama, self-hosted)

by maxkuminov

delete_file

Remove non-markdown files from an Obsidian vault. Soft delete moves files to .trash for recovery; permanent deletion bypasses trash. Requires write permission.

Instructions

Delete a non-markdown file from the vault. Requires write permission — a readwrite API key, or an OAuth token carrying the readwrite scope. Peer to delete_note, which stays markdown-only.

By default this is a soft delete: the file moves to .trash/<YYYYMMDD-HHMMSS>-<basename>-<8 hex> inside the vault, keeping a copy the user can recover. Two files with the same name deleted in the same second both survive — the trash never clobbers.

With permanent=True the file is unlinked outright and this server has no recovery path; the user's backups are the only rollback.

Refuses markdown files (use delete_note, which understands the index and backlinks), directories, and symlinks. Non-markdown files are not indexed, so search and embeddings are unaffected either way.

Optional expected_hash binds the whole raw file in either mode. Use the canonical sha256:<64 lowercase hex> from read_file's base64 header, read_file(hash_only=True), or a write success. Malformed hashes refuse before path checks; unavailable, required and stale preconditions refuse before any trash entry or unlink. The deployment may require a hash. This checks the caller-read-to-call window; a later concurrent replacement remains possible, so it is not an atomic filesystem compare-and-delete. A successful delete reports no content hash.

Args: path: Vault-relative path to the file. permanent: If True, unlink instead of moving to .trash/. expected_hash: Optional whole-file raw-byte digest of the incumbent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
permanentNo
expected_hashNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.8.1
    • addedInput schema / properties / expected_hash
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Expected Hash"
      +}
  2. Addedv0.7.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so thoroughly. It discloses the auth requirement, soft-delete vs. permanent behavior, trash naming scheme, refusal cases, expected_hash semantics, non-atomicity, and that a successful delete reports no content hash.

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?

Though long, every section earns its place: core behavior, auth, destructive mode, exclusions, hash binding, and argument semantics. The structure is clear, front-loaded, and ends with a compact Args list.

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 mutating file operation with no annotations and three parameters, the description is complete. It covers prerequisites, safety, edge cases, failure ordering, and the non-atomicity caveat. The presence of an output schema means return values need not be explained here.

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

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but the description compensates fully. It explains path as vault-relative, permanent as unlink vs. trash, and expected_hash as an optional whole-file raw-byte digest with canonical format and behavioral effects. This goes well beyond the bare 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?

The description states a precise verb and resource: deletes a non-markdown file from the vault. It explicitly differentiates from delete_note by scope (markdown-only) and from other siblings, so an agent can disambiguate immediately.

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?

It gives explicit when-to-use and when-not-to-use guidance: use this for non-markdown files, use delete_note for markdown files, and it refuses directories/symlinks. It also names the sibling alternative directly and explains why.

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