MCPcopy Create free account
hub / github.com/continuedev/continue / readFile

Function readFile

extensions/cli/src/fileTools.ts:13–35  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

11 * Read a file and return its contents
12 */
13export function readFile(filePath: string): ToolResult {
14 try {
15 if (!fs.existsSync(filePath)) {
16 return {
17 success: false,
18 output: `Error: File does not exist: ${filePath}`,
19 error: `File not found: ${filePath}`,
20 };
21 }
22
23 const content = fs.readFileSync(filePath, "utf-8");
24 return {
25 success: true,
26 output: `File content:\n${content}`,
27 };
28 } catch (error) {
29 return {
30 success: false,
31 output: `Error reading file: ${error instanceof Error ? error.message : String(error)}`,
32 error: error instanceof Error ? error.message : String(error),
33 };
34 }
35}
36
37/**
38 * Write content to a file

Callers 3

getAddRemoveForTagFunction · 0.85
getClipboardImageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected