is_woocommerce_active() ) { return; } // Orders search. new RegisterMcpTool( array( 'name' => 'wc_orders_search', 'description' => 'Get a list of WooCommerce orders', 'type' => 'read', 'rest_alias' => array( 'route' => '/wc/v3/orders', 'method' => 'GET', ), 'annotations' => array( 'title' => 'Search Orders', 'readOnlyHint' => true, 'openWorldHint' => false, ), ) ); // Reports tools. new RegisterMcpTool( array( 'name' => 'wc_reports_coupons_totals', 'description' => 'Get WooCommerce coupons totals report', 'type' => 'read', 'rest_alias' => array( 'route' => '/wc/v3/reports/coupons/totals', 'method' => 'GET', ), 'annotations' => array( 'title' => 'Get Coupons Report', 'readOnlyHint' => true, 'openWorldHint' => false, ), ) ); new RegisterMcpTool( array( 'name' => 'wc_reports_customers_totals', 'description' => 'Get WooCommerce customers totals report', 'type' => 'read', 'rest_alias' => array( 'route' => '/wc/v3/reports/customers/totals', 'method' => 'GET', ), 'annotations' => array( 'title' => 'Get Customers Report', 'readOnlyHint' => true, 'openWorldHint' => false, ), ) ); new RegisterMcpTool( array( 'name' => 'wc_reports_orders_totals', 'description' => 'Get WooCommerce orders totals report', 'type' => 'read', 'rest_alias' => array( 'route' => '/wc/v3/reports/orders/totals', 'method' => 'GET', ), 'annotations' => array( 'title' => 'Get Orders Report', 'readOnlyHint' => true, 'openWorldHint' => false, ), ) ); new RegisterMcpTool( array( 'name' => 'wc_reports_products_totals', 'description' => 'Get WooCommerce products totals report', 'type' => 'read', 'rest_alias' => array( 'route' => '/wc/v3/reports/products/totals', 'method' => 'GET', ), 'annotations' => array( 'title' => 'Get Products Report', 'readOnlyHint' => true, 'openWorldHint' => false, ), ) ); new RegisterMcpTool( array( 'name' => 'wc_reports_reviews_totals', 'description' => 'Get WooCommerce reviews totals report', 'type' => 'read', 'rest_alias' => array( 'route' => '/wc/v3/reports/reviews/totals', 'method' => 'GET', ), 'annotations' => array( 'title' => 'Get Reviews Report', 'readOnlyHint' => true, 'openWorldHint' => false, ), ) ); new RegisterMcpTool( array( 'name' => 'wc_reports_sales', 'description' => 'Get WooCommerce sales report', 'type' => 'read', 'rest_alias' => array( 'route' => '/wc/v3/reports/sales', 'method' => 'GET', ), 'annotations' => array( 'title' => 'Get Sales Report', 'readOnlyHint' => true, 'openWorldHint' => false, ), ) ); } /** * Checks if WooCommerce is active. * * @return bool True if WooCommerce is active, false otherwise. */ private function is_woocommerce_active(): bool { return class_exists( 'WooCommerce' ); } }