bricks_get_components
Overview
Lists all Bricks Components (reusable element groups with configurable properties). Returns each component’s structure, properties with defaults and connections, and category. Use this tool to discover existing components before creating new ones or before building pages that need reusable patterns.
Components are the foundation of maintainable Bricks sites. Instead of duplicating element structures across pages, a component defines the structure once and allows per-instance customization through properties. This tool lets you inspect what components already exist.
Key Features
When to Use
During Phase 1 (Site Context) to understand the existing component library
When debugging component instances on pages to verify the component definition
Before building a section with repeated cards/patterns to find reusable components
When auditing a site to understand its component architecture
Components must have been previously created with bricks_create_component
When NOT to Use
When you need to check where a specific component is used — use bricks_get_component_usage
Parameters
Warning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
include_elementsbooleanoptionalfalseCode Examples
List all components (summary)
Get a quick overview of all components without the verbose element trees.
bricks_get_components({
include_elements: false
}){
"data": [
{
"id": "abc123",
"label": "Category Card",
"category": "cards",
"properties": [
{ "label": "Image", "connections": { "card-image": ["image"] } },
{ "label": "Title", "connections": { "card-title": ["text"] } }
]
}
]
}List with full element trees
Inspect the internal structure of all components to understand their element hierarchy.
bricks_get_components({
include_elements: true
}){
"data": [
{
"id": "abc123",
"label": "Category Card",
"category": "cards",
"properties": [...],
"elements": [
{
"id": "root1",
"name": "div",
"parent": 0,
"children": ["child1", "child2"],
"settings": { "_background": {...}, "_border": {...} }
}
]
}
]
}Common Mistakes
// Building 6 identical cards with 10 elements each = 60 elements
{ "type": "div", "settings": { "_background": ..., "_border": ... }, "children": [...] }
// x6 duplicated// Check existing components first
bricks_get_components({ include_elements: false })
// Then use componentId + properties for each instanceTips & Warnings
Performance tip: Use include_elements: false (the default) when you only need to know which components exist. The element tree can be very large for complex components.
Best practice: Run this tool at the start of every project (Phase 1) to understand what reusable patterns are already available before creating new ones.