mcpbeat

Xb Context

google/xb-context

>- context ids, visible-object state, and Set-of-Mark screenshot labels. Use when an app or agent needs compact XR scene structure for selecting, inspecting, or acting on objects without traversing raw Three.js internals. Covers `options.enableContext()`, `options.enableSceneContext()`, `options.enableVisibleObjectsContext()`, `options.enableSetOfMarkContext()`, and `xb.context.scene.runContextDetection()`.

639 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
455
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/google/xrblocks --skill xb-context

The instruction itself

5 sections, as written by the author

xb-context — agent-facing scene context

xb.context.scene summarizes the XR scene for agents. It is not DOM-based: it

traverses XR Blocks, UIBlocks, and meaningful Three.js objects, omitting internal

helpers such as XRSystems descendants and depth meshes.

Enable Context

const options = new xb.Options();
options.enableContext(); // semantic tree + visible objects + SOM

For narrower streams:

options.enableSceneContext(); // semantic tree only
options.enableVisibleObjectsContext(); // semantic tree + view visibility
options.enableSetOfMarkContext(); // semantic tree + visible objects + SOM image
options.context.scene.pollingIntervalMs = 3000;

Disabled modules match the xb.world shape: xb.context.scene is undefined

unless context is enabled before xb.init(options).

One-Off Snapshot

Use one scene context call when you need multiple streams from the same snapshot:

const context = await xb.context.scene.runContextDetection({
  semanticTree: true,
  visibleObjects: true,
  setOfMark: true,
});

console.log(context.semanticTree.nodes);
console.log(context.visibleObjects.nodes);
console.log(context.setOfMark.marks);

Each semantic node has a stable ctx_* id, role, name, parent/children

relationships, object id, visibility flags, and optional view state. SOM marks

reuse stable labels so labels do not realign between app snapshots.

Continuous Polling

const client = {};
xb.context.scene.start(client);
// read xb.context.scene.tree / visibleObjects / setOfMark after polling
xb.context.scene.stop(client);

Continuous detection uses options.context.scene.pollingIntervalMs and shares a

single poll across enabled context streams.

Acting On Context Ids

Remote/embodied action tools can target context nodes with the structured target:

{"type": "contextNode", "id": "ctx_7"}

The scene detector resolves that id through its current semantic snapshot, so do

not infer targets from the ctx_ prefix yourself.

How to use it

Copy the folder

Take google/xb-context from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.