Extract RPC request logic