Detecting how a script was called

I have a script to open our driveway gate that so far can be called in two ways:

  1. Via an automation when we approach home (enter a zone that starts a bit before the driveway)
  2. Tell Google Assistant to open the gate (for when guests pull up)

Both work as desired, but I would like to have a security check in the script so that it only opens the gate via google assistant IF one of us are home, so someone can’t walk up to the house and yell through a window.

I haven’t figured out how to do this. I’ve found some info on Trigger IDs and Contexts, but can’t figure out a way to pass these from the automation to the script so I can use them there in an if/then/condition. I also see in the script logbook that it says ‘triggered by Google Assistant’ but can’t figure out how to see that info from within the script either.

Would appreciate being pointed in the right direction, as I’m not really sure the intended way to handle this so don’t know what I should be searching for. Or if I’m going about this in a weird way that there is a better standard way to do it, open to suggestions.