Skip to main content

Droost: Canvas Tree Set

droost_canvas_tree_set Write (gated)

Module: Droost Canvas

Writes a complete component tree (full replacement; empty items clears). Supply your own uuids for byte-identical re-runs, every enum/defaulted prop explicitly, and validate first. dry_run=true rehearses without writing; the real write is gated.

Example call
{
    "tool": "droost_canvas_tree_set",
    "arguments": {
        "id": "1",
        "dry_run": true,
        "items": [
            {
                "component_id": "sdc.droost_tailwind.hero",
                "uuid": "aaaaaaaa-0000-4000-8000-000000000001",
                "inputs": {
                    "title": "Hello from the docs",
                    "subtitle": "A one-item example tree.",
                    "min_height": "compact"
                }
            }
        ]
    }
}
Example response — captured live on this site
{
    "success": true,
    "message": "Dry run: 1 item(s) are valid. Call again with dry_run=false to persist.",
    "data": {
        "persisted": false,
        "items": [
            {
                "uuid": "aaaaaaaa-0000-4000-8000-000000000001",
                "component_id": "sdc.droost_tailwind.hero",
                "parent_uuid": null,
                "slot": null,
                "inputs": "{\"title\":\"Hello from the docs\",\"subtitle\":\"A one-item example tree.\",\"min_height\":\"compact\"}",
                "label": null
            }
        ]
    }
}

Replaces an entity's Canvas component tree with a validated one, all-or-nothing: Droost structural checks + Canvas's own constraints must pass or nothing is written. Items: {component_id (Canvas Component id from droost_canvas_components, e.g. "sdc.mercury.cta"), inputs (prop map satisfying the component's schemas), parent_uuid+slot for nested items, optional uuid/component_version/label} in display order. Omitted versions are stamped with the active component version; omitted uuids are GENERATED, so supply uuids (e.g. reuse tree_get output) when byte-identical idempotence matters. An empty items list clears the tree. Set dry_run=true to validate only. Destructive (content write): requires droost.settings.allow_destructive.

Input schema (JSON Schema)
{
    "type": "object",
    "properties": {
        "entity_type": {
            "type": "string",
            "description": "Entity type id (default \"canvas_page\")."
        },
        "id": {
            "type": "string",
            "description": "The target entity id."
        },
        "field": {
            "type": "string",
            "description": "The component_tree field name; omit to auto-discover."
        },
        "items": {
            "type": "array",
            "description": "The replacement tree, in order. Roots omit parent_uuid/slot; children set both. The whole field is replaced — include every item the page should keep (droost_canvas_tree_get output is directly reusable).",
            "items": {
                "type": "object"
            }
        },
        "dry_run": {
            "type": "boolean",
            "description": "Validate and return the normalized items without saving (default false)."
        }
    },
    "required": [
        "id",
        "items"
    ]
}