Skip to main content
Glama

get_orphaned_notes

Identify notes that have no incoming or outgoing links to help users find unconnected content in their Obsidian vault for better organization.

Instructions

Find notes with no incoming or outgoing links

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • Core implementation of get_orphaned_notes: iterates over all notes, checks for outgoing links using _extract_links and incoming backlinks using get_backlinks, collects paths of notes with neither.
    async def get_orphaned_notes(self) -> list[str]: """ Get notes with no incoming or outgoing links. Returns: List of orphaned note paths """ orphans = [] for note_meta in self.list_notes(limit=10000): try: # Check outgoing links note = await self.read_note(note_meta.path) outgoing = self._extract_links(note.content) # Check backlinks (simplified - just check if mentioned anywhere) backlinks = await self.get_backlinks(note_meta.path) if not outgoing and not backlinks: orphans.append(note_meta.path) except Exception as e: logger.debug(f"Error checking orphan status for {note_meta.path}: {e}") continue return orphans
  • MCP tool registration using @mcp.tool decorator. Thin wrapper around vault.get_orphaned_notes(), adds optional limit parameter, input validation, error handling, and formats the output as a numbered list.
    name="get_orphaned_notes", description="Find notes with no incoming or outgoing links", ) async def get_orphaned_notes(limit: int = 50) -> str: """ Get notes with no incoming or outgoing links. Args: limit: Maximum number of results (default: 50) Returns: Formatted list of orphaned notes """ if limit <= 0 or limit > 1000: return "Error: Limit must be between 1 and 1000" context = _get_context() try: orphans = await context.vault.get_orphaned_notes() if not orphans: return "No orphaned notes found (all notes are connected!)" # Limit results orphans = orphans[:limit] output = f"Found {len(orphans)} orphaned note(s) (showing first {len(orphans)}):\n\n" for i, path in enumerate(orphans, 1): output += f"{i}. `{path}`\n" return output except Exception as e: logger.exception("Error finding orphaned notes") return f"Error finding orphaned notes: {e}"

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/getglad/obsidian_mcp'

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