create_file
Create new files with specified content in Godot projects to manage game development assets and trigger automatic indexing updates.
Instructions
Create a new file with the given content. Triggers index update.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path for the new file | |
| content | Yes | File content |
Implementation Reference
- src/tools/file-tools.ts:250-283 (handler)The handler for the 'create_file' tool, which creates a file and emits a file:changed event.
name: "create_file", description: "Create a new file with the given content. Triggers index update.", schema: { path: z.string().describe("Path for the new file"), content: z.string().describe("File content"), }, handler: async (ctx) => { const { path, content } = ctx.args; validatePath(path); try { const dir = dirname(path); if (!existsSync(dir)) { mkdirSync(dir, { recursive: true }); } writeFileSync(path, content, "utf-8"); await eventBus.emit("file:changed", { path, type: "created", }); return makeTextResponse({ data: { path, size: content.length }, metadata: { source: "fallback" }, }); } catch (err) { return makeTextResponse({ error: `Failed to create file: ${(err as Error).message}`, data: null, }); } }, },