fs_write
fs_write = text and small inline content. fs_upload = real files. Write UTF-8 text or other small content already present in the tool call to project file storage. Parent directories are auto-created. Overwrites create a new version automatically (history keeps the last 3 versions on Free, 10 on Builder).
Images, PDFs, video, zip files, fonts, large artifacts, and task attachments go through fs_upload, so binary bytes never enter model context. Base64 input remains accepted here only for backward compatibility with existing callers; new binary uploads go through fs_upload.
It holds notes, JSON, CSV, generated source text, and small cached text that is not project code (project code goes through project_deploy).
There are two file surfaces: deployed source is read with project_files_list / project_file_read; fs_write and fs_read are runtime storage for uploads and generated files via sw.fs. Project source such as src/App.tsx or api/foo.ts is read with project_file_read, not fs_read.
Files are PRIVATE by default. A file served at a public URL (e.g. an embedded app image) takes public: true, and fs_public_url returns the URL. Without it the file is only reachable through your authenticated code.
Example (text):
{ "project_id": "my-saas", "path": "/notes/run.txt", "content_type": "text/plain", "content": "upload completed" }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": {
"project_id": "<project_id>",
"path": "<path>",
"content": "<content>"
},
"name": "fs_write"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Full path with leading slash, e.g. "/images/avatar.png" | |
| public | No | Public /storage URL exposure without auth. False (default) keeps files private; true supports images and assets embedded in an application. | |
| content | Yes | File content — UTF-8 text or base64 bytes (content_type matches it). | |
| project_id | Yes | Project ID (UUID), subdomain, or slug — resolved server-side, no UUID lookup needed. 'default' also works when the account has exactly one project; multi-project accounts must name one (the error lists them). | |
| content_type | No | MIME type, e.g. "image/png", "application/pdf". Defaults to application/octet-stream. |