Get ACF Block Fields


Returns the field values of the ACF blocks inside a post's block content, in the order they appear (blocks nested inside other blocks included), each with its block_index, block name and every field's key, name, label, type and stored value. Values are ACF's raw stored form (attachment and post IDs, choice values, repeater rows keyed by sub field key), exactly what mosmcp/acf-update-block-fields accepts back. Read-only. Also returns a content_hash: pass it to the update so it refuses if the post changed in between. Blocks inside a synced pattern belong to that pattern (a wp_block post), not to this post. Get post IDs from mosmcp/post-find or mosmcp/page-find.

Also known as: block content, ACF block data, block settings, hero block text.

Property Value
Ability slug mosmcp/acf-get-block-fields
Wire tool name mosmcp__acf-get-block-fields
Category ACF PRO (mosmcp-acf)
Plan Pro

 

Required access

Requirement Value
Capability edit_post (checked against the specific post)
Minimum default role Contributor
Annotations readOnly: true · destructive: false · idempotent: true · openWorld: false

 

Input schema

Field Type Required Default Description
post_id integer (min 1) Yes — The ID of the post, page or custom post type item, as returned by mosmcp/post-find, mosmcp/page-find or mosmcp/cpt-list.
block_index integer (min 0) — Optional: return only the ACF block at this position (0 = the first ACF block in the post).
block_name string — Optional block name, for example "acf/hero", to return only blocks of that type. Names come from mosmcp/acf-list-blocks.
per_page integer (1–50) 20 Maximum number of blocks to return.
page integer (min 1) 1 Page number, starting at 1.

 

Output schema

Field Type Required Description
post_id integer Yes
post_title string
post_type string
post_status string
edit_url string
content_hash string Yes Fingerprint of the post content as read. Pass it as expected_content_hash when updating.
total integer Yes How many match in all, across every page.
showing integer How many are in this response.
page integer
total_pages integer
has_more boolean Whether another page follows. Ask for it rather than assuming this is everything.
blocks object[] Yes
blocks[].block_index integer Yes Position among the ACF blocks in this post, counting nested blocks; pass it to mosmcp/acf-update-block-fields.
blocks[].name string Yes
blocks[].title string
blocks[].block_id string The ID ACF stores on the block, when it has one.
blocks[].depth integer 0 for a top-level block, 1 inside another block, and so on.
blocks[].uses_post_meta boolean True when the values live in the post's custom fields (shared by every block of this type in the post).
blocks[].fields object[] Yes
notes string[]

 

Example

Sample prompt
Show me the testimonial block's fields on the Home page (post 42).

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 564,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__acf-get-block-fields",
    "arguments": {
      "input": {
        "post_id": 42,
        "block_name": "acf/testimonial"
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 564,
  "result": {
    "isError": false,
    "structuredContent": {
      "post_id": 42,
      "post_title": "Home",
      "post_type": "page",
      "post_status": "publish",
      "edit_url": "https://example.com/wp-admin/post.php?post=42&action=edit",
      "content_hash": "3f9a1c7e5b2d48a6c0e1f7b9d4a2c815",
      "total": 1,
      "showing": 1,
      "page": 1,
      "total_pages": 1,
      "has_more": false,
      "blocks": [
        {
          "block_index": 1,
          "name": "acf/testimonial",
          "title": "Testimonial",
          "block_id": "",
          "depth": 1,
          "uses_post_meta": false,
          "fields": [
            {
              "key": "field_6532a1f0c1a01",
              "name": "quote",
              "label": "Quote",
              "type": "textarea",
              "required": true,
              "has_value": true,
              "value": "Their team rebuilt our booking site in two weeks."
            },
            {
              "key": "field_6532a1f0c1a02",
              "name": "author_name",
              "label": "Author name",
              "type": "text",
              "required": true,
              "has_value": true,
              "value": "Priya Raman"
            },
            {
              "key": "field_6532a1f0c1a03",
              "name": "photo",
              "label": "Photo",
              "type": "image",
              "required": false,
              "has_value": true,
              "value": 274
            },
            {
              "key": "field_6532a1f0c1a04",
              "name": "rating",
              "label": "Rating",
              "type": "select",
              "required": false,
              "choices": {
                "5": "5 stars",
                "4": "4 stars",
                "3": "3 stars"
              },
              "has_value": true,
              "value": "4"
            }
          ]
        }
      ],
      "notes": []
    }
  }
}

 

Edge cases / errors

  • block_index counts every ACF block in the post in document order, nested ones included, and keeps that number when block_name filters the list. An index past the last ACF block → mosmcp_acfpro_block_not_found.
  • A post ID that does not exist, or is a revision or attachment → mosmcp_acfpro_post_not_found; find IDs with mosmcp/post-find or mosmcp/page-find.
  • No ACF blocks, or none of the block_name asked for → an empty list with a note, not an error. ACF blocks inside a synced pattern are not listed; a note points to the pattern's own wp_block post.
  • has_value false means nothing is stored yet and value shows the field's default. When uses_post_meta is true, the values are the post's custom fields, shared by every block of that type in the post.

 


<< Previous Next >>
Create ACF Options Page Get ACF Gallery Field

For more information about the Secure MCP Server for WordPress plugin, explore the following resources:

Product Overview | Pricing | Try for Free | Documentation

If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.