The mirror machine was the means by which Trelane, the Squire of Gothos, performed most of his tricks. Trelane referred to this device as one of his " medium(s) of instrumentality".
In 2267, the USS Enterprise discovered the planet Gothos within a star desert – a region of space completely void of stars. On Gothos, they encountered Trelane, an alien who appeared Human, but who was capable of a great many superhuman feats. These included rearranging matter as a replicator does (although far faster), generating powerful energy fields that inhibited sensors and communication, instantaneous matter transmission, holding living beings in suspension, teaching living beings new skills instantaneously, and perhaps more. Trelane used these powers to control, entertain and torment various crew members.
On discovering that Trelane's food had no flavor, and his fire emitted no heat, Captain James T. Kirk began to suspect that Trelane only knew the forms of things and not their substances. He and Spock further speculated that some external agency was realizing Trelane's wishes – and when he noticed Trelane never strayed far from his large wall mirror, Kirk suspected where that agency might be hidden.
Challenging the hapless Squire of Gothos to a duel, Kirk instead shot the mirror – which exploded in a shower of sparks. Most of Trelane's effects ceased operating, and as the smoke cleared, Kirk's suspicions were confirmed – the mirror concealed an intricate device that performed most of Trelane's tricks for him. With it gone, Kirk and his crew were able to escape Gothos – for a while. The mirror machine wasn't the only device at Trelane's command, and when he recaptured the Enterprise a short while later, his bag of tricks was once again full. Additionally, Trelane's oasis remained intact, suggesting the existence of another machine too large to fit inside Trelane's house.
Trelane evidently commanded the mirror machine via telepathy, or some other non-verbal form of communication. He never spoke his requests aloud, instead performing his extraordinary feats with at most a wave of his hand. Sophisticated as it was, Trelane was able to repair or replace it within minutes of its destruction. (TOS: "The Squire of Gothos")