page.add_section
Appends or prepends a section to a page. Supports standard sections or custom code sections with raw HTML, CSS, and optional browser-side JavaScript (type: 'custom_code', html: '...', css: '...', js: '...'). When adding interactive widgets (calculators, quizzes, interactive previews) or announcements, supply responsive HTML & CSS (and optional sandboxed JS via 'js') or specify 'name' and 'position: start'. Automatically sanitizes HTML, scopes CSS, and isolates JS in a sandboxed iframe.
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": {
"siteId": "<siteId>",
"slug": "<slug>"
},
"name": "page.add_section"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| js | No | Optional browser-side JavaScript for interactive DOM manipulation, event listeners, calculators, quizzes, or animations (executed in an isolated sandboxed iframe with restrictive CSP). | |
| css | No | Optional scoped CSS styles for the HTML section | |
| html | No | Custom HTML markup (required if type is 'custom_code' or when adding an HTML block) | |
| name | No | Display name or label for the section (e.g. 'Announcement Banner', 'Custom Pricing Calculator') | |
| slug | Yes | Target page slug (e.g. '/' or '/about') | |
| type | No | Section type. Use 'custom_code' for custom HTML/CSS/JS sections, or standard types like 'features', 'cta', 'hero', etc. Defaults to 'custom_code'. | |
| siteId | Yes | MongoDB Site ID | |
| position | No | Where to insert the section: 'end' (default) or 'start' (top of page) | |
| sectionData | No | Optional full section object or custom content dictionary |