"Is the role of an MP or senator defined or set out in any legislation?"

Thanks for your question. There is no legislation (law) which specifically defines the role of a senator or memeber of the House of Representative. Their work is largely dependent on how they choose to serve their constituents, and how they deal with proposals put before the parliament. They do this by:

There is a number of Acts (laws) which define the powers and functions of the parliament as a whole. The Australian Constitution contains the rules about how members of parliament are elected, and the terms of their service, but does not cover their role.

diagram to help explain Is the role of an MP or senator defined or set out in any legislation?