bricks_get_page_content

Phase 1BeginnerRead OnlyComplexity: 3/10
Read the full Bricks element tree of a page

Overview

Retrieve the Bricks element tree for a page. Returns all elements with their settings, parent-child hierarchy, and global class assignments. This is the primary tool for inspecting what is already on a page before making modifications.

Supports two modes: « summary » for a lightweight overview showing element types and text content, and « full » for complete settings including all styles and responsive breakpoints. Can read from the main content area, header overrides, or footer overrides.

Key Features

Two Detail Modes
Summary mode returns element types and text content only. Full mode includes all CSS settings, responsive breakpoints, and class assignments.
Content Area Selection
Read from the main content area, or from header/footer overrides on the page.
Element Hierarchy
Returns the complete parent-child tree with element IDs, making it easy to target specific elements for updates.

When to Use

You need to inspect the current content of a page before modifying it
You want to find specific element IDs for use with bricks_update_element or bricks_delete_element
You need to understand the element hierarchy before inserting new elements
You want to check which global classes are assigned to existing elements
You need to verify that a section was added correctly after calling bricks_add_section
Prerequisites
The page must exist. Use bricks_list_pages to find page IDs. The page must have Bricks editor enabled (bricks_create_page enables this automatically).

When NOT to Use

You only need a high-level section overview (use bricks_get_page_summary instead -- much lighter)
You want to find an element by its ref/label name (use bricks_get_element_by_ref instead)
You need to search for specific text content across all pages (use bricks_search_content instead)

Parameters

3 Total Parameters1 Required2 Optional
page_idnumberREQUIRED
WordPress post/page ID to read content from.
modestringoptional
Level of detail. Summary: element types, text content, and class names. Full: complete settings including all styles.
Default: summary Values: summary, full
content_areastringoptional
Which content area to read: main content, header override, or footer override.
Default: content Values: content, header, footer

Code Examples

Get page structure summary

Quickly see what sections and elements exist on a page without fetching full style data.

JSON
bricks_get_page_content({
  page_id: 33,
  mode: "summary"
})
Response
{
  "elements": [
    { "id": "abc123", "type": "section", "parent": 0, "children": ["def456"] },
    { "id": "def456", "type": "container", "parent": "abc123", "children": ["ghi789"] },
    { "id": "ghi789", "type": "heading", "parent": "def456", "text": "Welcome Home", "tag": "h1" }
  ],
  "element_count": 3
}

Get full element data for debugging

Retrieve complete settings including CSS properties and responsive breakpoints.

JSON
bricks_get_page_content({
  page_id: 33,
  mode: "full",
  content_area: "content"
})
Response
{
  "elements": [
    {
      "id": "ghi789",
      "type": "heading",
      "parent": "def456",
      "settings": {
        "tag": "h1",
        "text": "Welcome Home",
        "_typography": { "font-size": "56px", "font-weight": "700" },
        "_typography:mobile_portrait": { "font-size": "32px" }
      },
      "_cssGlobalClasses": ["abc123"]
    }
  ]
}

Common Mistakes

Using full mode when summary is sufficient
Full mode returns large payloads with all CSS data. Use summary mode for quick structure checks and save full mode for debugging specific styling issues.
Wrong
bricks_get_page_content({
  page_id: 33,
  mode: "full"
})
// Large payload when you just need IDs
Correct
bricks_get_page_content({
  page_id: 33,
  mode: "summary"
})
// Lightweight, returns types and text

Tips & Warnings

Tips & Warnings

Use summary mode first: Summary mode is much faster and lighter. Only switch to full mode when you need to inspect specific CSS settings or debug styling issues.

Element IDs are 6-char hex strings: These IDs are needed for bricks_update_element, bricks_delete_element, bricks_insert_element, and other element manipulation tools.

Prefer bricks_get_page_summary: For just understanding the section structure of a page, bricks_get_page_summary is even lighter and organized by sections.

Return Values

FieldTypeDescription
elementsarrayArray of element objects with id, type, parent, settings, and children. Structure depends on mode.
element_countnumberTotal number of elements on the page in the specified content area.

Related Tools

Technical Details

Tool ID
bricks_get_page_content
API Endpoint
/bricks-mcp/v1/pages/{page_id}/content
HTTP Method
GET
Namespace
pages-elements
Source File
pages/create.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release with summary and full modes, content area selection.
20250101