Skip to main content
A Canvas block is a chart or custom visual on a Page: a sandboxed React component that reads Model values through named datasets. Four tools work with them:
  • inspect_canvas_library finds the components and templates a block can use.
  • edit_canvas_blocks creates a block or changes a saved one.
  • validate_code_blocks renders saved blocks in a browser and reports what it saw.
  • inspect_canvas_blocks reads saved blocks.
Read the build-visualizations skill through inspect_skills before you add a Canvas block; it owns design guidance. Page order and block removal belong to edit_pages, and editable model tables to edit_table_blocks.

Find components and templates

Call inspect_canvas_library with a list block whose query is a few search words:
  • An entry matches when any one word appears in its title, description, tags, aliases, or decision outcomes.
  • kind narrows the list to component or template. Without query, the list holds every entry of that kind.
Then read the entries you plan to use. One read takes up to 16 targets and resolves templates and components together, so a template and the components it needs come back in one call:
A read returns each entry’s instructions, its props skeleton, and its runtime requirements. The shared Canvas visual contract follows the last entry of every read, components and templates alike, and overrides any conflicting styling in a template’s own instructions; a visual component or template also carries the full runtime_contract once. A name that matches nothing, or more than one entry, comes back as an unresolved entry. Library entries are building guidance; they are not saved blocks and prove nothing about how a block renders.

Create a Canvas block

edit_canvas_blocks create requires page, title, and source:
  • page is the Page that receives the block, by name or as inspect_pages prints it. after_block places the block under another one; without it the block goes last.
  • title is the block’s name. Later updates and page edits name the block by it.
  • source_template stands in for source: {"publication", "version"}, and file for a workspace template’s Canvas file such as canvas/summary.jsx, copy a published template’s Canvas code exactly as published as the block’s source. A create gives source or source_template, not both.
  • The receipt names the new block two ways. target is the block’s name-form selector, which the page and Canvas tools accept wherever they take a block as target. ref is the block’s pasteable reference, such as Pipeline by stage#a74, which they accept wherever a result’s block reference is accepted, such as reorder_blocks block_order. The reference keeps naming the block in later edit_pages calls even after a rename.
  • The receipt also carries dataset_evidence, one series and one row per dataset as the block receives them, and source_notes. A dataset still calculating when the result was due is listed with status: "unavailable" and error: this dataset’s calculation had not finished when this result was due, so it was stopped. A dataset whose Scenario access check was still running at that moment reads this dataset’s scenario access check had not finished when this result was due, so no access decision was made and the dataset was not read; one that names a Scenario the person cannot read reads scenario access denied; any other failure of that check reads authorization check failed: followed by the cause. The block is saved either way, and the other datasets keep their evidence.

What the source must be

source is one complete component, Block({ data, timeSettings, theme, state, action, emit }), run in a sandbox:
  • React is injected. Reach hooks through it, such as React.useState(...); a bare useState(...) is refused, and window.React is unavailable.
  • Imports, network access, and direct AgCharts are forbidden. Custom font families are refused.
  • A component declared inside Block and rendered as JSX is refused on a create. Block declares a new function for it on every render, so React remounts it. The refusal names each component: <Tip /> is declared inside Block and rendered as JSX. Block declares a new component function each time it renders, and React remounts a component whose function changes: a chart redraws and loses its measured size and hover state, and an input loses focus. A component declared at the top level of the source, outside Block, keeps its identity across renders and receives values through props. Several components open <Tip />, <HoverMark /> and <AreaChart /> are declared inside Block…. A capitalized helper the source calls as a function, RevenueLine(row), passes, and so does a component created inside a React.useState, useReducer, or useRef initial value, an effect, or a React.useMemo or React.useCallback callback with an empty dependency list; a useMemo or useCallback callback with dependencies is still scanned. The only exception is a create whose source_template copies a published template’s code exactly; that code is taken as published.
  • An update that changes the source through source or source_patches refuses only the inner components the saved source does not already declare inside Block, so a data-only refresh of a block that already has them saves. Components are matched by the name the source declares them with, one per declaration: renaming one, or adding a second declaration with the same name, counts as new and is refused with the same text, which names only the new ones. The kept components are stated in the receipt’s source_notes: <Tbl /> and <Bridge /> are declared inside Block, as in the source saved before this update. Block declares a new component function each time it renders, and React remounts a component whose function changes: a chart redraws and loses its measured size and hover state, and an input loses focus. An update that keeps the saved source, such as a title or dataset change or a resubmitted identical source, runs neither check.
  • An element of the block may go full screen. Every Canvas frame carries allow="fullscreen *", so element.requestFullscreen() works from a click in the block, such as a Present button on a slide deck. The backdrop behind the full-screen element is the theme’s surface color rather than the browser’s black, and an element taller than the screen scrolls. This includes the whole page: a block that calls document.documentElement.requestFullscreen() gets the theme’s surface behind it and scrolls when taller than the screen. Ari’s validator frame allows full screen for page and form renders, so document.fullscreenEnabled reads the same there as on the Page; an email render has no full screen. The sandbox’s other rules do not change.
  • print() prints only that block’s frame.
  • The injected components, their props, and the rest of the runtime contract are in the source field’s description in the tool schema, and each component’s props in inspect_canvas_library read.
  • Controls are ordinary HTML, drawn by the Canvas stylesheet in light and dark mode: <button> for actions, <input> for text, numbers, dates, times, and months, <select> or radio inputs in a <fieldset> for choices, a checkbox for an on/off value (role="switch" draws it as a switch), <input type="range"> beside an <output>, and <textarea>. A button’s data-variant of accent, ghost, or destructive sets its emphasis, data-ari-action marks a button that starts Ari work, and data-variant="segmented" on a container draws its radio labels as one segmented track. The library no longer lists control components; a saved block that still calls Button, InlineButton, Select, SegmentedControl, Toggle, Checkbox, Radio, RadioGroup, TextInput, or TextArea keeps working, drawn as the native element. Field and Slider remain components.
  • <input type="file"> lets the person pick a local file, which the block reads in their browser with File.text() or arrayBuffer(). The file never leaves the frame; Ari receives only what the block passes on, such as text in a startAriChat message of at most 4,000 characters.
  • Grid stacks its columns when the block is narrower than minColumnWidth, and also when a column’s content is wider than the column, with or without minColumnWidth. It cannot shrink that content, so a fixed-width row, a fixed table column, or text that does not wrap needs a layout that fits a 360 px phone or a deliberate horizontal scroll.

Datasets

A dataset is a live, read-only table read that the block receives as data.<name>. A block holds up to 8. The block receives the read inverted: each row of the layout becomes a series, and each column becomes one entry of data.<name>.rows, one plotted point. A layout with columns: [] and window.granularity: "NO_GRANULARITY" declares timeless values: one row holding each Variable’s value. On update, each datasets entry adds a dataset or replaces the saved one with the same name, and the others stay. Leaving datasets out keeps them all; [] clears them all; remove_datasets removes the ones it names.

Values a dataset row carries

Each row carries each Variable’s own value under its series key: row.date is a display label, and periodStart, when present, is the ISO start of the period. A dataset that failed has empty rows and series and an error string. A comparison dataset also carries scenario.label, scenario.isCurrent, and scenario.lastClose, and timeSettings.lastClose is the current Scenario’s close date or null.

Colors and the theme

  • Colors and type from theme.tokens, theme.design, or --cb-* CSS variables follow the viewer’s light or dark mode.
  • theme.tokens.surface and --cb-surface are transparent, because the Page paints the background behind the block. theme.tokens.surfaceRaised and --cb-surface-raised are the theme’s opaque raised color, for dialogs, popovers, and other overlays; control.surface and chart.tooltipSurface share it, and --cb-overlay-backdrop carries the dimming color behind an overlay. A native dialog element gets a themed surface, text color, border, corner radius, and dimmed backdrop by default; its own styles still win.
  • A literal or named color, including one in a palette, keeps its value in both modes. The write saves it, and the receipt’s source_notes names the first one: “<color> on line <n> is the first fixed color in this source: it keeps this value in light and dark mode. Colors from theme.tokens, theme.design, or —cb-* CSS vars follow the viewer’s mode.”
  • Headings take their typeface, size, and weight from the theme: h1 to h6 and the heading and title variants of Text read --cb-font-heading, --cb-text-heading or --cb-text-title, and --cb-weight-semibold, and a style or className changes these only by setting those values. Their color is the author’s to set: h1 to h6 inherit the color of the text around them, the Text variants use text.default, and a color in their own style or className replaces either, so a white heading on a dark panel stays white.
  • A workspace brand can set the heading typeface, the accent color, and the corner shape. A block follows the brand through theme.tokens.fontHeading or --cb-font-heading, theme.tokens.accent or --cb-accent, and theme.tokens.radius or --cb-radius, in every workspace it is copied to.

Change a saved block

edit_canvas_blocks update names the block with target, by name, ID, or as inspect_pages prints it. Fields you leave out keep their saved values, and the block keeps its identity and position.
  • source replaces the whole component. It requires based_on: the source_hash of the inspect_canvas_blocks read or the edit_canvas_blocks write the source was written from, 64 lowercase hex characters. The update saves only while the block’s saved source still has that hash. When another writer saved the block in between, the refusal reads the block’s saved source is no longer the source whose source_hash this update names in based_on, so this source was written from an older copy. This update saved nothing, so the block keeps its current source.; read the block again and redo the edit on the current source. Saves of the title, datasets, or display state do not change the hash. A source without based_on is refused.
  • source_patches changes part of it: a list of up to 50 exact old to new text replacements, applied in order. Each old must occur exactly once in the source as the earlier patches left it. The block saves only when every patch applies. Patches apply to the current source and take no based_on.
  • Every create and update returns each block’s source_hash, so the next whole-source update can name it.
  • title renames the block; an empty string clears the title.
  • page, when given, confirms the block is still on that Page.
  • An update that leaves the block exactly as it was saved, such as a patch whose old equals new, or a resubmitted source, title, and datasets, saves nothing and records no change: the item’s status is unchanged, the receipt is no_op with state_changed: no, and there is no change_log_id. With validate: true the block is still rendered as saved, and the validation note opens The block already held what the update asked for, so nothing was saved.

Check that a block renders

A saved block compiles, but only a browser shows whether it renders.
  • A Canvas write that no browser rendered returns a render_unverified warning: The block is saved and compiles; whether it renders is proven only when validate_code_blocks opens it in a browser.
  • validate: true beside the write returns the browser’s result for the saved revision under validation instead. A render check that fails or is unavailable leaves the edit saved. The dataset readback and the render check share one answer deadline, about 10 seconds before the call’s 119-second limit, so the receipt arrives instead of a timeout. If validation has not finished when the result is due, validation.note reads The Canvas edit saved. Browser validation had not finished when this result was due, so it was stopped and the render was not observed. If the result is due before validation begins, it reads The Canvas edit saved. This result was due before browser validation began, so validation did not run and the render was not observed. In both cases validation.enabled is false, as it is whenever no browser render was observed, including when the check is switched off or unreachable; read validation.note to tell the causes apart. The receipt carries the render_unverified warning, and the saved block stays saved.
  • validate_code_blocks checks saved blocks on their own:

What validate_code_blocks reports

  • It renders up to 8 blocks per call in Chromium, with live calculated datasets, once per theme (light and dark). Each render uses the block’s saved state, Scenario, number formats, and Last close, in a frame 1200 px wide. Each result names the revision and source hash it rendered.
  • The result’s observed sentence states what the check saw, such as: “Each block was rendered once per theme, with its saved state, in a 1200 px wide frame. Errors, warnings, plotted chart values, guide anchors, and any visual review come from those renders. Clicks, typing, links, and guide launches did not run, so what they do is unobserved. The light render was also laid out at 360, 600, 760, 900, 1100, and 1400 px wide to look for overlapping or spilling text; the layout at other widths is unseen.”
  • A block that rendered cleanly carries plotted: one entry per chart the render drew, with chart naming the chart by its title, when it has one, and its source position, such as Chart "Pipeline" at source L12, and series holding one entry per numeric value field of every visible series, with name, count, and the first, last, low, and high plotted points as {x, y}. The values are the ones the chart was given. The chart draws stacked and normalized series, waterfall running totals, and histogram bin counts from them, so the drawn shape of such a series differs from the list.
  • A warning that begins Design: names an element that wears a generated interface’s default and what to change, with its source position when it has one: cards nested in cards, a colored side stripe, gradient text, a colored glow shadow, a small uppercase label above a heading, text under 11 px, text under 4.5:1 contrast (3:1 for large text) against its painted fill in an authored color, a font size off the Canvas scale of 12, 13, 14, 18, and 32 px, motion that bounces or never ends, and an emoji used as an icon. A finding that repeats ends This repeats in N places.; at most twenty are reported per render, and none blocks the save.
  • Errors are failures the render reported: runtime errors, widget errors, a stalled render, console errors, and failed element loads. Warnings may be intended: console warnings, blank or error-code cells, empty or zero-only data, missing series keys, hidden series, and content past the frame’s edge. A warning also names text that overlaps or spills out of its box when the light render is laid out at 360, 600, 760, 900, 1100, and 1400 px wide, with each width, element, and source position, such as At 360, 600, 760 and 900 px wide, text overlaps: td “Orbitline Dev Pvt Ltd” at source 464:0 and td “OD-317” at source 465:0, in 8 places.; up to six such warnings are listed with a count of the rest. Fix one before handing the block over: stack columns with Grid minColumnWidth, let text wrap, or give a wide table a deliberate horizontal scroll.
  • A clean render does not check that the values are financially correct.
  • A control that opens a closed part of the block names the anchors it reveals with data-guide-reveals="liquidity holdings" and keeps aria-expanded current. A walkthrough step on an anchor the block does not draw clicks that control first, once, and never when it is already expanded; without such a control the step lights the whole block. validate_code_blocks warns, in both themes, when a Page block’s data-guide-reveals names an id that no data-guide-anchor in the source declares.
  • guide_targets lists the copyable guide anchors visible in at least one theme, and guideAnchors keeps each theme’s visibility and ambiguity. guideAnchors lists at most the first 64 distinct anchor IDs per theme, in document order. When the render had more, guide_anchors_cut says how many, and guide_targets draws only on the listed ones.
  • visual_review returns one block in one theme as an image. Without view or viewport, it is the full Canvas at 1200 px wide, capped at 2400 px high. view is a fixed opening, the area visible before scrolling: desktop-opening is 1100 × 700 CSS pixels and phone-opening is 320 × 650, after the host page uses part of the screen. Each fixed view also returns an independent design assessment of that image: a reading of its composition, hierarchy, typography, and color, with revision, the one blocking defect, or null when handoff can proceed, and refinement, an optional change that leaves the reading intact. revision.kind is unreadable, overlapping, cut_off, wrong_data, missing_requirement, or authoring_note, and revision.evidence says what in the image shows it. A preferred arrangement is not a missing requirement, and a direct label that shows a saved value in the model’s own precision is not a defect. A note about the work on the page, such as what was checked, what a preview covers, or where a number came from, is an authoring_note: the assessment asks for its removal, because that text belongs in chat. brief, up to 2,000 characters, tells the assessment what the opening is designed to show and the choices already settled for it, such as “EBITDA is the bridge’s endpoint, not a headline figure”; it needs a view and is refused without one with visual_review.brief has no view to apply to. A structured model call makes the assessment in a fresh context, billed to the workspace like a chat turn, separate from the render facts. For a non-null revision, make one repair, then one confirming review with the same target, view, and brief, and stop after it whatever it reports: tell the person about a remaining defect rather than treating it as fixed. A refinement needs no repair and no further review. The phone opening is 320 px wide, narrower than the 360 px the overlap warnings start at, so review the phone view when a block must fit a phone.
  • viewport is a measured Canvas area, width and height from 1 to 1600 CSS pixels: the width lays out every selected block, and the height crops the image without changing the content’s height. framing reports the dimensions and image scale. A call takes view or viewport, not both.

When a render does not happen

Errors a person’s browser reported

When a person’s browser hits a runtime failure while rendering a saved block, it reports the error for that exact Scenario, block, and source revision. inspect_pages read then returns it as the block’s render_error, and a later successful render clears it. An MCP call has no browser of its own, so a block nobody has rendered has no such report. A missing render_error does not mean the block renders.

Read saved Canvas blocks

inspect_canvas_blocks takes target, a block name, ID, or reference, or a list of related blocks, and optionally page to constrain them. It returns each block’s exact saved source, its source_hash (the hash of the whole saved source, also when the source comes back in part), dataset layouts and Scenario bindings, display state, position, revision, and references. All blocks are read at one snapshot, the latest unless as_of_point names an earlier one. It does not calculate datasets, and saved code is no proof of a successful render. dataset_layouts holds each dataset, by name, as the edit_canvas_blocks datasets entry that saves it:
  • name, scenario, layout, and window. scenario is the bound Scenario’s current name, and is absent when the dataset follows the Scenario in view, the rule the write applies. layout is written as Canvas dataset layouts declares it: items in include, a breakdown level as its Dimension name, a fork as branches numbered by path with the shared levels under every path in after_branches.
  • An entry with a layout, sent back unchanged in an update, saves the same dataset, with its Scenario binding and window; the read carries none of the saved-table read fields (signature, signature_status, prompt, presentation), which the write refuses.
  • A saved layout with structure a Canvas write has no field for, such as a saved format, a spacer row, or declared items, comes back with layout_problem naming the entry in place of layout.
  • datasets (the saved ids) and dataset_scenarios are unchanged.
A selection larger than one result is cut short:
  • Each run of 1,000 or more encoded characters in a source, such as base64 or hex, reads as [[N encoded characters not shown]].
  • A source still too large comes back in part. source_part gives the byte range it covers, and the next call passes next.source_offset as source_offset.
  • not_returned lists the selected blocks left out, with their sizes, and next holds the arguments that read the rest.
On a user click, emit({type: 'navigate', url}) opens a page or block link that a tool result returned, or another app address in the current workspace, through normal browser history. It keeps Scenario query parameters and #block-anchor-<block-id>. External addresses and public share views are not supported. The source field’s description covers the block’s other actions, such as saving presentation state and starting an Ari action.

Name blocks in page edits

edit_pages arranges and removes blocks, including Canvas blocks.
  • A block action names its Page with page.
  • add_text may omit page. It then uses the Page of an after_block reference it was given, else the Page in view, else the Scenario’s only Page. When none of these settles it, the call is refused: with several Pages, with no target page and up to 20 of them as candidates, and its hint gives the Scenario’s page count and how many are listed; with no Pages, with this scenario holds no pages.
  • update_text and delete_block may omit page; they then use the Page in view, and a returned block target finds its own Page.
  • reorder_blocks names the Page it arranges with page, or with target. block_order is the complete top-to-bottom order, with each visible block once, by name or by the block references other results print. place moves one block instead: block, after_block, and to_page to move it to another Page.
  • A Page a person has opened in the Page editor has a saved document: its text as prose, with one entry for each block in reading order. reorder_blocks arranges the block entries inside that document and leaves the prose where it is. The largest set of blocks already in the requested order keeps its places; each other block moves directly below the block before it in the new order, or directly above the first unmoved block when it comes first, so a Page’s opening text stays at the top. With place, the named block is the one that moves, even when moving a neighbor would give the same order, and prose nested under it stays where the block was. A place with to_page onto such a Page adds the block’s entry to the destination document directly below its after_block, or last without one. The one order refused is one that would put a block between another block and the content nested under that block: invalid block order: the order puts a block between another block and the content nested under it.
  • A delete_block aimed at a block that another saved change already deleted answers not_found and changes nothing. Its message names that change and, when the block went with its Page, the Page: Block <id> is already deleted in scenario "Main": saved change <n> deleted it together with its page "<name>". This call changed nothing. The result carries block_id, layer_id, and deleted_by_change_log_id.
  • delete_block refuses to delete objects that lose their last table occurrence while formulas, other blocks, settings, or hand-added items depend on them. force: true deletes them anyway, and those references break. Objects still shown on other tables are kept.
For paging through inspect_pages, see Pagination and truncation.