write_file
Write file content to a specified path, accepting plain text or base64 to avoid JSON escaping, with automatic normalization of line endings and indentation.
Instructions
Write content to a file directly (no line range). Supports both plain text (content) and base64-encoded content (content_base64) to avoid JSON escaping issues. Content is auto-normalized: CRLF/CR converted to LF, leading/trailing newlines stripped, and common indentation removed (dedent) for 'content' (not for 'content_base64').
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>"
},
"name": "write_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Full path to write the file. Supports all drives. Example: D:\output\result.txt | |
| content | No | Content to write (plain text). Alternative to content_base64. | |
| encoding | No | File encoding (default: utf8) | |
| content_base64 | No | Base64-encoded content to write. Alternative to content, avoids JSON escaping issues for complex content (code with newlines, quotes, etc.). | |
| return_content | No | Optional: If true, returns the new file content in the response. Default: false (not returned). |