The purpose of the mechanicals' play-within-the-play is to portray one of Shakespeare's central themes, reality vs. illusion. In A Midsummer Night's Dream, Shakespeare strives to show that there is a very thin line that divides fantasy from reality and that, actually, our illusions greatly influence our reality. When a play is performed or viewed, reality and fantasy are united in the sense that the real world is viewing fantasy. In addition, if a play is performed well, reality is suspended for a moment because the viewer is so wrapped up in the believability of the story. Hence, the play-within-the-play serves to show how reality and fantasy can be united and how fantasy can manipulate reality. However, unlike a well-performed play, the mechanicals' play fails to suspend reality. Instead, the mechanicals allow their own illusions of their abilities to manipulate their own reality, again showing us Shakespeare's theme that illusions can manipulate reality.
It is the mechanicals' lack of education and skill that show us they are incapable of performing the quality of play they fantasize about performing. It can even be said that at least some of the mechanicals have visions of giving a grand performance, especially Bottom. We see Bottom's illusions of grandeur when we see him proclaim his own abilities as Pyramus in his lines, "If I do it, let the audience look to their eyes; I will move storms" (I.ii.21-22). However, as we see in the final act, the reality is that the mechanicals are incapable of giving a grand performance. Instead, their tragedy receives many unexpected laughs and a great deal of criticism. However, since the mechanicals allowed their decision to perform the play to be guided by their illusions, we see that they actually allowed their reality to be influenced by their illusions, creating a reality that was very different from what they ever expected. The new reality the mechanicals create through their illusions proves Shakespeare's theme concerning reality vs. illusion and that we allow our illusions to manipulate our realities.