Tools

Add React Native native tool suites, React inspection tools, artifact providers, JavaScript custom tools, or native custom tools, gate them with ToolGuard, and keep them limited to local development workflows.

React Native exposes native tool suites from iOS and Android plus JavaScript-backed and native custom tools registered in app code.

Important Security Rule

Do not ship broad native tools, JavaScript custom tools, or React action tools in App Store, Play Store, CI release, or other distributable builds unless the capability is explicitly approved.

Do this:

  • enable broad tools only behind an app-owned local development condition
  • use the narrowest guard that works for the workflow
  • keep React props, state, actions, secure storage, and file-system access opt-in

Do not do this:

  • ship fullAccess broadly
  • enable React actions unless a workflow explicitly needs them
  • expose secret, file, or runtime mutation tools without allow-lists

Native Tool Registration

The native bridge registers FileSystem, Database, Preferences, Reflection, and SecureStorage suites during initialization. VisualTree is opt-in because it exposes rendered UI structure and screenshots. Suite-specific options flow through remoteTools.

await Ansight.initializeAndActivate(
  Ansight.createOptionsBuilder()
    .withReadOnlyToolAccess()
    .withVisualTreeTools()
    .withDatabaseTools({
      includePlatformRoots: true,
      additionalRoots: [{ alias: "fixtures", path: "/tmp/app-db" }],
    })
    .withFileSystemTools({
      additionalRoots: [{ alias: "exports", path: "/tmp/app-exports" }],
    })
    .withPreferencesTools({
      allowedStores: ["standard"],
      allowedKeyPrefixes: ["debug."],
    })
    .withReflectionTools({
      includeBuiltInRoots: true,
      allowedRootIds: ["application"],
      allowedTypePrefixes: ["com.example."],
    })
    .withRemoteTools({
      secureStorage: {
        allowedKeys: ["debug_token"],
        allowedKeyPrefixes: ["debug."],
      },
    })
    .build(),
);

secureStorage.preferencesName is Android-specific. secureStorage.appleService is iOS-specific. The top-level secureStorage option is accepted as a compatibility alias for remoteTools.secureStorage.

Suite Registration API

SurfaceCommon API
VisualTreewithVisualTreeTools(), remoteTools.visualTree
Native DatabasewithDatabaseTools(...), remoteTools.database
Native FileSystemwithFileSystemTools(...), remoteTools.fileSystem
Native PreferenceswithPreferencesTools(...), remoteTools.preferences
Native SecureStoragewithRemoteTools({ secureStorage: ... }), remoteTools.secureStorage, top-level secureStorage alias
Native ReflectionwithReflectionTools(...), remoteTools.reflection
React InspectioninstallReactTools(...), uninstallReactTools()
JavaScript Custom ToolsregisterTool(...), unregisterTool(...), listRegisteredTools(), clearRegisteredTools()
Native Custom ToolsiOS AnsightRuntime.shared.registerTool(...), Android AnsightRuntime.registerTool(...)
ArtifactsregisterArtifactProvider(...), registerArtifactProviders(...), unregisterArtifactProvider(...), clearArtifactProviders()

Guard Levels

GuardWhat it allows
withToolsDisabled() / "disabled"No discovery, no execution.
withReadOnlyToolAccess() / "readOnly"Read-scoped tools only.
withReadWriteToolAccess() / "readWrite"Read and write tools. Delete tools remain blocked.
withAllToolAccess() / "fullAccess"Read, write, and delete tools.

Tool Suites

Native tool ids match the underlying iOS and Android SDKs. Artifacts are documented separately in Artifacts.

SuiteTypical use
VisualTreeInspect native hierarchy, capture screenshots, and manage overlays.
DatabaseDiscover SQLite databases, inspect schema, and run read-only queries.
FileSystemList directories, read files, download files, push, copy, move, and delete files inside approved roots.
PreferencesRead and mutate native preferences under store/key allow-lists.
SecureStorageRead and mutate native secure storage under explicit key allow-lists.
ReflectionInspect native registered roots and built-in roots according to platform support and options.
React InspectionInspect React Fiber component trees, React Native host trees, navigation state, and optional component actions.
JavaScript Custom ToolsExpose narrow app-specific development operations.
Native Custom ToolsExpose narrow app-specific Swift or Kotlin operations.

For most teams:

  1. Start with installReactTools(...) without props, state, or actions.
  2. Use withReadOnlyToolAccess() by default.
  3. Add native VisualTree only when Studio needs platform view hierarchy or native screenshots.
  4. Add Database only when SQLite inspection is needed.
  5. Add FileSystem, Preferences, or SecureStorage only for a specific debugging workflow.
  6. Add Artifacts when app-specific output should become a streamed file or durable session artifact.
  7. Add JavaScript or native custom tools only for narrow operations that packaged suites cannot cover.
  8. Add React actions, native writes, and delete-scoped tools only when the workflow genuinely depends on them.