Skip to main content
Glama
dot-RealityTest

obsidian-codex-mcp

get_backlinks

Retrieve all notes in your Obsidian vault that contain links to a specified note, revealing interconnections and references.

Instructions

Find all notes that link to the specified note.

Args: path: Path to the target note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • MCP tool handler for 'get_backlinks' - decorated with @mcp.tool(). Takes a note path, retrieves all backlinks via the vault client, and returns a formatted list of note_path, note_title, and link_text for each backlink.
    @mcp.tool()
    def get_backlinks(path: str) -> list:
        """Find all notes that link to the specified note.
        
        Args:
            path: Path to the target note
        """
        try:
            client = get_vault_client()
            backlinks = client.get_backlinks(path)
            
            return [
                {
                    "note_path": link['note']['path'],
                    "note_title": link['note']['title'],
                    "link_text": link['link_text']
                }
                for link in backlinks
            ]
        except Exception as e:
            return [{"error": str(e)}]
  • server.py:234-235 (registration)
    Registration of 'get_backlinks' as an MCP tool via the @mcp.tool() decorator.
    @mcp.tool()
    def get_backlinks(path: str) -> list:
  • Helper client method 'get_backlinks' on ObsidianVaultClient. Parses all notes in the vault using a wikilink regex pattern, finds notes that link to the target note (by filename stem or full path), and returns a list of dicts with note info and link text.
    def get_backlinks(self, path: str) -> List[Dict[str, Any]]:
        """Find all notes that link to the specified note."""
        target_name = Path(path).stem
        all_notes = self.list_notes()
        backlinks = []
        
        link_pattern = re.compile(r'\\[\\[([^\\]|]+)\\|?([^\\]]*)?\\]\\]')
        
        for note in all_notes:
            if note['path'] == path:
                continue
            
            content = note['content']
            matches = link_pattern.findall(content)
            
            for match in matches:
                link_target = match[0].split('#')[0]  # Remove header references
                if link_target == target_name or link_target == path:
                    backlinks.append({
                        'note': note,
                        'link_text': match[1] if match[1] else match[0]
                    })
                    break
        
        return backlinks
Behavior4/5

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

With no annotations, the description must convey behavior. It accurately states the tool finds backlinks, implying a read-only query. No contradictions, and the behavior is straightforward, though details like response format are missing.

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?

The description is very concise with a single sentence and arg list. It is front-loaded and clear, but could be improved with a more structured format.

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 no output schema, the description should hint at return values (e.g., note titles or paths). It does not, leaving the agent uncertain about the output format. The simple one-param tool could still benefit from completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The parameter 'path' lacks schema description (0% coverage). The description only repeats 'Path to the target note,' adding minimal value beyond the schema. No format, constraints, or examples are provided.

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 'Find all notes that link to the specified note,' which specifies the verb (find) and resource (backlinks). This distinguishes it from siblings like get_note_links, which likely get links from a note, not to it.

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

Usage Guidelines3/5

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

The description implies usage for finding backlinks but provides no explicit guidance on when to use this tool versus alternatives like get_note_links or search_notes. No exclusions or prerequisites are mentioned.

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

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/dot-RealityTest/obsidian-codex-mcp'

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