SYSTEM Cited by 1 source
Glass (Meta symbol server)¶
Glass is the symbol server that sits in front of Glean
and exposes code-navigation operations through a uniform, language-agnostic
API. Glass "abstracts all the complexities of Glean by implementing the
usual code navigation logic in a simple but powerful API" (Source:
sources/2025-01-01-meta-indexing-code-at-scale-with-glean). Glass is
open source at
facebookincubator/Glean/glean/glass.
Role in the stack¶
┌────────────────────┐ ┌────────────────┐ ┌──────────┐
│ Code browser │ │ Code review │ │ IDE │
│ (Monaco-based) │ │ (Phabricator) │ │ (VS Code)│
└──────────┬─────────┘ └────────┬───────┘ └────┬─────┘
│ │ │
└──────── Glass API ─────┴──────────────────┘
│
Angle queries
│
┌─────▼──────┐
│ Glean │
└────────────┘
Glass is the single integration point for language-agnostic navigation. Callers don't learn Angle or per-language schemas; they issue Glass API calls and Glass translates to Angle behind the scenes.
Primary API: documentSymbols¶
"The code browser needs only a single Glass API call,
documentSymbols(repo, path, revision), to obtain a list of all the
definitions and references in a source file, including source and target
spans. The list of definitions is used to render an outline of the file,
and the list of references to render underlines that can be hovered over
or clicked to navigate."
In one call, Glass returns everything the browser needs to render a file with click-through navigation:
- Definitions in the file (for the outline / file-structure view).
- References in the file, each with source span (where the ref appears in this file) and target span (where the definition lives).
Other API surfaces¶
- Find References — all callers / usages of a symbol across the repo.
- Call Hierarchy — callers-of-callers / callees-of-callees expansion.
- Hovercards — type signature + doc comment for any symbol under the cursor.
- Symbol-keyed documentation — see symbol IDs below.
Symbol IDs¶
Glass assigns every symbol a symbol ID — a
unique string identifier. Example: the C++ symbol folly::Singleton
gets a symbol ID like REPOSITORY/cpp/folly/Singleton. Symbol IDs are
the URL-stable handle for documentation + cross-references:
"The symbol ID can be used to link directly to the documentation page for the symbol, so there's a URL for every symbol that doesn't change even if the symbol's definition moves around. We can use the symbol ID to request information about a symbol from Glass, for example to find all the references to the symbol throughout the repository. All of this works for every language, although the exact format for a symbol ID varies per language." (Source: sources/2025-01-01-meta-indexing-code-at-scale-with-glean.)
Consumers at Meta¶
- Internal code browser (embedded Monaco editor) — outline + cross-file navigation + references.
- Phabricator code review — accurate go-to-definition on the code being reviewed, including insertions and modifications. Names Glass as the endpoint that unlocks code review-time navigation across C++, Python, PHP, JavaScript, Rust, Erlang, Thrift, and Haskell.
- Auto-generated documentation — data for doc pages is produced by Glass and rendered by a client-side UI; every doc page has a stable symbol-ID URL.
Why Glass instead of direct Glean¶
Two reasons the post makes explicit:
- Language neutrality at the API boundary. Glean's schemas are per-language; Glass owns the projection from language-specific facts to a uniform navigation API. Callers don't have to know C++'s FunctionDeclaration schema differs from Python's.
- Stable contract for tool developers. Glass is the versioned surface; the schemas underneath can evolve without breaking the code browser / review / docs pipelines.
Seen in¶
- sources/2025-01-01-meta-indexing-code-at-scale-with-glean — the Meta Engineering overview; canonical reference for Glass's API shape and consumer list.