bricks_get_global_variables
Overview
Retrieves all global CSS custom properties (variables) defined in Bricks Builder. Returns variable names, their CSS values, and the categories they belong to. This is the first tool to call when auditing or extending an existing design system, as it reveals the spacing scale, color tokens, and sizing tokens already in place.
Variables are stored as var(--name) references that can be used throughout element settings, global classes, and theme styles for consistent, maintainable design tokens.
Key Features
When to Use
Checking if a spacing scale (xs through 5xl) already exists
Verifying color or typography variables before building pages
Listing all CSS custom properties to reference in global classes
Phase 1 of any website build — understanding the site context
When NOT to Use
When you need to list only categories without variables — use bricks_get_variable_categories
Parameters
categorystringoptionalCode Examples
Get All Variables
Retrieve every global CSS variable and its category to audit the design system.
bricks_get_global_variables({}){"variables": [{"id": "abc123", "name": "spacing-xs", "value": "4px", "category": "cat1"}, {"id": "def456", "name": "spacing-sm", "value": "8px", "category": "cat1"}], "categories": [{"id": "cat1", "name": "Spacing"}]}Filter by Spacing Category
Retrieve only the spacing variables to verify the full scale exists.
bricks_get_global_variables({ category: "Spacing" }){"variables": [{"id": "abc123", "name": "spacing-xs", "value": "4px", "category": "cat1"}, {"id": "abc124", "name": "spacing-sm", "value": "8px", "category": "cat1"}, {"id": "abc125", "name": "spacing-md", "value": "16px", "category": "cat1"}], "categories": [{"id": "cat1", "name": "Spacing"}]}Common Mistakes
// Jumping straight to bricks_create_page without checking variables
bricks_create_page({ title: "Home" })// Phase 1: Check existing variables first
bricks_get_global_variables({ category: "Spacing" })
// If spacing scale is incomplete, create it in Phase 2
bricks_create_variables_batch({ variables: [
{ name: "spacing-xs", value: "4px", category: "Spacing" },
{ name: "spacing-sm", value: "8px", category: "Spacing" },
// ... full scale xs through 5xl
] })// Creating variables without checking
bricks_create_global_variable({ name: "spacing-sm", value: "8px" })// Check first, then create only what is missing
const vars = bricks_get_global_variables({ category: "Spacing" })
// Review results, then create only missing variablesTips & Warnings
Always run this tool first in Phase 1 of any website build. The response tells you whether the mandatory spacing scale, color tokens, and other design system foundations are already in place.
Spacing scale check: Look for variables named spacing-xs through spacing-5xl. If any are missing, create them in Phase 2 using bricks_create_variables_batch. The recommended scale is: xs=4px, sm=8px, md=16px, lg=24px, xl=32px, 2xl=48px, 3xl=64px, 4xl=96px, 5xl=128px.
Variable references: Use variables in element settings as var(--spacing-lg) instead of hardcoded values like "24". This ensures global consistency.