bricks_get_global_classes

Phase 1BeginnerRead OnlyComplexity: 2/10
List all global CSS classes with search, filter, and pagination

Overview

Retrieves all global CSS classes defined in the Bricks design system. Returns class names, their CSS settings, selectors (hover, focus, pseudo-elements), and category assignments. Supports search filtering, category filtering, and pagination for large class libraries.

This is the first tool to call when examining an existing design system. Use it to discover which reusable classes are available before building any page sections, so you can assign existing classes to elements instead of writing inline styles.

Key Features

Search & Filter
Filter classes by partial name match or by category name/ID, making it easy to find specific classes in large design systems.
Pagination Support
Supports limit and offset parameters for paginating through large class libraries (up to 200 classes per request).
Optional Verbose Output
Set include_settings to true to see full CSS settings for each class, or false for a lightweight name-only listing.
Category Grouping
Returns category assignments alongside classes, so you can understand the organizational structure of the design system.

When to Use

Before building any page section — check what classes already exist
When you receive a "Global Class Warning" — see which classes are available
To audit the design system and identify gaps in class coverage
When assigning globalClasses to elements — verify the class name exists
To check class settings before deciding whether to update or create new ones
Prerequisites
No prerequisites. This is a read-only tool that works on any Bricks site. It is typically the first design system tool called during Phase 1 (Understand the Site Context).

When NOT to Use

When you already know the exact class names from a previous call in the same session
When you need to create new classes — use bricks_create_global_class or bricks_create_classes_batch instead

Parameters

5 Total Parameters5 Optional
searchstringoptional
Search classes by name (partial match). For example, "btn" returns btn-primary, btn-secondary, btn-ghost, etc.
categorystringoptional
Filter by category name or ID. Returns only classes assigned to this category.
limitnumberoptional
Maximum number of classes to return. Range: 1-200.
Default: 50
offsetnumberoptional
Offset for pagination. Use with limit to page through large class lists.
include_settingsbooleanoptional
Include full CSS settings (verbose). Set to true when you need to see what styles a class applies. Set to false for a lightweight listing.
Default: false

Code Examples

Search for button classes with full settings

Find all classes containing "btn" and inspect their CSS settings and hover selectors.

JSON
// List all button-related classes with full settings
bricks_get_global_classes({
  search: "btn",
  include_settings: true
})
Response
{
  "classes": [
    {
      "id": "abc123",
      "name": "btn-primary",
      "settings": {
        "_background": { "color": { "raw": "var(--bricks-color-primary)" } },
        "_padding": { "top": "14", "right": "28", "bottom": "14", "left": "28" },
        "_border": { "radius": { "top": "8", "right": "8", "bottom": "8", "left": "8" } },
        "_typography": { "color": { "hex": "#ffffff" }, "font-weight": "600" }
      },
      "selectors": [
        {
          "selector": "&:hover",
          "settings": { "_background": { "color": { "hex": "#3451c7" } } }
        }
      ],
      "category": "Buttons"
    },
    {
      "id": "def456",
      "name": "btn-secondary",
      "settings": { ... },
      "category": "Buttons"
    }
  ],
  "categories": [
    { "id": "cat01", "name": "Buttons" }
  ],
  "total": 5
}

List classes by category (lightweight)

Get all classes in the "Cards" category without verbose settings for quick reference.

JSON
// List classes in the "Cards" category, lightweight
bricks_get_global_classes({
  category: "Cards",
  include_settings: false,
  limit: 20
})
Response
{
  "classes": [
    { "id": "ghi789", "name": "card", "category": "Cards" },
    { "id": "jkl012", "name": "card-hover", "category": "Cards" },
    { "id": "mno345", "name": "card-horizontal", "category": "Cards" }
  ],
  "categories": [
    { "id": "cat02", "name": "Cards" }
  ],
  "total": 3
}

Common Mistakes

Not calling this tool before building sections, then applying inline styles instead of existing global classes.
Always call bricks_get_global_classes in Phase 1 to discover available classes. Assign them via globalClasses on every content element.
Wrong
// Building a section without checking existing classes
{ "type": "heading", "settings": {
    "text": "Our Services", "tag": "h2",
    "_typography": { "font-size": "36px", "font-weight": "600" }
}}
Correct
// First: bricks_get_global_classes({ search: "heading" })
// Found: heading-section class exists!
{ "type": "heading", "settings": {
    "text": "Our Services", "tag": "h2"
}, "globalClasses": ["heading-section"] }
Setting include_settings to true when you only need class names, causing unnecessarily large responses.
Use include_settings: false (default) for quick lookups. Only set to true when you need to inspect or compare CSS properties.
Wrong
// Fetching all 50 classes with full settings just to check names
bricks_get_global_classes({ include_settings: true })
Correct
// Lightweight listing — only fetch settings when needed
bricks_get_global_classes({ include_settings: false })
// Then for specific class inspection:
bricks_get_global_classes({ search: "btn-primary", include_settings: true })

Tips & Warnings

Tips & Warnings

Tip: This tool is essential in Phase 1 of the workflow. Always call it before creating any sections to avoid duplicating existing classes with inline styles.

Warning: The server warns when ANY content element lacks a global class. If you see a « Global Class Warning », stop adding sections and use this tool to discover what classes already exist.

Best practice: A well-designed Bricks site typically has 20-40 global classes covering layout, typography, buttons, cards, and utilities. If you find fewer than 10 classes, the design system is likely incomplete.

Return Values

FieldTypeDescription
classesarrayArray of global class objects, each with id, name, settings (if requested), selectors, and category.
categoriesarrayArray of class category objects with id and name.
totalnumberTotal number of classes matching the query (for pagination calculations).

Related Tools

Technical Details

Tool ID
bricks_get_global_classes
API Endpoint
/bricks-mcp/v1/design-system/classes
HTTP Method
GET
Namespace
design-system
Source File
design-system/classes.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release with search, category filter, pagination, and optional verbose settings.
20250101