Depends on your view, this is an opinion-based question, so there is no right or wrong answer.
Here is my opinion: I think that the U.S should have declared war to Mexico. First, I believe that Texas was a territory that belonged to the U.S, as Mexican General Antonio Lopez signed a treaty that gave the U.S the right to annex Texas. Furthermore, most people that lived in Texas wanted to be part of the United States. Like democracy given to those in the Kansas-Nebraska territory years later, to decide whether they should be a free state or a slave state, the people should decide what they want to do with their state.
Second, I hold the view that the war is rational because expansionism is done in peaceful ways, but Mexico refused to be peaceful and immediately resorted to war. President James Polk wanted to expand the U.S, but Mexico refused to give up Texas. Today, we have Texas as a result of this war.