MCPcopy
hub / github.com/foambubble/foam / serializeTraversalResult

Function serializeTraversalResult

packages/foam-mcp/src/serializers.ts:186–203  ·  view source on GitHub ↗
(
  result: TraversalResult,
  rootUri: URI
)

Source from the content-addressed store, hash-verified

184}
185
186export function serializeTraversalResult(
187 result: TraversalResult,
188 rootUri: URI
189): JsonTraversalResult {
190 return {
191 nodes: result.nodes.map(n => ({
192 uri: uriToOutputString(n.uri, rootUri),
193 title: n.title,
194 type: n.type,
195 distance: n.distance,
196 })),
197 edges: result.edges.map(e => ({
198 source: uriToOutputString(e.source, rootUri),
199 target: uriToOutputString(e.target, rootUri),
200 label: e.label,
201 })),
202 };
203}

Callers 1

registerGraphToolsFunction · 0.90

Calls 2

uriToOutputStringFunction · 0.85
mapMethod · 0.65

Tested by

no test coverage detected