• Get and format ancestor paths for a node

    Combines path retrieval and formatting into one function. Retrieves all ancestor paths for a node and returns them as a formatted, LLM-ready string showing the containment hierarchy.

    Parameters

    • db: Surreal

      SurrealDB instance

    • node: any

      Node object or numeric node ID

    Returns Promise<string>

    Formatted string showing all ancestor paths, ready for LLM context

    const pathContext = await getNodePathsForContext(db, 4495);
    // Returns formatted paths like:
    // "Path 0:: tidyscripts -> ts_node -> introspection -> query.ts -> searchBySimilarity"