__( 'AI Content Generation', 'ai-content-generator-for-woocommerce' ), 'description' => __( 'Abilities for generating WooCommerce product content using the ChatGPT API.', 'ai-content-generator-for-woocommerce' ), ) ); } // ------------------------------------------------------------------------- // Abilities // ------------------------------------------------------------------------- private function register_generate_description() { if ( ! function_exists( 'wp_register_ability' ) ) { return; } wp_register_ability( 'webtoffee-ai/generate-product-description', array( 'label' => __( 'Generate Product Description', 'ai-content-generator-for-woocommerce' ), 'description' => __( 'Generates a full HTML product description and short excerpt for a WooCommerce product using the ChatGPT API.', 'ai-content-generator-for-woocommerce' ), 'category' => 'webtoffee-ai-content', 'input_schema' => array( 'type' => 'object', 'required' => array( 'product_id' ), 'properties' => array( 'product_id' => array( 'type' => 'integer', 'description' => __( 'The WooCommerce product post ID.', 'ai-content-generator-for-woocommerce' ), ), 'tone' => array( 'type' => 'string', 'enum' => array( 'formal', 'casual', 'persuasive', 'technical', 'luxury', 'creative' ), 'default' => 'formal', 'description' => __( 'Writing tone for the generated description.', 'ai-content-generator-for-woocommerce' ), ), ), ), 'output_schema' => array( 'type' => 'object', 'properties' => array( 'description' => array( 'type' => 'string', 'description' => __( 'The generated HTML product description.', 'ai-content-generator-for-woocommerce' ), ), 'excerpt' => array( 'type' => 'string', 'description' => __( 'The generated short excerpt (max 50 words).', 'ai-content-generator-for-woocommerce' ), ), ), ), 'execute_callback' => array( $this, 'execute_generate_description' ), 'permission_callback' => array( $this, 'permission_manage_woocommerce' ), 'meta' => array( 'show_in_rest' => true, 'mcp' => array( 'public' => true ) ), ) ); } private function register_generate_short_description() { if ( ! function_exists( 'wp_register_ability' ) ) { return; } wp_register_ability( 'webtoffee-ai/generate-product-short-description', array( 'label' => __( 'Generate Product Short Description', 'ai-content-generator-for-woocommerce' ), 'description' => __( 'Generates a concise 2-3 sentence short description for a WooCommerce product.', 'ai-content-generator-for-woocommerce' ), 'category' => 'webtoffee-ai-content', 'input_schema' => array( 'type' => 'object', 'required' => array( 'product_id' ), 'properties' => array( 'product_id' => array( 'type' => 'integer', 'description' => __( 'The WooCommerce product post ID.', 'ai-content-generator-for-woocommerce' ), ), 'tone' => array( 'type' => 'string', 'enum' => array( 'formal', 'casual', 'persuasive', 'technical', 'luxury', 'creative' ), 'default' => 'formal', ), ), ), 'output_schema' => array( 'type' => 'string', 'description' => __( 'The generated short description (HTML paragraphs).', 'ai-content-generator-for-woocommerce' ), ), 'execute_callback' => array( $this, 'execute_generate_short_description' ), 'permission_callback' => array( $this, 'permission_manage_woocommerce' ), 'meta' => array( 'show_in_rest' => true, 'mcp' => array( 'public' => true ) ), ) ); } private function register_generate_image() { if ( ! function_exists( 'wp_register_ability' ) ) { return; } wp_register_ability( 'webtoffee-ai/generate-product-image', array( 'label' => __( 'Generate Product Image', 'ai-content-generator-for-woocommerce' ), 'description' => __( 'Generates product images via OpenAI or Google Gemini based on the product title, categories, and tags.', 'ai-content-generator-for-woocommerce' ), 'category' => 'webtoffee-ai-content', 'input_schema' => array( 'type' => 'object', 'required' => array( 'product_id' ), 'properties' => array( 'product_id' => array( 'type' => 'integer', 'description' => __( 'The WooCommerce product post ID.', 'ai-content-generator-for-woocommerce' ), ), ), ), 'output_schema' => array( 'type' => 'object', 'properties' => array( 'image_urls' => array( 'type' => 'array', 'items' => array( 'type' => 'string' ), 'description' => __( 'Array of generated image URLs saved to the WordPress media library.', 'ai-content-generator-for-woocommerce' ), ), ), ), 'execute_callback' => array( $this, 'execute_generate_image' ), 'permission_callback' => array( $this, 'permission_manage_woocommerce' ), 'meta' => array( 'show_in_rest' => true, 'mcp' => array( 'public' => true ) ), ) ); } private function register_generate_brands() { if ( ! function_exists( 'wp_register_ability' ) ) { return; } wp_register_ability( 'webtoffee-ai/generate-product-brands', array( 'label' => __( 'Generate Product Brands', 'ai-content-generator-for-woocommerce' ), 'description' => __( 'Suggests 3-5 relevant brand names for a WooCommerce product using the ChatGPT API.', 'ai-content-generator-for-woocommerce' ), 'category' => 'webtoffee-ai-content', 'input_schema' => array( 'type' => 'object', 'required' => array( 'product_id' ), 'properties' => array( 'product_id' => array( 'type' => 'integer', 'description' => __( 'The WooCommerce product post ID.', 'ai-content-generator-for-woocommerce' ), ), ), ), 'output_schema' => array( 'type' => 'object', 'properties' => array( 'brands' => array( 'type' => 'array', 'items' => array( 'type' => 'string' ), 'description' => __( 'Suggested brand name strings.', 'ai-content-generator-for-woocommerce' ), ), ), ), 'execute_callback' => array( $this, 'execute_generate_brands' ), 'permission_callback' => array( $this, 'permission_manage_woocommerce' ), 'meta' => array( 'show_in_rest' => true, 'mcp' => array( 'public' => true ) ), ) ); } private function register_generate_tags() { if ( ! function_exists( 'wp_register_ability' ) ) { return; } wp_register_ability( 'webtoffee-ai/generate-product-tags', array( 'label' => __( 'Generate Product Tags', 'ai-content-generator-for-woocommerce' ), 'description' => __( 'Suggests 8-12 relevant keyword tags for a WooCommerce product using the ChatGPT API.', 'ai-content-generator-for-woocommerce' ), 'category' => 'webtoffee-ai-content', 'input_schema' => array( 'type' => 'object', 'required' => array( 'product_id' ), 'properties' => array( 'product_id' => array( 'type' => 'integer', 'description' => __( 'The WooCommerce product post ID.', 'ai-content-generator-for-woocommerce' ), ), ), ), 'output_schema' => array( 'type' => 'object', 'properties' => array( 'tags' => array( 'type' => 'array', 'items' => array( 'type' => 'string' ), 'description' => __( 'Suggested tag/keyword strings.', 'ai-content-generator-for-woocommerce' ), ), ), ), 'execute_callback' => array( $this, 'execute_generate_tags' ), 'permission_callback' => array( $this, 'permission_manage_woocommerce' ), 'meta' => array( 'show_in_rest' => true, 'mcp' => array( 'public' => true ) ), ) ); } private function register_mark_ai_generated() { if ( ! function_exists( 'wp_register_ability' ) ) { return; } wp_register_ability( 'webtoffee-ai/mark-product-ai-generated', array( 'label' => __( 'Mark Product as AI-Generated', 'ai-content-generator-for-woocommerce' ), 'description' => __( 'Sets or clears the AI-generated flag on a product, which controls the frontend badge display.', 'ai-content-generator-for-woocommerce' ), 'category' => 'webtoffee-ai-content', 'input_schema' => array( 'type' => 'object', 'required' => array( 'product_id' ), 'properties' => array( 'product_id' => array( 'type' => 'integer', 'description' => __( 'The WooCommerce product post ID.', 'ai-content-generator-for-woocommerce' ), ), 'marked' => array( 'type' => 'boolean', 'default' => true, 'description' => __( 'True to set the flag, false to remove it.', 'ai-content-generator-for-woocommerce' ), ), ), ), 'output_schema' => array( 'type' => 'boolean', 'description' => __( 'True if the operation succeeded.', 'ai-content-generator-for-woocommerce' ), ), 'execute_callback' => array( $this, 'execute_mark_ai_generated' ), 'permission_callback' => array( $this, 'permission_manage_woocommerce' ), 'meta' => array( 'show_in_rest' => true, 'mcp' => array( 'public' => true ) ), ) ); } }