AddSynapse: draft a small custom script
plan_custom_scriptAddSynapse: Prepare a DRAFT of a small custom JavaScript for the public pages (for example a sticky header, a back-to-top button, a notice bar) — ONLY when no design tool can do it, and never for measurement codes (plan_tracking_code does those). Works only when the site owner turned on «Allow the AI to add JavaScript» in WordPress (AddSynapse → Settings); otherwise the answer says how — tell the user and stop. Write plain readable code: one statement per line, lines up to 300 characters, at most 20 KB. The site refuses it, with the reason, for: eval / Function / timers with text / encoded or escaped text, cookies, localStorage / sessionStorage, reading form fields or what visitors type, location (redirects), window.open, document.write, script / iframe / form tags or elements, XMLHttpRequest / jQuery ajax / new Image, and fetch / sendBeacon / addresses other than a fixed address on this site or a domain the owner allowed in WordPress. It runs after the page has loaded, never on checkout, cart, my account, login or wp-admin pages. label = what it does in a few words; about = one or two plain sentences for the owner; pages = "all", "front_page" or a list of page / post ids. To change a script send its key (describe_tracking) with the new values; to remove: {"key": "...", "remove": true}. Changes nothing by itself: the card shows the whole code; nothing runs until the user presses Approve; Undo restores exactly. Before calling it, say in plain words what the script does and on which pages, and get the user's agreement.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "plan_custom_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | an existing script (describe_tracking scripts) | |
| code | No | ||
| site | No | Which connected site: its address or site_id from addsynapse_list_sites. Omit when the account has only one site. | |
| about | No | ||
| label | No | ||
| pages | No | "all" (default), "front_page" or page / post ids | |
| remove | No |