Create or replace one code file
write_fileCreate a workspace code file or replace its full content without touching other files, blocks, links, or layout. Use edit_file to change only part of an existing file.
Instructions
THIS is how you edit a workspace code file — a page, a stylesheet, a helper library. Creates it if it doesn't exist. Do NOT re-send the whole workspace with set_workspace_content to change one file: everything else (blocks, links, other files, the camera, the layout) stays untouched here, and re-emitting files you didn't mean to change is how one of them gets silently corrupted. content is the FULL new content, so this is the tool for CREATING a file or replacing one outright — to change part of a file that already exists, use edit_file instead. Names are case-sensitive; a name differing only in case from an existing file is rejected (rename = write the new name, then delete_file the old one). Writing an HTML PAGE also returns what a findable page is still missing (title, description, canonical, lang…) — advisory only, the file is written either way; see get_block_model's PUBLISHING A SITE.
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": {
"workspaceId": "<workspaceId>",
"name": "<name>",
"content": "<content>"
},
"name": "write_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seo | No | How much to report about the HTML pages being written: "full" (default) everything, "minimal" only what an indexed page cannot do without, "none" to say nothing. Never blocks the write; a page with <meta name="robots" content="noindex"> is exempt either way. | |
| name | Yes | Case-sensitive file name, folders with "/" — e.g. "pages/app.css", "lib/http.js". | |
| content | Yes | The file's FULL new content — this replaces it. To change PART of an existing file, use edit_file. | |
| workspaceId | Yes |