roam-research-mcp
Version:
MCP server and CLI for Roam Research
20 lines (19 loc) • 682 B
JavaScript
import { resolveRefs } 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) {
return Promise.all(results.map(async (result) => {
const [uid, content, ...rest] = result;
const resolvedContent = await resolveRefs(this.graph, content);
return [uid, resolvedContent, ...rest];
}));
}
}