We are given the slope of the tangent:
\[
\frac{dy}{dx} = 1 - \frac{1}{x^2}
\]
To find the curve, integrate:
\[
\int \frac{dy}{dx} \, dx = \int \left(1 - \frac{1}{x^2}\right) dx = x + \frac{1}{x} + C
\]
So the general solution is:
\[
y = x + \frac{1}{x} + C
\]
Now use the point \((1, 2)\) to find \(C\):
\[
2 = 1 + 1 + C \Rightarrow C = 0
\]
Hence, the required equation is:
\[
y = x + \frac{1}{x}
\]
\[
\boxed{y = x + \frac{1}{x}}
\]