6. Let the function $f(x)=x+\cos x, x$ $\in\left[0, \frac{\pi}{2}\right]$, then the maximum value of $f(x)$ is $\qquad$
$f^{\prime}(x)=1-\sin x \geqslant 0 \Rightarrow f(x)$ is monotonically increasing, so $f(x)_{\max }=f\left(\frac{\pi}{2}\right)=\frac{\pi}{2}$.