MCPcopy
hub / github.com/zgsm-ai/costrict / load

Method load

src/services/mcp/asyncPolling/McpAsyncTaskStore.ts:99–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97 }
98
99 private async load(): Promise<McpAsyncTaskRecord[]> {
100 try {
101 const raw = await fs.readFile(this.filePath, "utf-8")
102 const json = JSON.parse(raw) as unknown
103 if (!Array.isArray(json)) return []
104 const out: McpAsyncTaskRecord[] = []
105 for (const item of json) {
106 const parsed = McpAsyncTaskRecordSchema.safeParse(item)
107 if (parsed.success) out.push(parsed.data)
108 }
109 return out
110 } catch (err: unknown) {
111 // ENOENT or malformed JSON → empty store
112 return []
113 }
114 }
115
116 private async persist(records: McpAsyncTaskRecord[]): Promise<void> {
117 await fs.mkdir(path.dirname(this.filePath), { recursive: true })

Callers 8

listMethod · 0.95
createMethod · 0.95
updateMethod · 0.95
completeMethod · 0.95
deleteMethod · 0.95
loadLanguageFunction · 0.45
inspectTreeStructureFunction · 0.45

Calls 3

parseMethod · 0.80
pushMethod · 0.80
readFileMethod · 0.65

Tested by 2

inspectTreeStructureFunction · 0.36