How to toggle CONTEXT menu items?

I know how to toggle menu items with a single macro. Example: View → Show / Hide Binder in Scrivener

image

But I can't figure out how to do it for context menu items, for example in Bear, if I click on a tag, I can right click → "pin" or "unpin" the tag.

thank you very much