Skip to main content
Glama
bazylhorsey
by bazylhorsey

get_related_notes

Find notes connected to a specific note in your Obsidian vault by analyzing link relationships and connections between your knowledge base entries.

Instructions

Get notes related to a specific note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxDepthNoMaximum link depth (default: 2)
pathYesPath to the note
vaultYesVault name

Implementation Reference

  • src/index.ts:177-189 (registration)
    Tool registration including name, description, and input schema definition for 'get_related_notes'.
    {
      name: 'get_related_notes',
      description: 'Get notes related to a specific note',
      inputSchema: {
        type: 'object',
        properties: {
          vault: { type: 'string', description: 'Vault name' },
          path: { type: 'string', description: 'Path to the note' },
          maxDepth: { type: 'number', description: 'Maximum link depth (default: 2)' },
        },
        required: ['vault', 'path'],
      },
    },
  • Input schema defining parameters: vault (required), path (required), maxDepth (optional).
    inputSchema: {
      type: 'object',
      properties: {
        vault: { type: 'string', description: 'Vault name' },
        path: { type: 'string', description: 'Path to the note' },
        maxDepth: { type: 'number', description: 'Maximum link depth (default: 2)' },
      },
      required: ['vault', 'path'],
  • Handler in the main switch statement that fetches all notes, updates the knowledge graph, calls getRelatedNotes on it with path and maxDepth, and returns the related notes as JSON.
    case 'get_related_notes': {
      const connector = this.connectors.get(args?.vault as string);
      if (!connector) {
        throw new Error(`Vault "${args?.vault}" not found`);
      }
      const notesResult = await connector.getAllNotes();
      if (notesResult.success && notesResult.data) {
        this.knowledgeGraph.updateNotes(notesResult.data);
        const related = this.knowledgeGraph.getRelatedNotes(args?.path as string, (args?.maxDepth as number) || 2);
        return {
          content: [{ type: 'text', text: JSON.stringify(related, null, 2) }],
        };
      }
      throw new Error('Failed to get related notes');
    }
  • Core implementation in KnowledgeGraph service: traverses links and backlinks up to maxDepth using DFS, collects related note paths, and returns Note objects.
    getRelatedNotes(notePath: string, maxDepth: number = 2): Note[] {
      const related = new Set<string>();
      const visited = new Set<string>();
    
      const traverse = (path: string, depth: number) => {
        if (depth > maxDepth || visited.has(path)) {
          return;
        }
    
        visited.add(path);
        const note = this.notes.get(path);
        if (!note) return;
    
        if (depth > 0) {
          related.add(path);
        }
    
        // Follow outgoing links
        if (note.links) {
          for (const link of note.links) {
            const target = this.resolveNotePath(link.target);
            traverse(target, depth + 1);
          }
        }
    
        // Follow backlinks
        if (note.backlinks) {
          for (const backlink of note.backlinks) {
            traverse(backlink.source, depth + 1);
          }
        }
      };
    
      traverse(notePath, 0);
    
      return Array.from(related)
        .map(path => this.notes.get(path))
        .filter((note): note is Note => note !== undefined);
    }
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 only states the basic action without behavioral details. It doesn't disclose what 'related' means (e.g., via links, tags, content similarity), whether it's read-only, performance implications, or output format, leaving significant gaps for a tool that likely traverses note graphs.

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, efficient sentence with zero wasted words. It's front-loaded with the core action, making it easy to parse quickly, though this conciseness comes at the cost of detail in other dimensions.

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 annotations, no output schema, and a tool that likely involves graph traversal (implied by 'related' and 'maxDepth'), the description is incomplete. It lacks crucial context like what 'related' entails, output structure, or error handling, making it inadequate for safe and effective use by an AI agent.

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

Parameters3/5

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

Schema description coverage is 100%, so parameters are well-documented in the schema itself. The description adds no additional meaning beyond implying 'path' and 'vault' identify the target note and 'maxDepth' controls traversal, but this is already clear from schema descriptions, resulting in a baseline score.

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 'Get' and the resource 'notes related to a specific note', making the purpose understandable. However, it doesn't distinguish this tool from potential alternatives like 'get_note' (which retrieves a single note) or 'search_notes' (which searches content), missing explicit sibling differentiation.

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 scenarios like exploring note connections, finding linked content, or compare it to siblings like 'get_knowledge_graph' or 'suggest_links', leaving usage context implied at best.

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/bazylhorsey/obsidian-mcp-server'

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