Tools · Files and code
write_file
Changes thingsCreate 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": "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
| Name | Type | Description |
|---|---|---|
| path* | string | Relative file path |
| content* | string | File contents |
| mode | string | Write modeoverwriteappend |
* required
More in Files and code
Read, search and edit the project; run commands, code and git.