Possible to add new OSC actions via a tool?

I know how to add custom OSC handlers via GlobalOscActions. I would like to add a custom action via a tool. I took a stab at simply mimicking the code used to do this in GlobalOscActions but it did not work.

Is this even possible?

If it’s possible, does anyone have any pointers (or working code they can share)?

Thanks!