Skip to main content
Glama

zk_delete_note

Remove specific notes from the Zettelkasten knowledge management system using the note ID, ensuring efficient organization and maintenance of atomic notes.

Instructions

Delete a note. Args: note_id: The ID of the note to delete

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
note_idYes

Implementation Reference

  • MCP tool handler implementing zk_delete_note: validates note existence and delegates deletion to ZettelService.
    def zk_delete_note(note_id: str) -> str:
        """Permanently delete a note and all its associated links from the Zettelkasten.
    
        Args:
            note_id: The unique ID of the note to permanently delete
        """
        try:
            # Check if note exists
            note = self.zettel_service.get_note(note_id)
            if not note:
                return f"Note not found: {note_id}"
    
            # Delete the note
            self.zettel_service.delete_note(str(note_id))
            return f"Note deleted successfully: {note_id}"
        except Exception as e:
            return self.format_error_response(e)
  • Registration of the zk_delete_note tool in the MCP server.
        name="zk_delete_note",
        description="Permanently delete a note and all its associated links from the Zettelkasten.",
        annotations={
            "readOnlyHint": False,
            "destructiveHint": True,
            "idempotentHint": True,
        },
    )
  • ZettelService.delete_note delegates deletion to NoteRepository.
    def delete_note(self, note_id: str) -> None:
        """Delete a note."""
        self.repository.delete(note_id)
  • Core deletion logic in NoteRepository: removes MD file and purges DB records for links, tags, and note.
    def delete(self, id: str) -> None:
        """Delete a note by ID."""
        # Check if note exists
        file_path = self.notes_dir / f"{id}.md"
        if not file_path.exists():
            raise ValueError(f"Note with ID {id} does not exist")
        
        # Delete from file system
        try:
            with self.file_lock:
                os.remove(file_path)
        except IOError as e:
            raise IOError(f"Failed to delete note {id}: {e}")
        
        # Delete from database
        with self.session_factory() as session:
            # Delete note and its relationships
            session.execute(text(f"DELETE FROM links WHERE source_id = '{id}' OR target_id = '{id}'"))
            session.execute(text(f"DELETE FROM note_tags WHERE note_id = '{id}'"))
            session.execute(text(f"DELETE FROM notes WHERE id = '{id}'"))
            session.commit()
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral context. It states the action ('Delete') but doesn't disclose critical traits: whether deletion is permanent/reversible, permission requirements, side effects (e.g., breaking links), error conditions, or response format. This is inadequate for a destructive operation.

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 description is brief and front-loaded with the core action, but the Args section is redundant with the schema and adds minimal value. The two-sentence structure is efficient, but the second sentence could be integrated more seamlessly or omitted since it repeats schema information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive tool with no annotations and no output schema, the description is incomplete. It lacks information on behavioral consequences (e.g., permanence, error handling), usage context (e.g., prerequisites), and output expectations. Given the complexity of deletion operations, this leaves significant gaps for an AI agent.

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?

The description adds essential meaning beyond the schema, which has 0% coverage. It explains that 'note_id' is 'The ID of the note to delete', clarifying the parameter's purpose and relationship to the operation. This compensates well for the schema's lack of descriptions, though it doesn't detail ID format or sourcing.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Delete') and resource ('a note'), making the purpose immediately understandable. It distinguishes from siblings like 'zk_update_note' (update) and 'zk_get_note' (retrieve), though it doesn't explicitly contrast with deletion alternatives like 'zk_remove_link' (which removes relationships rather than notes).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing note ID), exclusions (e.g., not for bulk deletion), or related tools like 'zk_remove_link' for link removal instead of note deletion.

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

Install Server

Other Tools

Related 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/Liam-Deacon/zettelkasten-mcp'

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