MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / readFile

Function readFile

projects/runtime-node/src/localFiles.ts:165–181  ·  view source on GitHub ↗
(params)

Source from the content-addressed store, hash-verified

163 },
164
165 async readFile(params) {
166 const record = asRecord(params)
167 const targetPath = stringValue(record, "path")
168 const encoding = encodingValue(record.encoding)
169 const maxReadSize = positiveInt(record.maxReadSize, DEFAULT_MAX_READ_SIZE)
170 const stat = await fs.stat(targetPath)
171 if (!stat.isFile()) return { type: "error", path: targetPath, message: "Path is not a file" }
172 if (stat.size > maxReadSize) return { type: "file", path: targetPath, size: stat.size, encoding, tooLarge: true, content: null }
173 return {
174 type: "file",
175 path: targetPath,
176 size: stat.size,
177 encoding,
178 tooLarge: false,
179 content: await fs.readFile(targetPath, encoding),
180 }
181 },
182
183 async writeFile(params) {
184 const record = asRecord(params)

Callers 8

readClaudeSessionFunction · 0.85
findLeafUuidFunction · 0.85
isClaudeSessionActiveFunction · 0.85
listClaudeSessionsFunction · 0.85
sessions.test.tsFile · 0.85
readCodexSessionFunction · 0.85
listCodexSessionsFunction · 0.85
sessions.test.tsFile · 0.85

Calls 5

encodingValueFunction · 0.85
positiveIntFunction · 0.85
readFileMethod · 0.80
asRecordFunction · 0.70
stringValueFunction · 0.70

Tested by

no test coverage detected