roam-research-mcp
Version:
MCP server and CLI for Roam Research
17 lines (16 loc) • 625 B
JavaScript
import { resolveRefsMany } from '../tools/helpers/refs.js';
// Base class for all search handlers
export class BaseSearchHandler {
constructor(graph) {
this.graph = graph;
}
/**
* Resolve block references in search results.
* Handles both 5-tuple [uid, content, pageTitle?, created?, modified?]
* and 3-tuple [uid, content, pageTitle?] formats.
*/
async resolveBlockRefs(results) {
const contents = await resolveRefsMany(this.graph, results.map(result => result[1]));
return results.map((result, index) => [result[0], contents[index], ...result.slice(2)]);
}
}