How to create a Custom Menu with a function in the Menu

Hello, i’m having problems to create a Custom Menu.
For exemplo, i have this :


but at the place of “mesh.primitive_cube_add” i wont put a function like:

def test():


That is possible ? By this way how i write does not work, how can i do this ?

because test() is not an operator… In order to do this you should write a custom operator Class
you can find some templates in blender, then in execute put