site_code
Read, update, or append custom CSS, JavaScript, head, and body code for an entire WebCake storefront or one page, with validation and native-first safeguards.
Instructions
Custom code, site-wide or for ONE page (native first: refused when an element can do it). Pick the operation with action and pass that action's arguments (help:true returns its full documentation and schema).
get_site_custom_code: Get custom code of the site (CSS/JS).
update_site_custom_code: Update custom code (CSS/JS) for the entire site.
append_site_custom_code: Append or prepend code to a custom code field.
get_page_custom_code: Read the custom code of ONE page (CSS / JS / head / body slots in page.settings.custom_code), its budget usage, the element ids and custom classes the code can target on that pa…
update_page_custom_code: Save custom code for ONE page — only when the element schema can't do what the user asked (NATIVE FIRST: element → its settings/events/bindings → an app → code).
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": {
"action": "<action>"
},
"name": "site_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Code to add [append_site_custom_code] | |
| help | No | Return the action's full documentation and argument schema instead of running it | |
| mode | No | replace (default): set the given slots; append: add after the current code [update_page_custom_code] | |
| field | No | Which code field to modify [append_site_custom_code] | |
| action | Yes | Which operation to run | |
| fields | No | Only return specific fields (e.g. [get_site_custom_code] | |
| dry_run | No | Validate and show what would be saved, without saving (default: on in confirm mode) [update_page_custom_code] | |
| page_id | No | Page ID (list_pages) [get_page_custom_code, update_page_custom_code] | |
| position | No | Add to end (append) or beginning (prepend) [append_site_custom_code] | |
| native_gap | No | Only when the code was refused and no native way exists: the need, the elements/apps you checked,… [update_site_custom_code, append_site_custom_code, update_page_custom_code] | |
| allow_shrink | No | Allow removing more than half of a field: set it when native elements or the CMS replaced that co… [update_site_custom_code, update_page_custom_code] | |
| include_guide | No | Include the custom code coding guide (only needed on first call) [get_site_custom_code] | |
| code_custom_css | No | Custom CSS for the site [update_site_custom_code, update_page_custom_code] | |
| code_before_body | No | HTML/script to insert before </body> [update_site_custom_code, update_page_custom_code] | |
| code_before_head | No | HTML/script to insert in <head> [update_site_custom_code, update_page_custom_code] | |
| code_custom_javascript | No | Custom JavaScript for the site [update_site_custom_code, update_page_custom_code] |