Write a file in WSL
wsl_write_fileWrites or appends UTF-8 text to a file inside a WSL distro without shell quoting issues. Use it instead of heredocs to create config or log files from an AI agent.
Instructions
Write or append UTF-8 text to a file in the distro. The content never passes through a shell, so quoting is not a concern. Prefer this over heredocs in wsl_exec. Parent directories must exist. Refused on a read-only profile, and under /mnt// unless the profile allows Windows writes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute file path in the distro. | |
| append | No | Append instead of overwrite. Default false. | |
| content | Yes | Text to write. | |
| session | No | Session id from wsl_connect. Optional — the file tools do not depend on a session's working directory, paths are absolute. |