corestack_ file_ write
Write a file.
When to use it
Write one file of the environment atomically (at most 1 MiB; base64 for binary). Pass expected_sha256 (or "absent" for a new file) to write only over the content you read: a different file answers content_changed. A link (e.g. a Git-mode shared wp-config.php) is followed and kept. The guarantee holds between MCP writes; other writers are detected only through expected_sha256.
Ask for it
Using the Corefinity MCP server, call corestack_file_write with site_id 4211, path /var/www/example.co.uk/htdocs/robots.txt, content User-agent: *
Disallow:
. (Write a file.) Tell me what it returned.Inputs
contentstringRequired
Up to 8,388,608 characters.
create_dirsboolean
Defaults to false.
encodingstring
Defaults to utf-8.
utf-8base64expected_sha256string
The SHA-256 of the file you read, or "absent". Up to 64 characters.
modestring
Octal, e.g. 0644. Default: the existing file's, else 0644. Up to 4 characters.
pathstringRequired
Up to 1,024 characters.
site_idintegerRequired
At least 1.
Example call
{
"name": "corestack_file_write",
"arguments": {
"site_id": 4211,
"path": "/var/www/example.co.uk/htdocs/robots.txt",
"content": "User-agent: *\nDisallow:\n"
}
}If it is refused
| Reason | What to do |
|---|---|
content_changed | corestack_file_write's expected_sha256 no longer matches the file; read the file again and decide. |
busy | Another change is running on this row; wait for it (corestack_site_operation_get) and call again. |
ended_without_status | An MCP command exited non-zero — any non-zero exit of a payload that was started, 125 included — ran out of time, ended without a status, or lost its container; status and exit code in details; read the output (corestack_command_output_get). |
managed_elsewhere | Another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done. |
invalid_arguments | The arguments do not match the tool's input schema, or the Control Panel refused a field. Fix the fields named in the answer and call again. |
tenant_mismatch | The object does not exist or the token may not see it. Check the id. |
scope_required | The token lacks a scope this call needs. Open the link in the answer to add it, then call again. |
pin_refused | The grant is limited to chosen clusters, sites or environments, and this call is outside them. Open the link in the answer to widen it. |
rate_limited | Too many calls. Wait for the number of seconds the answer names. |
temporarily_unavailable | The Control Panel could not answer just now. Nothing was started; try again shortly. |
internal_error | Something went wrong on our side. Quote the trace id to support. |
The same task elsewhere
Was this helpful?