Skip to main content
Glama

zk_find_orphaned_notes

Identify unlinked notes in your Zettelkasten system to ensure all information is connected and accessible for effective knowledge management.

Instructions

Find notes with no connections to other notes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler function that finds orphaned notes via the search service and formats the results as a string list with previews.
    def zk_find_orphaned_notes() -> str:
        """Find isolated notes that have no links to or from other notes.
    
        Orphaned notes may indicate fleeting ideas that need integration or cleanup.
        """
        try:
            # Get orphaned notes
            orphans = self.search_service.find_orphaned_notes()
            if not orphans:
                return "No orphaned notes found."
    
            # Format results
            output = f"Found {len(orphans)} orphaned notes:\n\n"
            for i, note in enumerate(orphans, 1):
                output += f"{i}. {note.title} (ID: {note.id})\n"
                if note.tags:
                    output += (
                        f"   Tags: {', '.join(tag.name for tag in note.tags)}\n"
                    )
                # Add a snippet of content (first 100 chars)
                content_preview = note.content[:100].replace("\n", " ")
                if len(note.content) > 100:
                    content_preview += "..."
                output += f"   Preview: {content_preview}\n\n"
            return output
        except Exception as e:
            return self.format_error_response(e)
  • Registration of the zk_find_orphaned_notes MCP tool with metadata and hints.
    @self.mcp.tool(
        name="zk_find_orphaned_notes",
        description="Find isolated notes that have no links to or from other notes.",
        annotations={
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
        },
    )
  • Helper method in SearchService that performs the database query to identify notes without any links (orphaned notes).
    def find_orphaned_notes(self) -> List[Note]:
        """Find notes with no incoming or outgoing links."""
        orphans = []
        
        with self.zettel_service.repository.session_factory() as session:
            # Subquery for notes with links
            notes_with_links = (
                select(DBNote.id)
                .outerjoin(DBLink, or_(
                    DBNote.id == DBLink.source_id,
                    DBNote.id == DBLink.target_id
                ))
                .where(or_(
                    DBLink.source_id != None,
                    DBLink.target_id != None
                ))
                .subquery()
            )
            
            # Query for notes without links
            query = (
                select(DBNote)
                .options(
                    joinedload(DBNote.tags),
                    joinedload(DBNote.outgoing_links),
                    joinedload(DBNote.incoming_links)
                )
                .where(DBNote.id.not_in(select(notes_with_links)))
            )
            
            result = session.execute(query)
            orphaned_db_notes = result.unique().scalars().all()
            
            # Convert DB notes to model Notes
            for db_note in orphaned_db_notes:
                note = self.zettel_service.get_note(db_note.id)
                if note:
                    orphans.append(note)
                    
        return orphans
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but lacks critical details: it doesn't specify if this is a read-only operation, what the output format is (e.g., list of note IDs or full content), whether it's resource-intensive, or if permissions are required. For a tool with zero annotation coverage, this is a significant gap.

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?

The description is a single, clear sentence: 'Find notes with no connections to other notes.' It's front-loaded with the core purpose, has zero wasted words, and is appropriately sized for a simple tool. Every part of the sentence earns its place by defining the action and target.

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?

Given the lack of annotations and no output schema, the description is incomplete. It explains what the tool does but fails to address behavioral aspects like safety (e.g., is it read-only?), output format, or performance implications. For a tool in a note-taking system where operations might affect data integrity, more context is needed to ensure proper use.

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 tool has 0 parameters, and schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics beyond what the schema provides. A baseline score of 4 is appropriate as it doesn't introduce confusion or redundancy regarding parameters.

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 tool's purpose: 'Find notes with no connections to other notes.' It uses a specific verb ('Find') and resource ('notes'), and the concept of 'orphaned notes' (notes with no connections) is well-defined. However, it doesn't explicitly differentiate from sibling tools like 'zk_find_similar_notes' or 'zk_find_central_notes' beyond the orphaned aspect.

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 when this tool is appropriate (e.g., for cleanup tasks, identifying isolated content) or when to use other tools like 'zk_search_notes' or 'zk_get_linked_notes' instead. There's no context about prerequisites or exclusions.

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