Skip to main content
Glama
extentos

extentos

getCodeExample

Retrieve full Kotlin and Swift code examples for smart-glasses patterns. Get canonical implementations, explanations, gotchas, and SDK features to build or verify your feature end-to-end.

Instructions

Reference library — retrieve a complete SDK code example (Kotlin + Swift) for a use case. For voice-assistant work on any new app, start with assistant_agent_loop — the Phase 4 glasses.assistant.start { tool(name, description) { body -> ToolResult } } API where the model owns wake detection + turn taking + intent parsing + confirmation speech and the customer only writes tool bodies that act on app state. The provider abstraction covers OpenAI Realtime, xAI Grok, and Google Gemini Live (Gemini from SDK 1.8.0+) — the model id picks the vendor. The example pairs the customer code with the agent-driven E2E loop (injectAssistantUtteranceassertToolCalled) that verifies it without humans. For the dedicated agent-side test workflow (explicit two-step wake, multi-tool sweep, four-channel verification: event log + adb logcat + screencap + library state; real-OpenAi capable since iter5.2): agent_driven_e2e_full_loop. For the glasses-display two-view navigation pattern (browse ⇄ detail on the Ray-Ban Display, Neural-Band select + assistant tools driving one state machine): display_browse_detail. Other patterns still ship for apps that need fine-grained control: voice_qa_assistant (manual glasses.voice.onPhrase wake + glasses.audio.recordDiscrete + customer-side AnthropicClient — the pre-Phase-3 composition), barge_in_speak (manual TTS cancel on user interrupt), photo_describe_voice (wake → photo → vision LLM → speak), live_transcription_ui (transcripts into Compose/SwiftUI state), voice_notes (wake → record → persist), connection_page_setup (the minimum bootstrap wiring), byok_anthropic (an Anthropic HTTP client the CUSTOMER'S OWN handler code calls with the customer's own key — used by voice_qa_assistant / photo_describe_voice. It has nothing to do with the assistant runtime, which always runs on the Extentos managed gateway with no key of any kind), agent_test_loop (the legacy three-surface verification recipe — for Phase 4 use agent_driven_e2e_full_loop). USE when you're about to write handler code and want the canonical shape to peel from, OR when you want the agent test driver that asserts the handler works end-to-end. DON'T USE for capability discovery (use getPlatformInfo) or per-feature minimal usage (use getCapabilityGuide).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYesWhich compositional pattern to fetch. Each returns full Kotlin + Swift code, an explanation, gotchas, and the SDK features it exercises.
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full disclosure burden. It clearly states what the tool returns ('full Kotlin + Swift code, an explanation, gotchas, and the SDK features it exercises') and clarifies a key potential misperception about byok_anthropic (not related to the assistant runtime). It does not cover rate limits or auth, but this is a reference retrieval tool with no mutation, so the transparency level is strong.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long, but the tool exposes 13 distinct patterns that each require explanation. The opening sentence is clear and purposeful, and the bulk organizes usage recommendations by bolded alternatives. While it could benefit from a bullet list, the density is justified and front-loaded with the most important direction ('start with assistant_agent_loop').

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having no output schema, the description discloses return contents and maps every pattern to its intended use context. It even explains that the pattern affects the example's code shape and verification approach, and covers when not to use the tool. The description is effectively a complete usage guide for the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although the schema covers the single `pattern` parameter with an enum, the description provides deep semantics for nearly every enum value, explaining what each pattern is for, when to use it, and how it relates to others. This goes far beyond the schema's tiny one-line description, making the parameter choices much more meaningful.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with 'Reference library — retrieve a complete SDK code example (Kotlin + Swift) for a use case', providing a specific verb and resource. It immediately names recommended sibling patterns (assistant_agent_loop, agent_driven_e2e_full_loop) and distinguishes them from fine-grained alternatives, clearly differentiating this tool from siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit guidance is given: 'USE when you're about to write handler code...' and 'DON'T USE for capability discovery (use getPlatformInfo) or per-feature minimal usage (use getCapabilityGuide)'. It also explains when to choose each pattern relative to alternatives (e.g., 'For the dedicated agent-side test workflow... agent_driven_e2e_full_loop').

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/extentos/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server