On WordPress 6.9 and later, Refinery Product Recommendations automatically registers abilities with the WordPress Abilities API. These abilities allow AI agents, automation tools, and the WordPress MCP Adapter to fetch recommendations, manage generation, and view analytics programmatically.
Prerequisites
- WordPress 6.9 or later — The Abilities API was introduced in WordPress 6.9. On earlier versions, abilities are not registered and the plugin functions normally.
- WooCommerce — Must be installed and active.
- manage_woocommerce capability — All abilities require store management permissions.
Registered abilities
Refinery Product Recommendations registers the following abilities in the refinery-recommendations category. All abilities are exposed through the REST API with show_in_rest enabled.
| Ability | Description | Type |
|---|---|---|
refinery-recs/get-recommendations |
Retrieve recommended products for a given product ID. Accepts an optional placement key. Returns product name, price, and stock status. | Read |
refinery-recs/get-strategies |
List all configured recommendation strategies with key, name, description, and enabled status. | Read |
refinery-recs/trigger-generation |
Start the relevancy score calculation for all products via Action Scheduler. | Write |
refinery-recs/get-analytics |
Retrieve click, conversion, conversion rate, and revenue analytics. Accepts a days parameter (0 for all time). | Read |
How it works
Abilities are registered on the wp_abilities_api_init action hook when WordPress initializes the Abilities Registry. Each ability defines:
- Input schema — A JSON Schema describing accepted parameters
- Output schema — A JSON Schema describing the response structure
- Execute callback — The function that performs the operation
- Permission callback — Checks that the caller has
manage_woocommercecapability
Abilities can be invoked through the WordPress REST API, the WordPress MCP Adapter, or programmatically via WP_Abilities_Registry::get_instance().
Using with the MCP Adapter
Install the WordPress MCP Adapter plugin to expose registered abilities to AI agents that support the Model Context Protocol (MCP). Once installed, any AI agent connected via MCP can discover and invoke recommendation abilities — fetching product suggestions, triggering generation, and reviewing analytics — all with proper permission checks.
Backward compatibility
The Abilities API registration is guarded behind a function_exists('wp_register_ability') check. On WordPress versions earlier than 6.9, the abilities are not registered and the plugin continues to function normally. No code changes or configuration are needed.