MCPcopy Create free account
hub / github.com/Noumena-Network/code / readJsonFile

Function readJsonFile

src/tools/AgentTool/agentMemorySnapshot.ts:57–68  ·  view source on GitHub ↗
(
  path: string,
  schema: z.ZodType<T>,
)

Source from the content-addressed store, hash-verified

55}
56
57async function readJsonFile<T>(
58 path: string,
59 schema: z.ZodType<T>,
60): Promise<T | null> {
61 try {
62 const content = await readFile(path, { encoding: 'utf-8' })
63 const result = schema.safeParse(jsonParse(content))
64 return result.success ? result.data : null
65 } catch {
66 return null
67 }
68}
69
70async function copySnapshotToLocal(
71 agentType: string,

Callers 1

checkAgentMemorySnapshotFunction · 0.85

Calls 2

readFileFunction · 0.85
jsonParseFunction · 0.85

Tested by

no test coverage detected