The formation of the diamminesilver(I) complex $\ce{[Ag(NH3)2]+}$ due to addition of ammonia has mainly three functions.
1.
The Tollens test takes place under alkaline aqueous conditions. The complexation of $\ce{Ag+}$ with $\ce{NH3}$ prevents precipitation of brown $\ce{Ag2O}$:
$$\ce{2Ag+ + 2OH- <=> 2 AgOH <=> Ag2O + H2O}$$
2.
The Tollens test shall be selective for aldehydes. $\ce{[Ag(NH3)2]+}$ is a milder oxidising agent than $\ce{Ag+}$.
$$\begin{alignat}{2}
\ce{Ag+ + e- \;&<=> Ag}\quad &&E^\circ = +0.799\ \mathrm{V}\\
\ce{[Ag(NH3)2]+ + e- \;&<=> Ag + 2 NH3}\quad &&E^\circ = +0.373\ \mathrm{V}
\end{alignat}$$
The difference in redox potential can be explained using the stability constant of $\ce{[Ag(NH3)2]+}$:
$$K_\text{B} = \frac{\left[\ce{[Ag(NH3)2]+}\right]}{\left[\ce{Ag+}\right]\left[\ce{NH3}\right]^2}$$
$$\begin{aligned}
E&=E_{\ce{Ag+}}^\circ+\frac{RT}{F}\cdot\ln\left[\ce{Ag+}\right]\\
&=E_{\ce{Ag+}}^\circ+\frac{RT}{F}\cdot\ln\frac{\left[\ce{[Ag(NH3)2]+}\right]}{K_\text{B}\cdot\left[\ce{NH3}\right]^2} \\
E_{\ce{[Ag(NH3)2]+}}^\circ&=E_{\ce{Ag+}}^\circ+\frac{RT}{F}\cdot\ln\frac{1}{K_\text{B}} \\
&\approx E_{\ce{Ag+}}^\circ-0.059\ \mathrm{V}\cdot\log K_\text{B}
\end{aligned} $$
3.
The complex formation equilibrium slows down the overall reaction. A slow, controlled reaction is important for creating the desired silver mirror. If $\ce{Ag+}$ is reduced too quickly, colloidal silver metal would appear, which would create a black cloudy liquid.