(2) Given the function $f(x)=\sqrt{3} \sin 2 x+2 \cos ^{2} x+a$, if the minimum value of $f(x)$ on the interval $\left[0, \frac{\pi}{2}\right]$ is -1, then the value of $a$ is $\qquad$.
(2) -1 Hint: Since
$$
f(x)=\sqrt{3} \sin 2 x+1+\cos 2 x+a=2 \sin \left(2 x+\frac{\pi}{6}\right)+a+1,
$$

and when $x \in\left[0, \frac{\pi}{2}\right]$, $\frac{\pi}{6} \leqslant 2 x+\frac{\pi}{6} \leqslant \frac{7 \pi}{6}$.
Therefore, when $2 x+\frac{\pi}{6}=\frac{7 \pi}{6}$, i.e., $x=\frac{\pi}{2}$, $f(x)$ reaches its minimum value $-1+a+1=a$.
Thus, $a=-1$.