how to get if the item on the mainhand slot of a player is in a item tag list?

i have a block and i want it to summon a interaction entity on it wherever the nearest player has an item that can be used on it, and then the interaction entity get killed if there isn't any

Continue to help post