In Pokemon Legends: Z-A, players collect Mega Shards, but the game doesn't immediately explain their purpose.
The game introduces Mega Crystals, which contain Mega Energy, early on in Lumiose City. These crystals are clusters of rock-like formations and pink shards that can be shattered to obtain Mega Shards.
Mega Crystals are described as collections of Mega Energy.
Although Mega Crystals are plentiful and easy to spot, the true purpose of collecting Mega Shards isn't clear until later in the game.
Author's summary: Collecting Mega Shards in Pokemon Legends: Z-A.