iCloud keeps the tabs you have open in Safari up to date on your iPhone, iPad, iPod touch, and Mac. That means you can go from one device to the next and pick up browsing wherever you left off.
I should've been more specific about what I want to do: I want a list of all the URLs open on Safari, either in one tab group or all of them; and get it either via Shortcuts, an API, or some other way. I can hold a tab group in the tabs menu and click "copy links." But that copies rich text of all the titles with the links, but when I try to get it in shortcuts, it only copies the titles.
What are you trying to do with the URLs in Shortcuts?
With respect to the extension, what you are looking for is called a Safari App Extension. (Not to be confused with a Safari Extension, it's antiquated kin.) It looks like, with the right permissions, you can iterate through all the tabs and get the URL of each. You'll need to try it out and see how it handles tab groups.
Also, in addition to having a terrible API, extensions are fairly constrained in what they can do. Even if you can pull the URLs, you may have trouble passing them off somewhere else.
Assuming there is a way, you might be able to send it to the clipboard. Otherwise, you could clumsily save the data in the container app, manually launch it, and then copy to clipboard from there.
The tabs manifest permission allows you to call tabs.query() against four sensitive properties on tabs.Tab instances: url, pendingUrl, title, and favIconUrl.
If you don't need access to those, you can get the tab IDs using the above snippet of code.
The extension needs to have been activated and granted the authorizations first, otherwise browser.tabs.query will return undefined.