There is such a site: wtfismyip.com, where you can conveniently get the address in a text file or json. I don’t know much about Linux (RouterOS is Linux after all) and I can’t figure out how to parse the IP address that this site gives out.
I found an example of saving the address to a file.
/tool fetch url="https://wtfismyip.com/text" mode=https dst-path=ip.txt
local ip [file get ip.txt contents ]
:put $ip
But I would not like to write something to the Mikrotik disk. I would like to immediately get a ready-made ip.
Moreover, I would like to have two options: from text and from json.