| 1 |
<?php |
| 2 |
declare(strict_types=1); |
| 3 |
|
| 4 |
namespace Imagify\Abilities; |
| 5 |
|
| 6 |
/** |
| 7 |
* Contract that every Imagify MCP ability must implement. |
| 8 |
* |
| 9 |
* Each ability is responsible for registering itself with the WP Abilities API, |
| 10 |
* verifying that the current user has sufficient permissions, and executing the |
| 11 |
* ability's business logic when invoked by the MCP layer. |
| 12 |
* |
| 13 |
* @since 2.3.0 |
| 14 |
*/ |
| 15 |
interface AbilitiesInterface { |
| 16 |
|
| 17 |
/** |
| 18 |
* Register the ability with the WP Abilities API. |
| 19 |
* |
| 20 |
* Implementations must call `wp_register_ability()` (guarded by |
| 21 |
* `function_exists()`) and wire `execute_callback` and `permission_callback` |
| 22 |
* to the concrete class's own methods. |
| 23 |
* |
| 24 |
* @return void |
| 25 |
*/ |
| 26 |
public function register(): void; |
| 27 |
|
| 28 |
/** |
| 29 |
* Check if the current user has permission to execute this ability. |
| 30 |
* |
| 31 |
* @return bool True if the current user may execute the ability. |
| 32 |
*/ |
| 33 |
public function check_permissions(): bool; |
| 34 |
|
| 35 |
/** |
| 36 |
* Execute the ability and return the tool result. |
| 37 |
* |
| 38 |
* The return type is intentionally untyped because abilities may return a |
| 39 |
* tool-result array, a resource string, or any other MCP-compatible value. |
| 40 |
* |
| 41 |
* @return mixed |
| 42 |
*/ |
| 43 |
public function execute(); |
| 44 |
} |
| 45 |
|