Tools
| Tool | Type | What it does |
|---|---|---|
site-context |
Read | Theme, page templates and design presets |
list-pages |
Read | Editable pages, paginated |
get-page |
Read | A page’s raw block content and its content_hash |
save-page |
Write | Creates or updates a page |
list-blocks |
Read | Blocks available in the inserter |
list-patterns |
Read | Registered block patterns |
list-media |
Read | Images in the media library, paginated |
Every tool runs as the connected user and goes through WordPress’s own REST endpoints, so per-post permissions apply.
site-context
Section titled “site-context”No parameters. Returns the site name, URL and language, the active theme (and whether it’s a block theme), the page templates, the layout widths (contentSize, wideSize) and the presets: colors, font_sizes, font_families and spacing.
list-pages
Section titled “list-pages”| Parameter | Type | Default |
|---|---|---|
search |
string | — |
page |
integer ≥ 1 | 1 |
per_page |
integer, 1–50 | 20 |
Returns pages (each with id, title, status and link), total and total_pages. It includes published, draft, pending, private and scheduled pages. A page number past the last one returns an empty list.
get-page
Section titled “get-page”| Parameter | Type |
|---|---|
id |
integer, required |
Returns id, title, content (raw serialized blocks), content_hash, excerpt, status, slug, link, template, modified_gmt and edit_url.
content_hash is the version of the page: it changes whenever the page is saved. Pass it to save-page as expected_content_hash.
save-page
Section titled “save-page”| Parameter | Type | Notes |
|---|---|---|
id |
integer | Omit it to create a page |
expected_content_hash |
string | Required to update |
title |
string | Required to create |
content |
string | Serialized blocks; replaces the whole page body |
excerpt |
string | |
status |
draft, pending, publish or private |
New pages default to draft |
slug |
string | |
template |
string | A page template from site-context |
featured_media |
integer ≥ 0 | Attachment ID |
Returns id, the new content_hash, status, link and edit_url. It doesn’t repeat the content.
Errors: content_conflict (the page changed, or no hash was sent), missing_title, non_block_content (loose HTML), unknown_block (an unregistered block), plus WordPress’s own permission errors.
list-blocks
Section titled “list-blocks”| Parameter | Type |
|---|---|
name |
string, such as core/columns |
Without name, returns the blocks shown in the inserter (name, title, description). With name, returns that block with its attributes and supports.
list-patterns
Section titled “list-patterns”| Parameter | Type |
|---|---|
name |
string |
Without name, returns the registered patterns (name, title). With name, also returns the pattern’s serialized content.
list-media
Section titled “list-media”| Parameter | Type | Default |
|---|---|---|
search |
string | — |
page |
integer ≥ 1 | 1 |
per_page |
integer, 1–50 | 20 |
Returns media (images only, each with id, title, url, alt and mime_type), total and total_pages.