See the native app state behind the UI
Inspect exposed native runtime objects in your React Native app to understand the state driving its behavior.
Reflection tools let you examine exposed runtime objects when a screen alone does not explain an app’s behavior. Keep roots and traversal narrow, and enable inspection, mutation, or invocation only under the required tool policy. This inspects supported native iOS and Android roots, not arbitrary JavaScript objects.
Register the Suite
await Ansight.initializeAndActivate(
Ansight.createOptionsBuilder()
.withReflectionTools({
includeBuiltInRoots: true,
allowedRootIds: ["application"],
allowedTypePrefixes: ["com.example."],
})
.withReadOnlyToolAccess()
.build(),
);
The read-only guard enables reflect.list_roots and reflect.describe_type. Inspecting live native object values, setting members, or invoking methods uses Critical and requires withAllToolAccess() for that local development workflow.
Registration API
withReflectionTools(options): configures native reflection tool options.remoteTools.reflection.includeBuiltInRoots: includes supported native built-in roots.remoteTools.reflection.allowedRootIds: restricts roots.remoteTools.reflection.allowedTypePrefixes: restricts type traversal.
Specific Concerns
- Reflection can expose private native state, model graphs, and user data.
- Built-in root availability depends on the native platform.
- List and describe use
read; inspect, set, and invoke usecriticalbecause they can disclose sensitive state or execute arbitrary native app code.
Tool Matrix
| Name | Id | Policy | Description |
|---|---|---|---|
List Reflection Roots | reflect.list_roots | Read | Lists registered or built-in native reflection roots. |
Inspect Object | reflect.inspect_object | Critical | Returns a snapshot of a native root or nested path. |
Describe Type | reflect.describe_type | Read | Returns native runtime type metadata. |
Set Member Value | reflect.set_member_value | Critical | Writes through supported native reflection paths. |
Invoke Method | reflect.invoke_method | Critical | Invokes through supported native reflection paths. |
Tool Details
Use read tools to list native roots and describe types. Object snapshots, mutation, and invocation require critical access, even when an inspection does not change app state. Keep roots and type traversal narrowly scoped when enabling withAllToolAccess(); platform support still determines which operations each root provides.
Root descriptors returned by reflect.list_roots include hostRuntime, which identifies the runtime that owns the root. Current React Native reflection roots are native roots, so they report the iOS swift or Android jvm host runtime. JavaScript-hosted roots should report kind: "javascript" and bridge: "react-native" so clients can route reflection commands across the React Native runtime boundary deliberately.