Skip to content

MCP Tools Reference

The IWSDK MCP server exposes 32 tools organized into 9 categories. These tools give AI agents full control over the emulated XR runtime, the browser, the Three.js scene, and the ECS simulation.

If you change the runtime tool contract or CLI mappings, run pnpm test:cli-mcp-parity. If you change @iwsdk/reference CLI/MCP mappings, run pnpm test:reference-cli-mcp-parity. Run pnpm test:mcp-parity when a change touches both surfaces or when you want the full contract check before review.

Session Management

xr_get_session_status

Get the current XR session and device status. The response also includes managed-browser readiness metadata so agents can distinguish "runtime up but browser still connecting" from "browser connected".

Parameters: None

xr_accept_session

Accept an offered XR session — equivalent to clicking the "Enter XR" button.

Parameters: None

xr_end_session

End the current active XR session.

Parameters: None

Transform Control

xr_get_transform

Get the position and orientation of a tracked device.

ParameterTypeRequiredDescription
devicestringYesheadset, controller-left, controller-right, hand-left, hand-right

xr_set_transform

Set the position and/or orientation of a tracked device. Position is in meters, orientation can be a quaternion or euler angles in degrees.

ParameterTypeRequiredDescription
devicestringYesDevice to move
position{x, y, z}NoWorld position in meters. Y=1.6 is standing height.
orientation{x,y,z,w} or {pitch,yaw,roll}NoQuaternion or euler angles (degrees)

xr_look_at

Orient a device to look at a specific world position.

ParameterTypeRequiredDescription
devicestringYesDevice to orient
target{x, y, z}YesWorld position to look at
moveToDistancenumberNoAlso move the device to this distance from the target

xr_animate_to

Smoothly animate a device to a new position and/or orientation over time.

ParameterTypeRequiredDescription
devicestringYesDevice to animate
position{x, y, z}NoTarget world position in meters
orientation{x,y,z,w} or {pitch,yaw,roll}NoTarget rotation
durationnumberNoAnimation duration in seconds (default: 0.5)

Input Mode

xr_set_input_mode

Switch between controller and hand tracking input modes.

ParameterTypeRequiredDescription
modestringYescontroller or hand

xr_set_connected

Connect or disconnect an input device.

ParameterTypeRequiredDescription
devicestringYescontroller-left, controller-right, hand-left, hand-right
connectedbooleanYesWhether the device should be connected

Select / Trigger

xr_get_select_value

Get the current select (trigger/pinch) value for an input device.

ParameterTypeRequiredDescription
devicestringYescontroller-left, controller-right, hand-left, hand-right

xr_set_select_value

Set the select (trigger/pinch) value. Use for grab-move-release patterns: set to 1.0 to grab, move the controller, then set to 0.0 to release.

ParameterTypeRequiredDescription
devicestringYescontroller-left, controller-right, hand-left, hand-right
valuenumberYes0 (released) to 1 (fully pressed/pinched)

xr_select

Perform a complete select action (press and release). Dispatches selectstart, select, and selectend events.

ParameterTypeRequiredDescription
devicestringYescontroller-left, controller-right, hand-left, hand-right
durationnumberNoHow long to hold in seconds (default: 0.15)

Gamepad

Controllers only — not available for hand tracking.

xr_get_gamepad_state

Get the full gamepad state including all buttons and axes.

Button indices: 0=trigger, 1=squeeze, 2=thumbstick press, 3=A/X, 4=B/Y, 5=thumbrest.

ParameterTypeRequiredDescription
devicestringYescontroller-left or controller-right

xr_set_gamepad_state

Set gamepad button and axis values by index.

ParameterTypeRequiredDescription
devicestringYescontroller-left or controller-right
buttons[{index, value, touched?}]NoButton states to set
axes[{index, value}]NoAxis values to set (0=thumbstick X, 1=thumbstick Y)

Device State

xr_get_device_state

Get comprehensive state of the XR device including headset position, controller/hand transforms, input mode, FOV, and stereo settings.

Parameters: None

xr_set_device_state

Set device state. When called with no state parameter, resets everything to defaults.

ParameterTypeRequiredDescription
stateobjectNoPartial device state with headset, inputMode, stereoEnabled, fov, controllers, hands

Browser

browser_screenshot

Capture a screenshot of the browser. Returns the image as inline base64 PNG.

Parameters: None

browser_get_console_logs

Get console logs from the browser with optional filtering. Excludes debug level by default.

ParameterTypeRequiredDescription
countnumberNoMaximum number of logs to return (most recent N)
levelstring or string[]NoFilter by level: log, info, warn, error, debug
patternstringNoRegex pattern to filter log messages
sincenumberNoReturn logs since this timestamp (ms since epoch)

browser_reload_page

Reload the browser page to reset application state.

Parameters: None

Scene Inspection

These tools require IWSDK's MCPRuntime (automatically available in IWSDK projects).

scene_get_hierarchy

Get the Three.js scene hierarchy as a JSON tree. Returns object names, UUIDs, types, and entity indices where available.

ParameterTypeRequiredDescription
parentIdstringNoUUID of parent Object3D to start from (defaults to scene root)
maxDepthnumberNoMaximum depth to traverse (default: 5)

scene_get_object_transform

Get local and global transforms of an Object3D. Includes positionRelativeToXROrigin which can be used directly with xr_look_at.

ParameterTypeRequiredDescription
uuidstringYesUUID of the Object3D (from scene_get_hierarchy)

ECS Debugging

These tools require IWSDK's MCPRuntime.

ecs_pause

Pause ECS system updates. The render loop continues (XR session stays alive, screenshots still work) but no systems tick.

Parameters: None

ecs_resume

Resume ECS system updates after pausing. The first frame uses a capped delta to avoid physics explosions.

Parameters: None

ecs_step

Advance N ECS frames with a fixed timestep while paused. Must call ecs_pause first.

ParameterTypeRequiredDescription
countnumberNoNumber of frames to advance (1-120, default: 1)
deltanumberNoFixed timestep in seconds (default: 1/72, matching Quest refresh rate)

ecs_query_entity

Get all component data for an entity.

ParameterTypeRequiredDescription
entityIndexnumberYesEntity index (from scene_get_hierarchy or ecs_find_entities)
componentsstring[]NoSpecific component IDs to include (defaults to all)

ecs_find_entities

Find entities by component composition and/or name.

ParameterTypeRequiredDescription
withComponentsstring[]NoComponent IDs entities must have (AND logic)
withoutComponentsstring[]NoComponent IDs entities must NOT have
namePatternstringNoRegex to match against entity Object3D name
limitnumberNoMaximum results (1-50, default: 50)

ecs_list_systems

List all registered ECS systems with name, priority, pause state, config keys, and query entity counts.

Parameters: None

ecs_list_components

List all registered ECS components with their field schemas (type and default value).

Parameters: None

ecs_toggle_system

Pause or resume a specific ECS system by name.

ParameterTypeRequiredDescription
namestringYesSystem class name (e.g., OrbSystem)
pausedbooleanNotrue to pause, false to resume. Omit to toggle.

ecs_set_component

Set a component field value on an entity.

ParameterTypeRequiredDescription
entityIndexnumberYesEntity index
componentIdstringYesComponent ID (e.g., Orb, Transform)
fieldstringYesField name within the component
valueanyYesNew value. Scalars: number/string/boolean. Vectors: array (e.g., [1,2,3] for Vec3).

ecs_snapshot

Capture a snapshot of all ECS entity/component state. Stores up to 2 snapshots.

ParameterTypeRequiredDescription
labelstringNoLabel for this snapshot (auto-generated if omitted)

ecs_diff

Compare two ECS snapshots. Shows added/removed/changed entities and field-level diffs.

ParameterTypeRequiredDescription
fromstringYesLabel of the "before" snapshot
tostringYesLabel of the "after" snapshot

Privacy | Terms