Detection of essential surfaces in 3-manifolds with $SL_2$-trees