Skip to main content
Glama

Roam Research

by 2b3pro
batch.ts1.29 kB
import { Graph, batchActions as roamBatchActions } from '@roam-research/roam-api-sdk'; import { RoamBatchAction } from '../../types/roam.js'; export class BatchOperations { constructor(private graph: Graph) {} async processBatch(actions: any[]): Promise<any> { const batchActions: RoamBatchAction[] = actions.map(action => { const { action: actionType, ...rest } = action; const roamAction: any = { action: actionType }; if (rest.location) { roamAction.location = { 'parent-uid': rest.location['parent-uid'], order: rest.location.order, }; } const block: any = {}; if (rest.string) block.string = rest.string; if (rest.uid) block.uid = rest.uid; if (rest.open !== undefined) block.open = rest.open; if (rest.heading !== undefined && rest.heading !== null && rest.heading !== 0) { block.heading = rest.heading; } if (rest['text-align']) block['text-align'] = rest['text-align']; if (rest['children-view-type']) block['children-view-type'] = rest['children-view-type']; if (Object.keys(block).length > 0) { roamAction.block = block; } return roamAction; }); return await roamBatchActions(this.graph, {actions: batchActions}); } }

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/2b3pro/roam-research-mcp'

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