Device capabilities allow your MentraOS app to discover what hardware and software features are available on the connected smart glasses. This enables you to create adaptive experiences that work across different device models with varying capabilities.
Different smart glasses models have different hardware configurations. Some have cameras, others don’t. Some have displays, others don’t. Some have speakers, others only have a microphone, or no audio support at all. The capabilities system lets you detect these differences and adapt your app accordingly.
Copy
Ask AI
// Example: Check if the connected glasses have a cameraprotected async onSession(session: AppSession, sessionId: string, userId: string): Promise<void> { if (session.capabilities?.hasCamera) { // Glasses have a camera - enable photo/video features session.logger.info("Camera available!"); } else { // No camera - show alternative features session.logger.info("This device supports text and voice interactions."); }}
Device capabilities are available on the AppSession through the capabilities property:
Copy
Ask AI
import { AppSession, Capabilities } from '@mentraos/sdk';protected async onSession(session: AppSession, sessionId: string, userId: string): Promise<void> { // Capabilities may be null if not yet loaded const caps: Capabilities | null = session.capabilities; session.logger.info(`Connected to: ${caps?.modelName}`); // Now you can check specific capabilities if (caps.hasDisplay) { session.logger.info(`Display resolution: ${caps?.display?.resolution?.width}x${caps?.display?.resolution?.height}`); }}
protected async onSession(session: AppSession, sessionId: string, userId: string): Promise<void> { const caps = session.capabilities; if (!caps) return; if (caps.hasDisplay) { const display = caps.display!; // Adapt content based on display properties if (display.isColor) { // Use color-rich layouts and graphics session.layouts.showReferenceCard("🌈 Color Display", "Enjoying rich visuals!"); } else { // Use high-contrast, monochrome-friendly content session.layouts.showTextWall("Monochrome display detected"); } // Adapt text length based on display size const maxLines = display.maxTextLines || 3; if (maxLines < 5) { // Use shorter messages for smaller displays session.layouts.showTextWall("Short message"); } else { // Can display longer content session.layouts.showTextWall("This is a longer message that takes advantage of larger displays with more text lines available."); } } else { // No display - use audio-only interactions session.logger.info("No display available - using audio-only mode"); }}