MCPcopy
hub / github.com/codeaashu/claude-code / readJsonFile

Function readJsonFile

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

Source from the content-addressed store, hash-verified

41}
42
43async function readJsonFile<T>(
44 path: string,
45 schema: z.ZodType<T>,
46): Promise<T | null> {
47 try {
48 const content = await readFile(path, { encoding: 'utf-8' })
49 const result = schema.safeParse(jsonParse(content))
50 return result.success ? result.data : null
51 } catch {
52 return null
53 }
54}
55
56async function copySnapshotToLocal(
57 agentType: string,

Callers 1

checkAgentMemorySnapshotFunction · 0.85

Calls 2

readFileFunction · 0.85
jsonParseFunction · 0.85

Tested by

no test coverage detected