AI & Abilities API

On WordPress 6.9 and newer, Gallery Z registers four abilities with the WordPress Abilities API. AI agents and MCP clients can use them to find untagged photos, tag them and build a gallery page – with the same permissions as a person doing it by hand.

The abilities

All four are in the category gallery-z and shown in REST.

AbilityInputPermission
gallery-z/list-categories
read-only
–upload_files
gallery-z/find-images
read-only
category, search, untagged, limit (up to 500, default 50)upload_files
gallery-z/tag-imagesattachment_ids, categories (names or slugs, created if missing), mode: add, remove or replaceupload_files, assign_terms, and edit_post for each image
gallery-z/create-gallerytitle, attachment_ids or category, layout, filter, columns, status: draft or publishedit_pages (and publish_pages to publish)

list-categories

Lists the Gallery Categories with their ID, name, slug and number of items.

find-images

Finds Media Library images by Gallery Category (name or slug), by search text (title, caption and description), or only those without any category (untagged: true).

tag-images

Adds, removes or replaces Gallery Categories on images. add (the default) keeps existing categories, remove takes the given ones away, replace sets exactly these. Missing categories are created in add and replace mode, if the user may create categories. The whole call is refused if the user can’t edit one of the images; IDs that aren’t images are skipped and reported.

Creates a page with a gallery of the given images – or of every image in a category – optionally with filter buttons above it. layout is one of the five layouts (masonry by default), columns 1–8, and the page is a draft unless status is publish. It returns the page ID, edit link and view link.

Over REST

Abilities are listed at /wp-json/wp-abilities/v1/abilities and run at /wp-json/wp-abilities/v1/abilities/<name>/run. Core picks the HTTP method from each ability’s annotations:

AbilityAnnotationsMethod
list-categories, find-imagesread-onlyGET, input as ?input[…] query parameters
tag-imagesdestructive, idempotentDELETE, input as query parameters
create-gallery–POST, with a JSON body {"input": {…}}

For example, with an application password:

curl -u admin:APP_PASSWORD \
  "https://example.com/wp-json/wp-abilities/v1/abilities/gallery-z/find-images/run?input[untagged]=1&input[limit]=20"

curl -u admin:APP_PASSWORD -X POST \
  -H "Content-Type: application/json" \
  -d '{"input":{"title":"Architecture","category":"architecture","layout":"rows","filter":false}}' \
  https://example.com/wp-json/wp-abilities/v1/abilities/gallery-z/create-gallery/run

With an AI agent

Any client that speaks the Abilities API – for example through an MCP adapter for WordPress – sees the four abilities with their descriptions and input schemas. A typical request:

  1. “Find my untagged photos” → find-images with untagged.
  2. The agent looks at the images and proposes categories → tag-images.
  3. “Make a portfolio page of the architecture photos with filter buttons” → create-gallery, as a draft for you to review.

The abilities check the same capabilities as the admin screens. An agent working as an Author can tag the Author’s own uploads with existing categories, but can’t create categories or pages. Nothing is published unless the agent asks for it and the user may publish pages.

On WordPress versions before 6.9 the abilities are simply not registered; everything else works as usual.