import { RojoTool, RojoToolContext } from "./RojoTool.js"; import { writeProjectFile } from "../../storage.js"; export class WriteTextContentTool extends RojoTool { readonly Definition = { type: "function", function: { name: "write_text_content", description: "Write text content to a file, creating it if it does not exist or overwriting it if it does.", parameters: { type: "object", properties: { path: { type: "string", description: "Path relative to the project root." }, text: { type: "string", description: "The text content to write." }, }, required: [ "path", "text" ], }, }, }; async execute( args: Record, ctx: RojoToolContext ): Promise { const ok = writeProjectFile( ctx.projectId, args.path as string, args.text as string ); if ( !ok ) return { error: "Could not write file" }; return { ok: true }; } }