The Abilities Explorer experiment adds an admin screen for finding, inspecting and testing every ability registered through the WordPress Abilities API. It lives at Tools → Abilities Explorer (tools.php?page=ai-abilities-explorer) and requires the manage_options capability.
The screen is a React application built on @wordpress/dataviews, backed by three ai/v1 REST routes.
- Type: Experiment (may change or be removed in any release; try it on a staging site first)
- Runs without a user action: No, only when you ask
- When it runs: When you click Invoke Ability
- Sent to your AI provider: Depends on the ability being invoked
- Requests and data: Depends on the ability being invoked
- Statistics for Total, Core, Plugins and Theme, counted by each ability's origin. They are computed in the browser from the whole list, so search and filters do not change them.
- A table of every registered ability, including abilities that are not opted into REST, with Name, Slug and Provider columns. Search covers name, slug and description. The table sorts by name, slug and provider, shows 20 rows per page, and has a Refresh button.
- Filters:
- Provider (single choice). Core, Plugin and Theme match the ability's origin; any other option is a custom
meta.providerlabel and matches that exact label. An ability with a custom label from a plugin therefore appears under both "Plugin" and its own label. - Category. Each category label is listed once and rendered as text.
- Provider (single choice). Core, Plugin and Theme match the ability's origin; any other option is a custom
- Row actions under each ability's name, shown on hover or keyboard focus as in
WP_List_Table(always shown on small screens): View and Test.
- The detail view shows the description, provider, input schema, output schema and raw data. Each JSON block has a Copy button.
- The test runner prefills example input generated from the input schema, validates it in the browser (Validate Input), invokes the ability (Invoke Ability) and clears the result and validation panels (Clear Result). The JSON input is labelled "Ability test input (JSON)".
- Validation checks the input's top-level type, required fields, and each top-level property's type,
enum,minimumandmaximum. Nested objects are not validated.
Views are addressed by the same query arguments as before, so existing links keep working:
- List:
tools.php?page=ai-abilities-explorer - Detail:
&action=view&ability=<name> - Test runner:
&action=test&ability=<name>
Moving between views updates the URL, so browser Back and Forward work, and each view has a single h1, "Abilities Explorer".
The list remembers its layout, visible columns, sort and page size in the browser's local storage (ai.abilitiesExplorer.view). Search, filters and the current page are not saved.
All three routes are registered only while the experiment is enabled. They share one permission check: the user must have manage_options and must be authenticated by the logged-in cookie with the REST nonce. Requests authenticated any other way, including application passwords, are refused with a 403. None of the routes is registered as an ability.
Ability names are passed as a parameter, never in the path, because names contain /.
| Method | Route | Parameters | Returns |
|---|---|---|---|
GET |
ai/v1/abilities |
none | items (summary fields and meta for every ability) |
GET |
ai/v1/abilities/item |
name |
One ability with input_schema, output_schema, raw_data and example_input |
POST |
ai/v1/abilities/invoke |
name, input (a JSON string; empty means no input) |
success with data, or success: false with error.code, error.message and error.data |
The invoke route answers 404 for an unknown ability and 400 for malformed JSON or input that fails the Explorer's schema check. The ability's own outcome, including its permission check and core's input validation, is a 200 with success: false. Invoking writes no AI request log row.
A field of a list item that cannot be encoded as JSON is sent as null and named in that item's unencodable_fields, so one ability cannot stop the list from loading.
The screen used to be a PHP WP_List_Table with admin-ajax handlers. Compared with that version:
- Invoke runs under REST. Abilities are invoked from a REST request, so
is_admin()isfalseduring the call. The route loadswp-admin/includes/admin.phpfirst, so admin functions such asget_plugins()remain available. - Errors show a code, message and data. A failed invoke shows the error's
code,messageanddatain the error panel. The oldtracefield, which was always empty, is gone. - Back to List keeps the view's layout. Returning from the detail view or the test runner keeps the list's layout, visible columns, sort and page size. Search and filters reset.
- The list, detail and runner come from REST. The screen builds all three from REST requests, where
is_admin()isfalse. An ability that a plugin registers only whenis_admin()istrueno longer appears. - The routes accept only an administrator's browser session. The
ai/v1Explorer routes requiremanage_options, cookie authentication from a logged-in session, and a validwp_restnonce (theX-WP-Nonceheader, or the_wpnonceparameter). Application passwords and other non-cookie authentication are refused, so scripts and custom clients cannot call them.
- The screen and all three routes require
manage_options. - Invoking an ability still runs that ability's own permission check and input validation through
WP_Ability::execute().
- PHP:
tests/Integration/Includes/Experiments/Abilities_Explorer/(Admin_PageTest,Ability_HandlerTest,Abilities_ExplorerTest,REST/Abilities_ControllerTest). - End to end:
tests/e2e/specs/experiments/abilities-explorer-*.spec.js(list, runner, navigation), with helpers intests/e2e/utils/abilities-explorer.js, fixture abilities fromtests/e2e-testing/e2e-testing.phpand the field extension fixture intests/e2e-plugins/abilities-explorer-field.
- Go to Settings → AI and enable Abilities Explorer.
- Open Tools → Abilities Explorer. Check the statistics, search, the Provider and Category filters, and sorting.
- Use View on a row. Check the schemas and the Copy buttons.
- Use Test on a row. Edit the input, then use Validate Input, Invoke Ability and Clear Result.
Other plugins can add read-only columns to the Abilities Explorer list through the ai.abilitiesExplorer.fields JavaScript filter. The list is built with @wordpress/dataviews, and each column is a DataViews field.
Enqueue the script on the Explorer screen (its hook suffix is tools_page_ai-abilities-explorer) and make it depend on wp-hooks. Do not depend on the Explorer's own script handle: the Explorer bundle loads deferred, and its handle is not a public API. The filter is read when the list renders and again whenever a callback is added to or removed from it, so the column shows whether your script runs before or after the Explorer.
add_action(
'admin_enqueue_scripts',
static function ( string $hook_suffix ): void {
if ( 'tools_page_ai-abilities-explorer' !== $hook_suffix ) {
return;
}
wp_enqueue_script(
'my-plugin-explorer-field',
plugins_url( 'explorer-field.js', __FILE__ ),
array( 'wp-hooks' ),
'1.0.0',
true
);
}
);The filter receives the current fields, built-ins first, and returns the full list. Append your field and return the array.
wp.hooks.addFilter(
'ai.abilitiesExplorer.fields',
'my-plugin/slug-length',
( fields ) => [
...fields,
{
id: 'my-plugin/slug-length',
label: 'Slug length',
type: 'integer',
enableSorting: true,
getValue: ( { item } ) => item.slug.length,
},
]
);Each row (item) is one ability as returned by GET ai/v1/abilities, so a field can read properties such as slug, name, provider, category and meta. Several of them, including name, provider, category and meta, can be null, for example when the server could not encode that part of an ability, so read them with a fallback. Prefix the field ID with your plugin's namespace so it cannot clash with another extension.
An extension field keeps only these DataViews properties: id, type, label, header, description, render, getValue, getValueFormatted, sort, format, elements, filterBy, enableSorting, enableHiding and enableGlobalSearch. Anything else is dropped, including edit controls (Edit, setValue, isValid) and anything like actions, and every extension field is marked readOnly. Extension fields never add row actions.
- Built-in fields win. A field whose ID matches a built-in field (
name,slug,provider,category,description) is ignored, and returning a list without the built-ins does not remove them. If two extensions use the same ID, the first one wins. - Failures fall back. If a filter callback throws or returns something other than an array, the list shows only the built-in fields. A
getValue,getValueFormattedorsortcallback that throws yields an empty value (or no reordering), and arendercallback that throws renders an empty cell, so one extension cannot break the table. - Saved views keep your column. A new field is added to the visible columns the first time the Explorer sees it, including on a first visit with nothing saved. After that it is the user's choice to hide it. If your plugin is deactivated, its column's place in the user's saved view is kept, and it shows again when the plugin is reactivated.