'plugins/activate-plugin', 'args' => array( 'label' => __( 'Activate Plugin', 'acrossai-abilities-manager' ), 'description' => __( 'Activate an installed WordPress plugin by name, slug, or partial match. Works in recovery mode; only updates the active-plugins option and does not load the plugin file.', 'acrossai-abilities-manager' ), 'category' => 'acrossai-plugins', 'execute_callback' => array( $this, 'execute' ), 'permission_callback' => static function (): bool { return current_user_can( 'manage_options' ); }, 'input_schema' => array( 'type' => 'object', 'properties' => array( 'plugin' => array( 'type' => 'string', 'description' => __( 'Plugin name, file path (e.g. akismet/akismet.php), or partial match.', 'acrossai-abilities-manager' ), ), 'slug' => array( 'type' => 'string', 'description' => __( 'Alias for "plugin". If both are provided, "plugin" wins.', 'acrossai-abilities-manager' ), ), ), 'anyOf' => array( array( 'required' => array( 'plugin' ) ), array( 'required' => array( 'slug' ) ), ), 'additionalProperties' => false, ), 'output_schema' => array( 'type' => 'object', 'properties' => array( 'success' => array( 'type' => 'boolean' ), 'message' => array( 'type' => 'string' ), 'matched_plugin' => array( 'type' => 'string' ), 'certainty' => array( 'type' => 'number' ), ), ), 'meta' => array( 'acrossai' => array( 'tab_group' => 'updates', 'sub_group' => 'lifecycle', 'sub_group_label' => __( 'Lifecycle', 'acrossai-abilities-manager' ), ), 'show_in_rest' => true, 'mcp' => array( 'public' => false, 'type' => 'tool', ), 'annotations' => array( 'readonly' => false, 'destructive' => false, 'idempotent' => true, ), ), ), ); } /** * Execute the ability. * * @param array $input Ability input payload. * @return array */ public function execute( array $input = array() ): array { $raw_plugin = ! empty( $input['plugin'] ) ? $input['plugin'] : ( $input['slug'] ?? '' ); if ( empty( $raw_plugin ) ) { return array( 'success' => false, 'message' => __( 'No plugin specified. Pass "plugin" (or its alias "slug").', 'acrossai-abilities-manager' ), ); } return Plugin_Helpers::activate_plugin_by_slug( $raw_plugin ); } }