The solution in the flask contains:
1) Sodium hydroxide (NaOH)
2) Glucose (C6H12O6)
3) Methylene blue (C16H18N3SCl)
The glucose in the solution is slowly oxidized to gluconic acid by the dissolved oxygen, which is consumed:
2C5H11O5-CHO(aq) + O2(g) → 2C5H11O5-COOH(aq)
glucose gluconic acid
Under reducing conditions (a static glucose solution, with oxygen mostly “spent”), the methylene blue turns virtually colorless. If the flask is opened and shaken again, the methylene blue regains its blue color due to the oxygen from air.
The aqueous solution in the classical reaction contains glucose, sodium hydroxide and methylene blue. In the first step the enolate of glucose is formed. The next step is a redox reaction of the enolate with methylene blue. The glucose is oxidized to gluconic acid which, in alkaline solution is in the sodium gluconate form. Methylene blue is reduced to colorless leucomethylene blue.