Skip to main content
Glama

Edit section

swebsy_edit_section

Edit an existing page component by target ID or path, replacing its tree, HTML, or applying a JSON patch. Use it to change section structure, text, and styling.

Instructions

Modify an existing component. By default this edits the selected component. To edit a component identified by read_page, provide its targetId (preferred — survives other edits) or targetPath; an explicit target overrides the canvas selection. Preferred: provide component — the full replacement component tree (compact DSL OK), best for structural changes. Alternative: provide html — the complete modified HTML string. Fallback: provide patch — JSON Patch (RFC 6902) for tiny single-property tweaks. Supply exactly one. Preserve existing IDs: an id kept in the edit keeps the styles attached to it; an id you drop loses them. The result's id is the component's id after the edit (a replacing edit can give it a new one). changed: false means the page's HTML/CSS/JS came out identical, so the edit did not show up; success: false means a patched attribute is not what the page exports.

Input Schema

NameRequiredDescriptionDefault
htmlNoThe complete modified HTML for the target component. Prefer existing semantic/theme classes over raw Tailwind utilities. Preserve existing id attributes.
patchNoJSON Patch (RFC 6902) operations applied to the target component JSON. Only for tiny single-property tweaks. HTML attributes live under /attributes (an image's src is /attributes/src), classes at /classes, text at /content.
summaryYes1 sentence explaining what the edit does.
targetIdNoThe component to edit by its id, as `read_page` shows it after `#` (e.g. "ieyubib", or "call-2-2" in a symbol instance). Stays valid when other components move or are added, unlike a path. Pass this OR the path, not both.
componentNoFull replacement component tree. Use compact DSL (t/c/x/a/k) to save tokens. Preserve existing attributes.id values. A `style` object merges into the styles already on that id, so you only send the declarations that change.
targetPathNoZero-based component indexes from the current page root, exactly as returned by the most recent `read_page` call (for example [0] for the first top-level section or [0, 2] for its third child). Use this when the user names or relatively identifies a component instead of selecting it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.14.1
    • changedInput schema / properties / component / properties / t / enum
      Previous value: -[
      -  "container",
      -  "layout-row",
      -  "column",
      -  "div",
      -  "divider",
      -  "heading",
      -  "h1",
      -  "h2",
      -  "h3",
      -  "h4",
      -  "h5",
      -  "h6",
      -  "paragraph",
      -  "link",
      -  "link-block",
      -  "badge",
      -  "blockquote",
      -  "list",
      -  "ul",
      -  "ol",
      -  "li",
      -  "list-item",
      -  "span",
      -  "text",
      -  "textnode",
      -  "image",
      -  "video",
      -  "iframe",
      -  "audio",
      -  "google-map",
      -  "card",
      -  "card-media",
      -  "card-overlay",
      -  "card-group",
      -  "card-header",
      -  "card-body",
      -  "card-footer",
      -  "swebsy-icon",
      -  "gallery",
      -  "lightbox",
      -  "svg",
      -  "svg-in",
      -  "nav",
      -  "navbar",
      -  "navbar-brand",
      -  "navbar-toggler",
      -  "navbar-collapse",
      -  "navbar-nav",
      -  "nav-item",
      -  "nav-link",
      -  "breadcrumbs",
      -  "btn",
      -  "copy-button",
      -  "dark-mode-switch",
      -  "marquee",
      -  "form",
      -  "input",
      -  "textarea",
      -  "select",
      -  "option",
      -  "label",
      -  "fieldset",
      -  "legend",
      -  "checkbox",
      -  "radio",
      -  "button"
      -]New value: +[
      +  "container",
      +  "layout-row",
      +  "column",
      +  "div",
      +  "divider",
      +  "heading",
      +  "h1",
      +  "h2",
      +  "h3",
      +  "h4",
      +  "h5",
      +  "h6",
      +  "paragraph",
      +  "link",
      +  "link-block",
      +  "badge",
      +  "blockquote",
      +  "list",
      +  "ul",
      +  "ol",
      +  "li",
      +  "list-item",
      +  "span",
      +  "text",
      +  "textnode",
      +  "image",
      +  "video",
      +  "iframe",
      +  "audio",
      +  "google-map",
      +  "image-compare",
      +  "card",
      +  "card-media",
      +  "card-overlay",
      +  "card-group",
      +  "card-header",
      +  "card-body",
      +  "card-footer",
      +  "swebsy-icon",
      +  "gallery",
      +  "lightbox",
      +  "svg",
      +  "svg-in",
      +  "nav",
      +  "navbar",
      +  "navbar-brand",
      +  "navbar-toggler",
      +  "navbar-collapse",
      +  "navbar-nav",
      +  "nav-item",
      +  "nav-link",
      +  "breadcrumbs",
      +  "btn",
      +  "copy-button",
      +  "dark-mode-switch",
      +  "marquee",
      +  "accordion",
      +  "accordion-item",
      +  "accordion-summary",
      +  "form",
      +  "input",
      +  "textarea",
      +  "select",
      +  "option",
      +  "label",
      +  "fieldset",
      +  "legend",
      +  "checkbox",
      +  "radio",
      +  "button"
      +]
    • changedInput schema / properties / component / properties / type / enum
      Previous value: -[
      -  "container",
      -  "layout-row",
      -  "column",
      -  "div",
      -  "divider",
      -  "heading",
      -  "h1",
      -  "h2",
      -  "h3",
      -  "h4",
      -  "h5",
      -  "h6",
      -  "paragraph",
      -  "link",
      -  "link-block",
      -  "badge",
      -  "blockquote",
      -  "list",
      -  "ul",
      -  "ol",
      -  "li",
      -  "list-item",
      -  "span",
      -  "text",
      -  "textnode",
      -  "image",
      -  "video",
      -  "iframe",
      -  "audio",
      -  "google-map",
      -  "card",
      -  "card-media",
      -  "card-overlay",
      -  "card-group",
      -  "card-header",
      -  "card-body",
      -  "card-footer",
      -  "swebsy-icon",
      -  "gallery",
      -  "lightbox",
      -  "svg",
      -  "svg-in",
      -  "nav",
      -  "navbar",
      -  "navbar-brand",
      -  "navbar-toggler",
      -  "navbar-collapse",
      -  "navbar-nav",
      -  "nav-item",
      -  "nav-link",
      -  "breadcrumbs",
      -  "btn",
      -  "copy-button",
      -  "dark-mode-switch",
      -  "marquee",
      -  "form",
      -  "input",
      -  "textarea",
      -  "select",
      -  "option",
      -  "label",
      -  "fieldset",
      -  "legend",
      -  "checkbox",
      -  "radio",
      -  "button"
      -]New value: +[
      +  "container",
      +  "layout-row",
      +  "column",
      +  "div",
      +  "divider",
      +  "heading",
      +  "h1",
      +  "h2",
      +  "h3",
      +  "h4",
      +  "h5",
      +  "h6",
      +  "paragraph",
      +  "link",
      +  "link-block",
      +  "badge",
      +  "blockquote",
      +  "list",
      +  "ul",
      +  "ol",
      +  "li",
      +  "list-item",
      +  "span",
      +  "text",
      +  "textnode",
      +  "image",
      +  "video",
      +  "iframe",
      +  "audio",
      +  "google-map",
      +  "image-compare",
      +  "card",
      +  "card-media",
      +  "card-overlay",
      +  "card-group",
      +  "card-header",
      +  "card-body",
      +  "card-footer",
      +  "swebsy-icon",
      +  "gallery",
      +  "lightbox",
      +  "svg",
      +  "svg-in",
      +  "nav",
      +  "navbar",
      +  "navbar-brand",
      +  "navbar-toggler",
      +  "navbar-collapse",
      +  "navbar-nav",
      +  "nav-item",
      +  "nav-link",
      +  "breadcrumbs",
      +  "btn",
      +  "copy-button",
      +  "dark-mode-switch",
      +  "marquee",
      +  "accordion",
      +  "accordion-item",
      +  "accordion-summary",
      +  "form",
      +  "input",
      +  "textarea",
      +  "select",
      +  "option",
      +  "label",
      +  "fieldset",
      +  "legend",
      +  "checkbox",
      +  "radio",
      +  "button"
      +]
  2. Changed2 schema fields changedv0.13.1
    • changedInput schema / properties / patch / description
      Previous value: -"JSON Patch (RFC 6902) operations applied to the target component JSON. Only for tiny single-property tweaks."New value: +"JSON Patch (RFC 6902) operations applied to the target component JSON. Only for tiny single-property tweaks. HTML attributes live under /attributes (an image's src is /attributes/src), classes at /classes, text at /content."
    • addedInput schema / properties / targetId
      Added value: +{
      +  "description": "The component to edit by its id, as `read_page` shows it after `#` (e.g. \"ieyubib\", or \"call-2-2\" in a symbol instance). Stays valid when other components move or are added, unlike a path. Pass this OR the path, not both.",
      +  "minLength": 1,
      +  "type": "string"
      +}
  3. First observedv0.8.0

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare it is a non-read-only, non-destructive edit, so the safety profile is already covered. The description then adds genuinely useful behavior: id preservation determines whether styles survive, the returned id may change after a replacing edit, and changed:false vs success:false have distinct meanings. That goes beyond annotations, but the reading of success:false ('a patched attribute is not what the page exports') is cryptic and the description never mentions undo or permanence.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the action and targeting rules before the payload choice and return-value semantics. Every sentence either states a rule ('Supply exactly one') or a consequence (dropped ids lose styles), and none repeat the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Although there is no output schema, the description compensates by explaining what the result's id, changed, and success fields mean. Combined with full schema coverage and rich annotations, an agent has everything needed to target, invoke, and interpret this mutation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, and the schema already documents each of the six parameters thoroughly, including the compact alias fields and the style object. The description adds strategic guidance on which of the three payloads to choose and notes that compact DSL is acceptable, but it does not describe parameter syntax or constraints beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource ('Modify an existing component') and immediately narrows the scope to the selected component, by targetId, or by targetPath. It is clearly distinguishable from sibling mutators such as swebsy_add_section and swebsy_delete_section without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives an explicit selection strategy: targetId preferred over targetPath because it survives other edits, and an explicit target overrides the canvas selection. It also ranks the three payload forms — component (preferred), html (alternative), patch (fallback) — and states 'Supply exactly one', leaving nothing to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.