Skip to main content
Glama
maxkuminov

Obsidian MCP (pgvector + Ollama, self-hosted)

delete_note

Delete a note from your Obsidian vault. Choose soft-delete to move to .trash or permanent removal with no recovery path.

Instructions

Delete a note from the vault. Requires a readwrite API key.

By default this is a soft-delete: the file is moved to .trash/<YYYYMMDD-HHMMSS>-<basename> inside the vault root. The indexer skips dot-prefixed directories, so search and embeddings drop the note automatically on the next reindex pass (≤ 5 minutes). Soft-deleted files accumulate in .trash/ — emptying that directory is the user's responsibility.

With permanent=True, the file is os.unlink-ed directly with no recovery path inside this server. Existing backups are the rollback story.

Dangling backlinks left behind by a delete are surfaced via get_backlinks and find_orphans. See get_vault_guide for context.

Args: path: Vault-relative path to the note. permanent: If True, unlink instead of soft-deleting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
permanentNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core implementation of delete_note. Soft-deletes by moving to .trash/ with a timestamp prefix, or permanently deletes via os.unlink when permanent=True.
    @_tracked("delete_note", ["path", "permanent"])
    async def delete_note_impl(path: str, permanent: bool = False) -> str:
        """Soft-delete a note to `.trash/`, or `os.unlink` it when `permanent=True`."""
        if err := _require_write():
            return err
    
        from src.services.vault import _vault_root, validate_path
    
        uid = current_user_id.get()
        try:
            full_path = validate_path(path, user_id=uid)
        except ValueError as e:
            return str(e)
        if not full_path.is_file():
            return f"Note not found: {path}"
    
        if permanent:
            try:
                os.unlink(full_path)
            except OSError as e:
                return f"Permanent delete failed: {e}"
            return f"Permanently deleted: {path}"
    
        vault = _vault_root(uid)
        trash = vault / ".trash"
        trash.mkdir(parents=True, exist_ok=True)
        timestamp = datetime.now(timezone.utc).strftime("%Y%m%d-%H%M%S")
        base = f"{timestamp}-{full_path.name}"
        dest = trash / base
        counter = 1
        while dest.exists():
            dest = trash / f"{timestamp}-{counter}-{full_path.name}"
            counter += 1
        try:
            os.replace(full_path, dest)
        except OSError as e:
            if getattr(e, "errno", None) == 18:
                shutil.move(str(full_path), str(dest))
            else:
                return f"Soft-delete failed: {e}"
        rel = dest.relative_to(vault).as_posix()
        return f"Soft-deleted: {path} → {rel}"
  • MCP tool registration/decorator: @mcp.tool() on async def delete_note(path, permanent) – delegates to delete_note_impl.
    @mcp.tool()
    async def delete_note(path: str, permanent: bool = False) -> str:
        """Delete a note from the vault. Requires a readwrite API key.
    
        By default this is a soft-delete: the file is moved to
        `.trash/<YYYYMMDD-HHMMSS>-<basename>` inside the vault root. The indexer
        skips dot-prefixed directories, so search and embeddings drop the note
        automatically on the next reindex pass (≤ 5 minutes). Soft-deleted files
        accumulate in `.trash/` — emptying that directory is the user's
        responsibility.
    
        With `permanent=True`, the file is `os.unlink`-ed directly with no
        recovery path inside this server. Existing backups are the rollback story.
    
        Dangling backlinks left behind by a delete are surfaced via
        `get_backlinks` and `find_orphans`. See `get_vault_guide` for context.
    
        Args:
            path: Vault-relative path to the note.
            permanent: If True, unlink instead of soft-deleting.
        """
        return await delete_note_impl(path, permanent=permanent)
  • Import of delete_note_impl from src.mcp_server.tools into the server registration file.
    from src.mcp_server.tools import (
        create_note_impl,
        delete_note_impl,
Behavior5/5

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

With no annotations, the description fully discloses behavior: soft-delete with .trash directory, indexer skipping, permanent unlink, backup dependency, and backlink effects. This is comprehensive.

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?

Well-structured with paragraphs and bullet points, every sentence adds value. Not verbose; clear and efficient.

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?

Given no annotations and an output schema present, the description covers all key aspects: auth requirements, deletion modes, recovery, indexer impact, and related tools. Highly complete.

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%, so description compensates by explaining 'path' as vault-relative and 'permanent' as boolean for deletion type, adding 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?

The description clearly states the tool deletes a note from the vault and distinguishes between soft-delete and permanent delete. It differentiates from sibling tools like create_note and edit_note.

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?

It mentions required readwrite API key, describes soft-delete behavior, and references related tools for handling backlinks (get_backlinks, find_orphans, get_vault_guide). It provides context but does not explicitly state when not to use.

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

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/maxkuminov/obsidian-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server