First, observe that, for any category $\mathscr C$ and object $C \in \mathscr C$ for which $\mathscr C$ admits binary products with $C$, the slice category $\mathscr C/C$ is the category of coalgebras for the comonad given by $({-}) \times C$ (this is sometimes called the coreader comonad). Consequently, for each category $\mathscr E$, the forgetful functor $\mathbf{Cat}/\mathscr E \to \mathscr E$ is comonadic.
Therefore, by the (dual of the) adjoint triangle theorem, since $\mathbf{Cat}/\mathscr E \to \mathscr E$ is comonadic, any functor $\mathscr X \to \mathbf{Cat}/\mathscr E$ from a category $\mathscr X$ with coreflexive equalisers has a right adjoint if and only if the composite $\mathscr X \to \mathbf{Cat}/\mathscr E \to \mathscr E$ does. In particular, since $\mathbf{Cat}/\mathscr B$ is complete (since $\mathbf{Cat}$ is), any functor $\mathbf{Cat}/\mathscr B \to \mathbf{Cat}/\mathscr E$ has a right adjoint if and only if the composite $\mathbf{Cat}/\mathscr B \to \mathbf{Cat}/\mathscr E \to \mathscr E$ does.
(This argument appears (more concisely) in Street's 2001 note Powerful functors, which is presumably what motivates the question.)