Skip to main content
Glama
maxkuminov

Obsidian MCP (pgvector + Ollama, self-hosted)

by maxkuminov

Delete file

delete_file
Destructive

Deletes non-markdown files from an Obsidian vault, moving them to .trash for recovery by default or unlinking permanently when specified.

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.

expected_hash binds the whole raw file in either mode; optional by default — omitted, the delete proceeds — unless the deployment requires it, when an omitted hash is refused precondition_required. 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. 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

NameRequiredDescriptionDefault
pathYes
permanentNo
expected_hashNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

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

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true, readOnlyHint=false and idempotentHint=false, but the description adds far more than that baseline: default soft-delete into `.trash/<timestamp>-<basename>-<hex>` with no clobbering, permanent=True as an unrecoverable unlink, what happens to the index/embeddings, and the `precondition_required` refusal path for `expected_hash`. It even discloses the TOCTOU caveat ('not an atomic filesystem compare-and-delete') 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.

Conciseness4/5

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

Exceptionally front-loaded — the one-line purpose and the alternative come first, then behavior, then the hash contract. The main deduction is the trailing 'Args:' block, which restates `path`, `permanent`, and `expected_hash` in terser terms already covered in the prose, adding length without new information.

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 file tool, everything needed is present: permissions, trash-vs-unlink semantics, refusal cases, precondition ordering, and the fact that no content hash is returned. An output schema exists, so the description correctly does not spend words on the return shape beyond that one relevant negative.

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 description coverage is 0% — the properties only carry titles — so the description must carry the semantics, and it does: `path` is vault-relative, `permanent` switches from trash-move to unlink, and `expected_hash` gets format (`sha256:<64 lowercase hex>`), accepted sources, when it is required, and the ordering of refusal codes. This is exactly the compensation the low coverage demands.

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?

Opens with a specific verb+resource+scope: 'Delete a non-markdown file from the vault.' It immediately names the sibling it is distinguished from ('Peer to `delete_note`, which stays markdown-only'), so an agent can route between them 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 Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit routing rules: use this for non-markdown, use `delete_note` for markdown (with the reason — the index and backlinks), and it refuses directories and symlinks. It also states the permission prerequisite (readwrite API key or OAuth scope), which is the first thing an agent must verify before calling.

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