GravityKit\GravityMigrate\Abilities\Ability
The shape every GravityMigrate ability declares itself in.
A subclass states its own name, wording, category, schemas and annotations, and implements
\self::execute() and \self::permission(); \self::config() assembles those
into the array Foundation registers. Extending this class is what makes an ability
registrable: \Bootstrap skips any file under src/Abilities/{Category}/ that does not.
Since: %ver%
Source: src/Abilities/Ability.php:20
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Abilities
Methods
| Method | Description |
|---|---|
name() | The ability name, gk-gravitymigrate/{object}-{verb}. |
label() | The short human label, shown in Foundation's settings list. |
description() | What this ability does, written for the agent that has to choose between it and the one |
category() | The category slug, which must be one {@see Bootstrap::categories()} declares. |
input_schema() | JSON Schema for the input. |
output_schema() | JSON Schema for the output. |
annotations() | WordPress's own annotation vocabulary for this ability. |
execute() | Does the work. |
permission() | Whether this caller may run it. |
next_steps() | Which abilities usually come next, and when. |
config() | The config Foundation registers, assembled from everything above. |
mcp_tool_name() | The MCP tool name this ability surfaces as. |
Method Reference
name()
abstract public static function name(): string
The ability name, gk-gravitymigrate/{object}-{verb}.
Permanent once published: the MCP tool name is derived from it, so renaming one breaks every client already bound to it.
Returns
string
Since: %ver%
Source: src/Abilities/Ability.php:55
label()
abstract public static function label(): string
The short human label, shown in Foundation's settings list.
Returns
string
Since: %ver%
Source: src/Abilities/Ability.php:64
description()
abstract public static function description(): string
What this ability does, written for the agent that has to choose between it and the one
next to it. It is the only documentation an MCP client ever sees.
Returns
string
Since: %ver%
Source: src/Abilities/Ability.php:74
category()
abstract public static function category(): string
The category slug, which must be one {@see Bootstrap::categories()} declares.
Foundation derives gk_scope from the suffix, so only a gk-gravitymigrate-{scope} slug
is reachable through a cross-product scope filter.
Returns
string
Since: %ver%
Source: src/Abilities/Ability.php:86
input_schema()
abstract public static function input_schema(): array
JSON Schema for the input.
Returns
array
Since: %ver%
Source: src/Abilities/Ability.php:95
output_schema()
abstract public static function output_schema(): array
JSON Schema for the output.
Returns
array
Since: %ver%
Source: src/Abilities/Ability.php:104
annotations()
abstract public static function annotations(): array
WordPress's own annotation vocabulary for this ability.
The HTTP method is derived from these: readonly is a GET, destructive plus
idempotent a DELETE, anything else a POST. A write annotated readonly is therefore
called with a verb WordPress refuses.
Returns
array{readonly:bool,— destructive:bool, idempotent:bool}
Since: %ver%
Source: src/Abilities/Ability.php:117
execute()
abstract public static function execute( array $input )
Does the work.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$input | array | Input, already validated against \self::input_schema(). |
Returns
array|\WP_Error
Since: %ver%
Source: src/Abilities/Ability.php:128
permission()
abstract public static function permission( array $input )
Whether this caller may run it.
Answered through \GravityKit\GravityMigrate\Migration\Permission, never a bare
current_user_can(): that helper is the one gate the wizard and wp gk migrate also ask.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$input | array | Input as received. |
Returns
bool|\WP_Error
Since: %ver%
Source: src/Abilities/Ability.php:142
next_steps()
public static function next_steps(): array
Which abilities usually come next, and when.
Carried on meta.annotations.next_steps, which the MCP client appends to this tool's own
description as real tool names. Declared in \Bootstrap::next_steps_map().
Returns
array<int,— array{ability:string, when:string}>
Since: %ver%
Source: src/Abilities/Ability.php:154
config()
public static function config(): array
The config Foundation registers, assembled from everything above.
Returns
array
Since: %ver%
Source: src/Abilities/Ability.php:165
mcp_tool_name()
public static function mcp_tool_name(): string
The MCP tool name this ability surfaces as.
Foundation owns this derivation at runtime (\GravityKit\Foundation\Abilities\Manager);
this reproduces it, so the two have to be changed together.
Returns
string
Since: %ver%
Source: src/Abilities/Ability.php:195