Create an HTML block
create_blockCreate an HTML block for Zuar Portal by providing name, CSS, JSON data, UI queries, tags, and access. Validates structure and references, with dry-run support to preview before writing.
Instructions
Create a new HTML block. Accepts the full block payload (name, css, json_data, ui_queries, tags, access). Type is always html. Read the zportal://guide/* resources first to produce a correct two-field block. Equivalent to create_resource resource="block" with a typed schema; the authoring rules, structural and referential gates run either way. dry_run:true previews.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| css | No | Block CSS. Array form per the portal API; a raw CSS string is also accepted. | |
| data | No | Legacy query-config object. Ignored by current portal versions — bind data via `ui_queries` instead. Kept only for backward compatibility. | |
| name | Yes | Display name of the block. | |
| tags | No | Tag names to attach. | |
| type | No | Block type. This server only handles HTML blocks, so it must be "html". | html |
| access | No | Access control, e.g. { "groups": ["group-name"] }. | |
| dry_run | No | Run every gate and report the would-be write without creating. | |
| css_file | No | Path to a file holding the block's CSS; the server reads it into `css`. Same byte-exact guarantee and same root containment as html_file. Mutually exclusive with `css`. | |
| html_file | No | Path to a file holding the block's HTML+JS; the server reads it into json_data.html. PREFER THIS over inlining large content: the bytes are read off disk byte-exact, so nothing is retyped and characters like em dashes or box-drawing cannot silently normalize. Mutually exclusive with json_data.html. Must resolve under the CWD, the VC dir, or a PORTAL_FILE_ROOTS entry. | |
| json_data | No | Widget/extra config object. | |
| ui_queries | No | Query/datasource binding (this is how a block gets data — the portal has no `data` field). Array of { enabled, page_size, query_id, filter_strategy }, e.g. [{ "enabled": true, "page_size": 50, "query_id": "<query-uuid>", "filter_strategy": { "type": "blacklist", "value": [] } }]. The query_id must reference a saved query that already has a datasource attached. On update_block, the existing ui_queries is preserved automatically unless you pass a new value. |