enquire-mcp API reference - v3.9.0-rc.4
    Preparing search index...

    Function findPath

    • Find the shortest wikilink-graph path between two notes via BFS.

      Multi-hop graph traversal — closes the gap the competitive audit surfaced ("find paths between concepts" was the most-praised graph feature in competitor plugins). Returns the shortest path up to max_depth hops; with include_alternatives: true, also returns up to 10 same-length alternatives (useful for "show me different connections").

      Uses the shared EntryIndex (basename → entries map) for O(1) target resolution per hop, so repeat calls in a session reuse the index. v1.8.1 perf fix: builds a relPath → entry map once before BFS (pre-fix was O(N²) per visited node).

      Parameters

      • vault: Vault

        The vault.

      • args: {
            follow_embeds?: boolean;
            from?: string;
            from_title?: string;
            include_alternatives?: boolean;
            max_depth?: number;
            to?: string;
            to_title?: string;
        }

        One of from / from_title and one of to / to_title required. max_depth defaults to 5. include_alternatives defaults to false. follow_embeds defaults to true (include ![[embeds]] as edges).

      Returns Promise<FindPathResult>

      A FindPathResult. When found: false, path: [] and hops: -1.

      If from / to can't be resolved.

      const r = await findPath(vault, {
      from_title: "Attention",
      to_title: "RLHF",
      max_depth: 4
      });
      if (r.found) {
      console.log(`${r.hops} hops:`, r.path.map(s => s.title).join(" → "));
      }