The account is consistent across the later Tibetan histories. Songtsen Gampo, wanting his people to be able to write and to receive the Buddhist scriptures, sends a minister named Thonmi Sambhota to India with a party of companions. He studies there under Indian masters, learns Sanskrit and the writing systems of the subcontinent, and comes back to design an alphabet fitted to Tibetan. He then composes grammars of the new written language, and the king shuts himself away for years to learn it.
The story does everything a foundation account should do. It gives Tibetan writing a single named inventor, a royal commission and an Indian pedigree in one move, and the Indian pedigree is the part that matters most, because it makes the script a vessel built for the dharma from the beginning.
The difficulty is when the story first appears. The earliest Tibetan documents, including the imperial-period material recovered at Dunhuang, do not name him. The narrative surfaces in histories composed from around the eleventh century, four hundred years after the events they describe, in a period actively constructing an account of the empire as a Buddhist one. Two grammatical works, the Sum cu pa and the Rtags kyi jug pa, are attributed to him and were the ground on which Tibetan grammar was taught for centuries, but neither can be placed in the seventh century on any evidence independent of the tradition that assigns them.