Read native Finder tags in an Apple Sscript

I have a rule in hazel that looks for certain files. On the matched files I run an Apple Script that does certain things. Now, I would also like to use the native Finder Tags of the matched files as a variable in that script. Despite extensive Googling, I was unable to find a way to read out the tags within an Apple Script. Does anybody here have an idea how I could do this? An help would be much appreciated.

I think you’ll need to call a shell script. mdls or if you want something simple https://github.com/jdberry/tag

Thank you so much for your quick response. That looks very interesting.

Do you have any pointers for a shell script that I could call within my Apple Script?