e.g can I access the name as a variable inside the function?
yes you can actually, it's listed on the "writing functions" doc page:
Now, if only there was a built-in property for
node.outputs (how many output ports are defined)...
or better yet, an array of output definitions (with labels and such).