Commit 45ed1ee161 for woocommerce

commit 45ed1ee1617432776de6d4f0f3adf53d1876ebac
Author: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Date:   Mon Jan 26 22:04:35 2026 +0530

    Refactor code in MCPAdapterProvider (#61167)

    * Refactor code in MCPAdapterProvider

    * Add changelog entry for follow-up 60901

    Performance related refactor in MCPAdapterProvider

    * Update follow-up-60901

    adjust changelog

    ---------

    Co-authored-by: Michael Pretty <prettyboymp@users.noreply.github.com>

diff --git a/plugins/woocommerce/changelog/follow-up-60901 b/plugins/woocommerce/changelog/follow-up-60901
new file mode 100644
index 0000000000..8e57e7613c
--- /dev/null
+++ b/plugins/woocommerce/changelog/follow-up-60901
@@ -0,0 +1,4 @@
+Significance: patch
+Type: Tweak
+
+Use wp_is_serving_rest_request() in MCPAdapterProvider instead of contants.
diff --git a/plugins/woocommerce/src/Internal/MCP/MCPAdapterProvider.php b/plugins/woocommerce/src/Internal/MCP/MCPAdapterProvider.php
index 88e62cb235..ee5224e52f 100644
--- a/plugins/woocommerce/src/Internal/MCP/MCPAdapterProvider.php
+++ b/plugins/woocommerce/src/Internal/MCP/MCPAdapterProvider.php
@@ -166,7 +166,7 @@ class MCPAdapterProvider {
 		// Filter abilities based on namespace and custom filter.
 		$mcp_abilities = array_filter(
 			$all_abilities_ids,
-			function ( $ability_id ) {
+			static function ( $ability_id ) {
 				// Include WooCommerce abilities by default.
 				$include = str_starts_with( $ability_id, 'woocommerce/' );

@@ -175,6 +175,7 @@ class MCPAdapterProvider {
 				 * Filter to override MCP ability inclusion decision.
 				 *
 				 * @since 10.3.0
+				 *
 				 * @param bool   $include    Whether to include the ability.
 				 * @param string $ability_id The ability ID.
 				 */
@@ -214,7 +215,7 @@ class MCPAdapterProvider {
 	 */
 	public static function is_mcp_request(): bool {
 		// Check if this is a REST request.
-		if ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) {
+		if ( ! wp_is_serving_rest_request() ) {
 			return false;
 		}