Detect if my plugin is running through json-rpc?

Is there a way so I can detect my plugin is running through json-rpc?
The problem is somethimes I run my plugin through json-rpc and it runs setcontentview, but if another plugin is running or another gui is displayed, that setcontentview is going to change it.
I want to detect if my plugin is running through json-rpc and not issue a setcontentview.