MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / fileWrite

Function fileWrite

src/tools/executors/files.ts:41–51  ·  view source on GitHub ↗
(args: Record<string, unknown>, context: ToolContext)

Source from the content-addressed store, hash-verified

39}
40
41export async function fileWrite(args: Record<string, unknown>, context: ToolContext): Promise<ToolResult> {
42 const filePath = resolveWorkspacePath(context.cwd, String(args.file_path ?? ""))
43 const content = String(args.content ?? "")
44 try {
45 fs.mkdirSync(path.dirname(filePath), { recursive: true })
46 fs.writeFileSync(filePath, content)
47 } catch (error) {
48 return { text: `Error writing file ${filePath}: ${(error as Error).message}`, isError: true }
49 }
50 return { text: `Successfully wrote ${content.split("\n").length} lines to ${filePath}.` }
51}
52
53interface EditSpec {
54 file_path: string

Callers

nothing calls this directly

Calls 1

resolveWorkspacePathFunction · 0.85

Tested by

no test coverage detected