set_variables tool writes CSS custom properties to the :root of the canvas iframe. Variables you set here become available throughout the canvas as design tokens — any component using var(--your-token) in its styles will reflect the change immediately. The update is a merge operation: only the keys you provide are written, and any existing keys you don’t include are preserved unchanged. The full updated map is returned so your agent can confirm the final state.
Changes made with set_variables are persisted to the cssVariables section of .designjs.json and re-applied every time the canvas reloads, making them a durable part of your design system.
Parameters
object
required
A
Record<string, string> of CSS custom property names (including the -- prefix) to their new values. For example: { "--brand-primary": "oklch(0.55 0.2 260)", "--radius-lg": "1rem" }. Values can be any valid CSS value string.Response
object
required
The complete updated
Record<string, string> of all CSS custom properties currently applied to the canvas :root — not just the ones you changed. This is equivalent to calling get_variables immediately after the update.Example
response
Variables are merged into the existing set. To remove a variable, you cannot pass
null or an empty string — you would need to manually edit .designjs.json or reset the canvas. When in doubt, call get_variables first to inspect what’s already defined.