Drupal is a registered trademark of Dries Buytaert
Search API Solr 4.4.0 Minor update available for module search_api_solr (4.4.0). Page Manager 8.x-4.0 Major update available for module page_manager (8.x-4.0). Trash 3.1.0-beta2 New beta version released for module trash (3.1.0-beta2). Commerce AutoSKU 3.0.1 Minor update available for module commerce_autosku (3.0.1). Custom Field 4.0.10 Minor update available for module custom_field (4.0.10). Alternative login ID & display names 2.0.12 Minor update available for module alt_login (2.0.12). EntityReference UUID 3.0.1 Minor update available for module entity_reference_uuid (3.0.1). LocalGov Publications Importer 1.1.1 Minor update available for module localgov_publications_importer (1.1.1). Configuration Override Warn 8.x-1.6 Module config_override_warn updated after 10 months of inactivity (8.x-1.6). Table Alternate Rows Module table_altrow crossed 1,000 active installs.

This module provides tools to programmatically manage Drupal's Layout Builder, allowing systems to discover available layout components and blocks. It can create entire layouts or make incremental edits to existing ones, making it suitable for AI assistants or external integrations that need to build and update pages automatically.

Tool - Layout Builder provides Tool API plugins for working with Drupal Layout Builder programmatically. It is designed for systems that need to discover available building blocks and section layouts, create complete layouts, or edit existing layouts incrementally.

Features

This module provides 3 Tool plugins:

  • tool_layout_builder:get_layout_builder_blocks

    Returns available inline block types, their field schemas, allowed values where available, and available section layouts. This is the discovery step used before building or editing a layout.
  • tool_layout_builder:set_entity_layout

    Sets a complete Layout Builder override on an entity. This replaces the entire layout and is intended for first-time page creation or full rebuilds.
  • tool_layout_builder:edit_entity_layout

    Applies incremental operations to an existing layout. Supported actions are add_section, remove_section, add_block, update_block, and remove_block.

The module is intentionally entity-agnostic. It does not assume nodes, specific bundles, or project-specific block types.

Typical use cases:

  • AI assistants that build or update Layout Builder pages
  • external systems that need structured discovery of available block types
  • custom automation that creates unpublished drafts or assembles landing pages
  • incremental layout editing without manually rebuilding the whole page

The module also supports field structures from the custom_field module by passing values as arrays of row objects keyed by the custom field’s column names.

Post-Installation

This module does not add a user-facing configuration page.

After installation, it exposes Tool API plugins that can be used by compatible consumers such as AI/function-calling systems or custom integrations.

To use the module effectively:

  1. Enable Layout Builder on the target entity type/bundle.
  2. Ensure the entity stores Layout Builder overrides.
  3. Call tool_layout_builder:get_layout_builder_blocks first to discover valid block types, field schemas, and section layouts.
  4. Use tool_layout_builder:set_entity_layout to create a full layout, or tool_layout_builder:edit_entity_layout to make incremental changes.

The write tools save Layout Builder override data directly to the entity.

Additional Requirements

  • Drupal core with layout_builder
  • block_content
  • Tool

These are declared as module dependencies.

  • layout_builder_browser if you want discovery to respect a curated allowlist of inline blocks
  • custom_field if your block types use structured multi-column field data
  • AI/function-calling consumers that can invoke Tool API plugins

Similar projects

This module is not a Layout Builder UI enhancement. It does not provide a visual page builder interface for editors.

Instead, it focuses on a programmatic API surface via Tool API plugins. Its main differentiator is that it exposes Layout Builder discovery and write operations in a structured format suitable for automation, AI assistants, and external orchestration layers.

Supporting this Module

Issues, patches, and feedback are welcome.

Documentation

The module includes technical documentation in its README and API documentation in tool_layout_builder.api.php.

Extension points are available so site-specific modules can:

  • alter discovered field metadata
  • normalize or validate field values before inline blocks are saved

Two generic alter hooks are available:

  • hook_tool_layout_builder_field_info_alter()
  • hook_tool_layout_builder_field_values_alter()

Notes and limitations

  • set_entity_layout replaces the entire layout.
  • edit_entity_layout updates blocks by index, which is practical for automation but not intended as a stable external identifier scheme.
  • Field validation depends on discovered schema plus any installed alter hooks.
  • Project-specific field semantics are intentionally out of scope and should be handled by extension modules.

🤖 Assisted Development

This module is maintained with the help of AI assistants for code generation, review, testing, and documentation. All code is carefully reviewed by the maintainers to ensure that quality and security standards are met.

Activity

Total releases
3
First release
Jun 2026
Latest release
1 month ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Release date
1.0.0-alpha2 Pre-release Jun 9, 2026
1.0.0-alpha1 Pre-release Jun 9, 2026
1.0.x-dev Dev Jun 9, 2026