How to add multiple context menu options on the parent and children or sub tree nodes

I have added context menu option for the tree nodes in the widget

I have subtree nodes for all the tree node

I need 2 different context menu on tree node and sub tree node
MicrosoftTeams-image (2)

How to implement this
attached image for reference

Thank you