Mentalis was a computer built by Drax, a Time Lord, under the duress of the Shadow. Its purpose was to wage a war between Zeos (it was the Zeon commandant) and Atrios.
Described by the Doctor as a "passionless lump of minerals and circuitry" it was programmed not to accept defeat, and to act as the Zeon commandant in charge of attack, defence, surveillance and production. Inside the chamber there are weapons in the walls, and when the Atrion Shapp tries to fire at Mentalis the weapons are used to disarm him.
When Mentalis believes the war is over it has orders to obliterate everything - Zeos and Atrios - using its in-built self destruct mechanism. When the Doctor removes its casing to try to reprogram it Mentalis fires the weapons at its own control centre, destryoing it, after the self destruct countdown has started.
With Drax's help the Doctor is able to disarm the self-destruct before Mentalis can destroy itself, Zeos, and Atrios.