bricks_get_history

UtilityBeginnerRead OnlyComplexity: 2/10
View page revision history

Overview

Retrieves the complete revision history of a Bricks page. Returns a chronological list of all saved revisions, each with a unique revision ID, timestamp, author name, change summary, and element count. WordPress automatically creates revisions when page content is saved, and the MCP tools create revisions before destructive operations.

Use this tool to review the change history before restoring a previous version with bricks_restore_revision, or to audit who made changes and when during a collaborative build process.

Key Features

Full Revision Timeline
Returns every revision in chronological order, each with a unique ID, creation date, author, change summary describing what was modified, and the element count at that point in time.
Change Summaries
Each revision includes a brief summary of what changed: elements added, modified, or deleted. This helps identify the right revision to restore without needing to inspect each one.
Snapshot Identification
Named snapshots created by bricks_snapshot appear in the history with their descriptive labels, making them easy to find among automatic revisions.

When to Use

Before restoring a previous version to find the correct revision ID
To audit the change history of a page during a build session
To verify that a snapshot was created successfully
When debugging unexpected content changes to trace when they occurred
To review the revision count and element counts over time
Prerequisites
The page must exist and have at least one saved revision.
WordPress revisions must not be disabled (wp-config.php WP_POST_REVISIONS should not be 0).

When NOT to Use

To read the current page content — use bricks_get_page_content instead
To create a named save point — use bricks_snapshot instead

Parameters

1 Total Parameters1 Required
page_idnumberREQUIRED
The WordPress page (post) ID to get the revision history for.

Code Examples


Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12

Review history and restore a revision

Get the page history, identify the correct revision by its summary and timestamp, then restore it.

JSON
// Step 1: Get revision history
const history = bricks_get_page_history({ page_id: 42 });
// Returns: { revisions: [
//   { revision_id: 156, date: "2025-01-15T14:30:00", author: "admin", summary: "Added hero section", element_count: 12 },
//   { revision_id: 148, date: "2025-01-15T13:00:00", author: "admin", summary: "Snapshot: Before redesign", element_count: 8 },
//   ...
// ] }

// Step 2: Restore the snapshot revision
bricks_restore_revision({ page_id: 42, revision_id: 148 })

Common Mistakes


Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
The revision history shows past saved states, not the current content. To read the current state, use bricks_get_page_content.

Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
If WP_POST_REVISIONS is set to 0 or false in wp-config.php, no revisions are saved and this tool will return an empty list. Check the WordPress configuration if history is unexpectedly empty.

Tips & Warnings

Tips & Warnings

Best practice: Create named snapshots with bricks_snapshot before making major changes. Snapshots are easier to identify in the history than anonymous auto-revisions.

Revision limits: WordPress may limit the number of stored revisions via the WP_POST_REVISIONS constant. Older revisions may be automatically pruned.

Return Values

FieldTypeDescription
revisionsarrayArray of revision objects in chronological order (newest first).
revisions[].revision_idnumberUnique WordPress revision post ID. Pass this to bricks_restore_revision to restore.
revisions[].datestringISO 8601 timestamp of when the revision was saved.
revisions[].authorstringName of the user who created the revision.
revisions[].summarystringBrief description of changes in this revision.
revisions[].element_countnumberNumber of Bricks elements in this revision.

Related Tools

Technical Details

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

Changelog

v1.0
Initial release with full revision history retrieval, change summaries, and snapshot identification.
20250101