Tom clearly feels sad and sorry for himself, lonely, isolated, wanting to die.
We know this from the way Mark Twain describes Tom's thoughts and the way he uses reinforcing details throughout the description.
The distance effect
Notice how Twain doesn't get into too much physical detail in this snippet.
He doesn't write: "Tom sat on the edge of the wide green river, mud sucking at his toes, the air stinking of marsh gas. Mosquitoes landed on the backs of his hands while he contemplated the dreary vastness of the stream…"
Instead he keeps the description at a distance, almost summarising thought and action.