tool_name = $name; $this->tool_description = $description; $this->schema = $schema; } public function name(): string { return $this->tool_name; } public function description(): string { return $this->tool_description; } public function input_schema(): array { return $this->schema; } public function execute( array $input, array $context = array() ): array { return array( 'success' => false, 'deferred' => true, 'message' => 'This Elementor MCP tool must execute in the open editor.', ); } } /** * Central registry of tools available to the AI agent. */ class Tool_Registry { /** * @var Tool[] */ private static $tools = array(); /** * Register a tool. */ public static function register( Tool $tool ): void { self::$tools[ $tool->name() ] = $tool; } /** * Get a registered tool by name. */ public static function get( string $name ): ?Tool { return self::$tools[ $name ] ?? null; } /** * Return metadata for all registered tools. */ public static function get_schemas(): array { return array_map( function ( Tool $tool ) { return array( 'name' => $tool->name(), 'description' => $tool->description(), 'input_schema' => $tool->input_schema(), ); }, self::$tools ); } /** * Return all registered tools. * * @return Tool[] */ public static function all(): array { return self::$tools; } /** * Clear the registry. Mainly useful for tests. */ public static function clear(): void { self::$tools = array(); } }