Considering the Jordan-Brans-Dicke action:
$$S=\int d^4x\sqrt{-g}\left(\phi R+\frac\omega\phi(\partial\phi)^2+\mathfrak{L_{m}}(\psi)\right).$$
I was trying to get the metric field equations by varying the metric and got this:
$$ -\frac{1}{2}g_{\mu\nu}R+R_{\mu\nu}+\frac{\omega}{\phi^2}[-\frac{1}{2}g_{\mu\nu}(\partial\phi)^2+\partial_\mu\phi\partial_\nu\phi]-\frac{1}{2\phi}g_{\mu\nu}\mathfrak{L_{m}}(\psi)=0 $$
I varied the terms $\sqrt{-g}$, $R_{\mu\nu}$ , $g^{\mu\nu}$ and $\partial_\mu \phi \partial_\nu \phi g^{\mu\nu}$. If we are only conserned for the equations of the metric field then this is it right? If I wanted the equations for the gravitational field we would have to vary w.r.t. the metric and the field $\phi$ right?
EDIT: On the 2nd Leibniz rule I considered:
$$ -\nabla^{\alpha}\nabla_{\alpha}(g_{\mu\nu}\phi\delta g^{\mu\nu}) = -g_{\mu\nu}\nabla^{\alpha}\nabla_{\alpha}(\phi) \delta g^{\mu\nu}-g_{\mu\nu}\nabla^{\alpha} (\phi)\nabla_{\alpha}(\delta g^{\mu\nu})-g_{\mu\nu}\nabla_{\alpha} (\phi)\nabla^{\alpha}( \delta g^{\mu\nu})-g_{\mu\nu} \phi \nabla^{\alpha}\nabla_{\alpha}(\delta g^{\mu\nu}) $$
I pulled out the metric so I dont have to deal with 6 terms. The ones we want are only the first and second in the RHS of this equation