write_file
Write content to a specified file on the Filesystem MCP Server. Creates or overwrites the file and necessary directories based on provided relative or absolute paths.
Instructions
Writes content to a specified file. Creates the file (and necessary directories) if it doesn't exist, or overwrites it if it does. Accepts relative or absolute paths (resolved like readFile).
Input Schema
Name | Required | Description | Default |
---|---|---|---|
content | Yes | The content to write to the file. If the file exists, it will be overwritten. | |
path | Yes | The path to the file to write. Can be relative or absolute. If relative, it resolves against the path set by `set_filesystem_default`. If absolute, it is used directly. Missing directories will be created. |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"content": {
"description": "The content to write to the file. If the file exists, it will be overwritten.",
"type": "string"
},
"path": {
"description": "The path to the file to write. Can be relative or absolute. If relative, it resolves against the path set by `set_filesystem_default`. If absolute, it is used directly. Missing directories will be created.",
"minLength": 1,
"type": "string"
}
},
"required": [
"path",
"content"
],
"type": "object"
}