In the Command Reference guide I haven't found any hint towards this question.
However, there's a trick you may be able to use:
The command "infacmd.sh ListDomainCiphers" cannot be executed on a worker node. So all you have to do is to execute this command on the node in question; if it issues an appropriate error message, it's a worker node; if it returns some "useful" content, it's a gateway node.
You can also check in node.log, you should be able to know if the node is setup as a gateway or a worker node.
For instance for a gateway node you should see something like this-
Node [Node001] is set up as a gateway node in domain [Domain_Prod].
As Anukrati mentioned, you can get these details from node.log:
a) Worker Node:
INFO [localhost-startStop-1] [NODE_10023] Node [node_name] is set up as a worker node in domain [domain_name] using domain user [admin_user].
b) Gateway node:
INFO [main] [NODE_10024] Node [node_name] is set up as a gateway node in domain [domain_name].
c) Master Gateway Node:
INFO [Domain Monitor] [DOM_10108] Registering the node with the master gateway node located at host address [host_name:port_num].
You can use above message codes to fetch the details of the nodes.
As you can see from the previous responses that there are several ways to do this.
However I was wondering why are you asking.
Do you have a requirement to convert a gateway node to a master or vice versa?