how to use an active hotbar item

In Unreal Engine, I created an inventory and added a hotbar. How can I add the ability to use the active item in the hotbar? For example, if a weapon is active, it shoots on “LMB” button press and aims when the “RMB” button is pressed, but if a hammer is active, it builds on “LMB” button press and breaks when the “RMB” button is pressed.