Edit or remove a site section
edit_sectionChanges one node of a site - text, title, styling, link, image, heading level - or removes it and its descendants when remove is true. Address a section with section_id (from list_sections) or index, then aim at the node inside it with field (e.g. "heading", "body", "items[1].title"); list_sections shows every section's fields. Text goes on text nodes only: content aimed at a container is refused with the right field names. Free, and no account is needed for a draft you created.
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": "edit_section"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alt | No | New alt text for an image section. | |
| src | No | New image/media source (same URL scheme rules as href). | |
| href | No | New link target (http:, https:, mailto:, tel:, a path starting with /, or an in-page anchor like #pricing). | |
| page | No | Which page of the site, as its path ("/about", "/contact"). Omit for the home page. See list_pages. | |
| field | No | Which node inside the addressed section to change, from that section's fields in list_sections: "heading", "body", "text[n]", "links[n]", "image", "items[n].title", "items[n].body", "items[n].price", "items[n].link", "items[n].image". A card with no link or photo yet: set field "items[n].link" with href (and optional content as the label) or "items[n].image" with src, and it is created. "items[n]" addresses the whole card (use with remove: true to delete one card). Omit to change the addressed node itself. | |
| index | No | The section (or node) index to edit or remove. Indices SHIFT/renumber whenever an earlier section is removed elsewhere on the page, so an index recorded before a removal may now point at a different section. Prefer section_id; call list_sections first (or after any removal) to get each section's CURRENT index and its stable section_id, which never changes. Give index, section_id, or both (they must agree). | |
| level | No | New heading level (1-6) when this section is a heading textBox. | |
| stage | No | true = work on a staged copy instead of the live site: preview it at staged_preview_url, then publish_staged or discard_staged. Omit for a normal (immediately live) edit. | |
| title | No | New title attribute for this section. | |
| remove | No | When true, removes this section and its descendants instead of editing it (with field "items[n]": removes that one card). | |
| content | No | New text content for this section. | |
| html_id | No | New HTML id for the node (e.g. "contact" for #contact anchor links). | |
| subtype | No | New subtype for this section. | |
| add_item | No | Adds one card to the addressed section (services, features, pricing, products, testimonials...), styled like its last card. Fields not given are left out. The response gives its item number. | |
| site_key | No | The site to edit. Defaults to the caller's current draft site when omitted. | |
| class_name | No | New Tailwind class string for this section. | |
| section_id | No | The stable id of the section to address, exactly as list_sections returns it (e.g. "about-1"). It survives removals, unlike index. This ADDRESSES a section; it does not rename anything (use html_id for that). | |
| draft_token | No | The draft token returned by draft_create, if you are working on an anonymous draft. Only needed when your client cannot send the x-pagetool-draft-token header. |