write_file
Write or append text content to a file, automatically creating parent directories if needed, within allowed directories.
Instructions
Write or append text content to a file.
The parent directory is created automatically if it doesn't exist. The path must be inside an allowed directory and the extension must not be in the blocked list.
Returns a success message with the number of lines written.
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>",
"content": "<content>"
},
"name": "write_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the file to write. | |
| content | Yes | Text content to write to the file. | |
| mode | No | Write mode: 'rewrite' (default) overwrites; 'append' adds at end. | rewrite |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |