MCPcopy Create free account
hub / github.com/apache/maka / readFile

Method readFile

packages/runtime/src/workspace-executor.ts:258–268  ·  view source on GitHub ↗
(input: WorkspaceReadFileInput)

Source from the content-addressed store, hash-verified

256 }
257
258 async readFile(input: WorkspaceReadFileInput): Promise<WorkspaceReadFileResult> {
259 if (isSupportedImagePath(input.path)) {
260 return await readWorkspaceImage(input.path);
261 }
262 const content = await fs.readFile(input.path, 'utf8');
263 if (input.offset === undefined && input.limit === undefined) return { content };
264 const lines = content.split('\n');
265 const start = input.offset ?? 0;
266 const end = input.limit ? start + input.limit : lines.length;
267 return { content: lines.slice(start, end).join('\n') };
268 }
269
270 async writeFile(input: WorkspaceWriteFileInput): Promise<WorkspaceWriteFileResult> {
271 await fs.writeFile(input.path, input.content, 'utf8');

Callers

nothing calls this directly

Calls 4

isSupportedImagePathFunction · 0.85
readWorkspaceImageFunction · 0.85
joinMethod · 0.80
readFileMethod · 0.65

Tested by

no test coverage detected