# elementor/4.3.1/modules/mcp/abilities/global-variables-resource-ability.php

Elementor Website Builder – more than just a page builder, version 4.3.1. 59 lines.

- Page: https://pluginprobe.com/plugins/elementor/4.3.1/code/modules/mcp/abilities/global-variables-resource-ability.php
- Raw: https://pluginprobe.com/plugins/elementor/4.3.1/raw/modules/mcp/abilities/global-variables-resource-ability.php
- Modified: 2026-09-01T11:47:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/elementor/4.3.1/code/modules/mcp/abilities/global-variables-resource-ability.php#L10-L20`.

```php
<?php

namespace Elementor\Modules\Mcp\Abilities;

use Elementor\Modules\Variables\Services\Batch_Operations\Batch_Processor;
use Elementor\Modules\Variables\Services\Variables_Service;
use Elementor\Modules\Variables\Storage\Variables_Repository;
use Elementor\Plugin;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class Global_Variables_Resource_Ability extends Abstract_Ability {
	const URI = 'elementor://global-variables';

	protected function get_ability_id(): string {
		return 'elementor/global-variables-resource';
	}

	protected function get_definition(): Ability_Definition {
		return new Ability_Definition(
			__( 'Global Variables', 'elementor' ),
			__( 'Design tokens (colors, fonts, sizes) from the active kit; check before styling with variables.', 'elementor' ),
			'elementor',
			[ 'type' => 'string' ],
			[
				'mcp' => [
					'type'        => 'resource',
					'uri'         => self::URI,
					'public'      => true,
					'mimeType'    => 'application/json',
					'description' => __( 'Design tokens (colors, fonts, sizes) from the active kit; check before styling with variables.', 'elementor' ),
				],
			],
			fn() => current_user_can( 'edit_posts' )
		);
	}

	public function execute( $input = [] ) {
		$kit = Plugin::$instance->kits_manager->get_active_kit();

		$variables_service = new Variables_Service(
			new Variables_Repository( $kit ),
			new Batch_Processor()
		);

		$variables_payload = $variables_service->load();

		$data = $variables_payload['data'] ?? [];

		return wp_json_encode( [
			'variables' => (object) $data,
			'total' => count( $data ),
			'watermark' => $variables_payload['watermark'] ?? null,
		] );
	}
}

```
