set_custom_code
Set site-wide custom code: head goes before and body before on every page, on every layout. Saved as a draft; goes live with the next publish_site (on a live-mode site the dashboard publishes only the code). Never runs in the editor. ≤20,000 characters per box, stored as sent; warnings flags likely mistakes (unclosed , // tags, canonical or robots tag, GA4 already connected) without rejecting. Send only the boxes you change; "" clears one. runOn ('live' default; 'live-and-preview' adds the editor preview) applies at once — agents limited to drafts can't set it. For tag managers (GTM), Clarity, ads pixels, chat widgets, verification tags; plain GA4/Plausible/Fathom/Umami: set_analytics_provider.
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": {
"site": "<site>"
},
"name": "set_custom_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | Code for before </body> on every page. "" clears it. | |
| head | No | Code for before </head> on every page. "" clears it. | |
| site | Yes | Site slug, e.g. acme-studio | |
| runOn | No | Where it runs: 'live' (live site only) or 'live-and-preview'. Applies at once. | |
| context | No | Why you're calling this (activity log). |