How long you can work with your tools is dependant on your Stamina. The more Stamina you have, the longer you can do farm work before you start to turn blue. Once you turn blue you'll need to rest at the Clinic, the Hot Springs, go to bed, or eat some food. When you turn back to your normal color you can work some more.
Your Stamina is split into two parts: your Strength (also called your Energy) and your Fatigue. The Strength starts out at a high value and decreases to zero, while your Fatigue starts at zero and works upwards. The Stamina is also based on points. You'll start your game with 150 points of Strength and 100 points of Fatigue. You can increase your Strength by finding the Power Berries that are hidden in the game. Each berry will add 10 points to your total Strength. If you find all 10 berries then you'll have 250 points of Strength. You don't have any way of increasing the number of Fatigue points you have. The only berry that will help your Fatigue is the special Blue Berry you can receive from Kappa. The Blue Berry will allow you to work in the rain without the weather affecting your Fatigue points.
When you use a tool you'll decrease your Strength points by a certain amount. Most of the tools only affect your Strength a little bit, but tools like the Cursed ones will zap a large amount of Strength points every time you use one. Your farmer will give you a general indication of how many Strength points he has when you are at 50%, 20%, 5%, and 0 strength points left.
After you finish using up your Strength points, you can still continue to work because your Fatigue points kick in. Normally your Fatigue points won't start adding up until you use up your Strength, but there's a few things that begin increasing your Fatigue before using up your Strength. If you work outside when it's raining (or snowing) and you don't have the Blue Berry from Kappa, your Fatigue points will increase at the same time your Strength points decrease. Your Fatigue will also increase if you use one of your tools after 10pm, haven't gone to bed and it's after midnight, or eat a Poison Mushroom or the Red Grass you find on Mother's Hill. When your Fatigue hits 100 you'll turn blue, even if you have a lot of Strength points left.
To help keep your Stamina, you can use the items you have inside your house. The obvious item that recharges your Stamina is your bed. Depending on how many hours you sleep, you'll recharge you Strength and Fatigue a good amount. Putting a Moon Drop or Blue Magic Grass flower in the Flower Vase will help regain more Strength when you sleep. If you put a Pink Cat, Red Magic Grass, or Toy Flower in the vase, it will affect your Fatigue in the same way. Since you can't put any flowers in the vase during the Winter season, you can put a piece of wood in the Fireplace to help keep your Fatigue. The Fireplace is available after you have upgraded your house to it's highest level. Don't put a piece of wood in the Fireplace during any other season because it has the opposite affect on your Fatigue!
To immediately recharge your Stamina, you can eat food. Different food items recharge you for different amounts. The best food to eat is the Elli Grass, which is why it's ideal to bring with you when you go into the mines. You can also buy food at the various shops in Mineral Town, or cook some yourself. The more ingredients you add to a basic recipe, the more it will affect your Stamina when you eat it. If you have made the basic recipe before and are adding more ingredients, you'll be told how much SR (Strength Recovery) and FR (Fatigue Recovery) the new cooked food has compared to what you've made before.
Strength/Fatigue Recovery values