get_html tool serializes the canvas to clean HTML and returns it as a string. The output is the same HTML that GrapesJS uses internally — no editor scaffolding, no wrapper divs added by the bridge. You can pass this output directly into a React component using dangerouslySetInnerHTML, save it to a file, or use it as a base for further agent processing.
If you pass a componentId, the output is scoped to that component’s subtree. This is useful when your agent needs to extract a specific section — a hero, a card, a navigation bar — without fetching the entire canvas.
Parameters
string
The ID of the component whose subtree you want to export. If omitted, the entire canvas is exported. Obtain component IDs from
get_tree or get_selection.Response
string
required
The serialized HTML string. Tailwind classes are preserved as-written in the canvas. CSS custom properties referenced by inline styles are not inlined — use
get_css to retrieve them alongside the HTML.Example
response
The HTML returned does not include
<html>, <head>, or <body> wrappers. It represents the inner canvas content only.