As stated in the docs these Viewport constants are representations of integers. Also getting the root-node can be abbreviated. So you could also write it like this:
func toggle_msaa(active):
if active:
VisualServer.viewport_set_msaa(get_node("/root").get_viewport_rid() , 3)
else:
VisualServer.viewport_set_msaa(get_node("/root").get_viewport_rid() , 0)
As far as I know there is no way of getting it even shorter without the use of referencing the viewport-rid.