You can get the material if you call this function on a mesh instance, you can do this on _ready() (make sure to define "var mat" at the top of the script so the rest of the functions can see it):
mat = get_surface_material(0)
Note that if your script is not directly on the mesh instance, you will need to use get_node("") to get it.
Then to change the material properties you can use this to change the color to something random:
mat.albedo_color = Color(randf(), randf(), randf())
Hope that helps.