Section and Stylesheet Tools
Read and change one section of a page, and a theme's stylesheet, without sending the whole page. People, API keys, and the account's own AI assistant use the same actions with the same checks.
Sections by Place
A page's sections are numbered from 0 in the tools (0 is the first section). In plain words and on screen the first section is "section 1".
- See one section of a page (action
sites.pagesection.get, MCP toolwebsites_page_section_get): give the page and the place. A custom section comes back with its name, HTML, CSS, and text fields. Any other section comes back with its own settings. - Change a custom section of a page (action
sites.pagesection.save, MCP toolwebsites_page_section_save): give the page, the place, and any of html, css, fields, and name. What you leave out stays as it was. Only a custom section has HTML, CSS, and fields. A custom section's HTML may use the interactive pieces (theme choice, menu button, show and hide, switcher) described under Interactive Pieces in the Custom Sections page; the answer lists anything cleaning removed. - Add a section to a page (action
sites.pagesection.add, MCP toolwebsites_page_section_add): give the page and the kind (for exampletextorcustom) with that kind's settings. Add a place to put it there, or leave it out to add it at the end. A page holds at most 200 sections. - Move a section of a page (action
sites.pagesection.move, MCP toolwebsites_page_section_move): give the page, the place it is now (from), and the place it should go (to). The other sections keep their order and their contents. - Remove a section from a page (action
sites.pagesection.remove, MCP toolwebsites_page_section_remove): give the page and the place. The sections after it move up by one.
A place that does not exist is refused, and the answer says how many sections the page has.
Duplicate a Page and Change Only Its Words
- Duplicate a page (action
sites.page.duplicate, MCP toolwebsites_page_duplicate): give the page, a title for the copy, and optionally an address (it is made from the title when left out). The copy has every section of the original, custom sections included, exactly as they are, the same shared layout, picture, and summary. It is always a draft. The answer returns the new page's id and, for each section, its place, kind, name, and (for a custom section) the names of the text fields its HTML reads. The search title, search description, preferred address, and focus keyword start empty, because they describe the original page. - Change the text fields of several sections at once (action
sites.pagefields.save, MCP toolwebsites_page_fields_save): give the page and a list of sections, each with its place and the fields to change. Only fields the section's HTML already reads can be set, and only custom sections have fields. For a live price write{price:PUBLIC_ID}in the field (the public id of a product from the Subscriptions products list); a typed price never follows the product. The HTML, the CSS, and every other section stay exactly as they were. The call is all or nothing: a field the HTML does not read, a section that is not custom, or a place that is not on the page refuses everything and the answer lists the fields that exist.
Custom HTML code (the Embed section) already on the page is copied byte for byte, because a person placed it in the same account. An assistant or key still cannot write or edit it, and everything else in a custom section's HTML and CSS goes through the same cleaning as any save.
Header and Footer as Custom Sections
- See the global sections (action
sites.global.list, MCP toolwebsites_globals): the header and footer come back with their custom section (html, css, fields) when they have one. - Change the header or footer (action
sites.global.save, MCP toolwebsites_global_save): give the website,key(header or footer), and any ofcustom_html,custom_css, andcustom_fields. What you leave out stays; the fields you send replace the old ones. Sendcustom_clearas true to go back to the built in header or footer. The answer lists what cleaning removed, each with its reason. The change shows on the live website after the next publish, and a change an AI assistant or an API key saves is held to the same rules as any other global change.
What Cleaning Removes
A custom section's HTML and CSS are cleaned every time they are saved, the same way as on the screen. Scripts, event handlers, frames, forms that post elsewhere, and addresses outside the website are removed. The answer to a save lists each removal as kind (html or css), what was removed, and why, in a plain sentence, so a person or an assistant sees exactly what changed and can try again.
Stylesheet for a Theme
- See a theme's stylesheet (action
sites.theme.css.get, MCP toolwebsites_theme_css_get): the CSS every page of a website using the theme gets. - Change part of a theme's stylesheet (action
sites.theme.css.patch, MCP toolwebsites_theme_css_patch): change the text you name, only if it is in the stylesheet once (or every time, with all set to yes). Saved as a new version. - See the versions of a theme's stylesheet (action
sites.theme.css.versions, MCP toolwebsites_theme_css_versions): the versions, newest first, and the text of one. - Restore an earlier version of a theme's stylesheet (action
sites.theme.css.restore, MCP toolwebsites_theme_css_restore): makes that version the newest. Nothing is removed. - Change a theme's stylesheet (action
sites.theme.css.save, MCP toolwebsites_theme_css_save): give the theme and the CSS (up to 1,000,000 characters once cleaned, and the request itself can be at most 1 MiB). It is cleaned the same way and saved compact, and the answer lists what was removed and why. Leave the CSS out to clear the stylesheet. It shows on the live website after the next publish, where visitors get it as one file their browsers keep.
Drafts and Publishing
Seeing a section or a stylesheet needs the permission to see websites. Changing one needs the permission to build websites.
A change an AI assistant or an API key saves stays a draft: the page is marked as waiting for a person, and the website does not change until a person with the publish permission publishes. An assistant never publishes. A person's change on a page already marked ready is kept as it was marked.
Every change is written in the Activity Log with who made it ("AI agent" for an assistant) and which section it changed.
Where to Find It
No screen, because these are tools for AI assistants and keys. A person edits a section in Websites, then Page Builder, and a theme stylesheet in Websites, then Themes.