Check if tag provider is remote, local and/or what is the source gateway through scripting

Is there a simple way of retrieving if a taprovider is remote or local? I'm involved in building a tool that creates reference tags in one tag provider with references to tags in other tag providers. This project is portable (it might live on multiple gateways and might be used by various people with different skill levels).

I'd like to block the creation of reference tags in a target tag provider that does not have acces to the tags it is referencing. To do this I either need to know the gateway de tag provider is living on or I need to block creation of reference tags on remote tag providers altogether. The first option would give us more flexibility but the second option would also be acceptable.

Is either possible?