---
id: gk-block-mcp-block-format
title: "Filter - gk/block-mcp/block/format"
sidebar_label: "gk/block-mcp/block/format"
tags:
  - "2.0.0"
---

# Filter: gk/block-mcp/block/format

Shape what the AI sees for any block before it's returned.

This is the single most powerful extension point for tailoring how the assistant perceives your content. Strip noisy computed fields so the agent isn't drowned in markup, or enrich a block with the context it actually needs to edit well — an image's dimensions, a custom block's friendly label, a product block's price. It runs for every block on read, so a tiny enricher can make a whole block type far easier for the AI to reason about and safely modify. The same filter also fires on the write path (in Block_Writer) so a single enricher keeps reads and write-responses consistent; the write path passes the block name but not the read-time context array.

## Parameters

| Name | Type | Description |
|------|------|-------------|
| $data | `array` | Formatted block data about to be returned. |
| $block_name | `string` | Fully-qualified block type name. |
| $context | `array` | Additional context for enrichers that need it (read path only). |
| ↳ $parsed_block | `array` | Raw parse_blocks() entry for this block. |
| ↳ $render | `bool` | Whether render-mode is active. |
| ↳ $reader | `object` | This Block_Reader instance (enables recursive formatting of nested trees, e.g. synced pattern contents). |

## Example

// Drop heavy rendered HTML from a custom block so the AI sees only its attributes.

```php
add_filter( 'gk/block-mcp/block/format', function ( $data, $block_name ) {
    if ( 'acme/chart' === $block_name ) {
        unset( $data['innerHTML'] );
    }
    return $data;
}, 10, 2 );
```

### Since

- [2.0.0](../../since/2-0-0/)

### Source

Defined in `wordpress-plugin/gk-block-api/includes/class-block-reader.php` at line 549

