WP Webhooks / Docs / fswa_ability_definitions
Filter since v2.0.0

fswa_ability_definitions

Filters the ability definitions that make up the AI agent toolset and the WordPress Abilities / MCP exposure.

$

/ Signature

apply_filters( 'fswa_ability_definitions', $definitions )

/ When it fires

Fires when the ability registry assembles its definitions — both for the in-admin Build with AI agent and for the wp_register_ability / MCP exposure. This is how the Pro plugin adds its Code Glue abilities.

/ Parameters

NameInTypeReqDescription
$definitionsparamarrayyesAbility definitions keyed by short name. Each entry: `label`, `description`, `category`, `scope` (`read`|`full`), `requires_confirm` (`false`|`when_live`|`always`), `input_schema` (JSON Schema), `callback`.

/ Returns

array Modified definitions array. Added entries become tools the Build with AI agent can plan with and are registered as WordPress Abilities.

/ Examples

Register a custom ability for the agent

add_filter( 'fswa_ability_definitions', function ( $definitions ) {
    $definitions['flush_cache'] = [
        'label'            => 'Flush the site cache',
        'description'      => 'Flush the object cache after webhook changes.',
        'category'         => 'maintenance',
        'scope'            => 'full',
        'requires_confirm' => 'always',
        'input_schema'     => [ 'type' => 'object', 'properties' => new stdClass() ],
        'callback'         => fn () => [ 'flushed' => wp_cache_flush() ],
    ];
    return $definitions;
} );

/ Related

Ready

Your next automation is
one sentence away.

$ wp plugin install flowsystems-webhook-actions --activate