Tools · Files and code

write_file

Changes things

Create or overwrite a file in the local project.

When to use: Use this to create or update project files when the task requires direct file output.

Example

Run for real by scripts/tool-examples.py in a small demo project, with Haiku 5.5 where the tool calls a model. The output is exactly what the tool returned.

The call

tool call
{
  "tool": "write_file",
  "arguments": {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\n## 0.2.0\n- Annual billing.\n"
  }
}

Real output

Created CHANGELOG.md (4 lines).

Parameters

NameTypeDescription
path*stringRelative file path
content*stringFile contents
modestringWrite modeoverwriteappend

* required

Read, search and edit the project; run commands, code and git.