Tools

Add native iOS remote tool suites, artifact providers, or custom app tools, gate them with the iOS build opt-in and ToolGuard, and keep them limited to local development workflows.

Remote tools let Ansight Studio and MCP clients inspect or operate on a paired iOS app. Keep them scoped to local development and QA builds.

Important Security Rule

Do not ship native tool suites in TestFlight, App Store, CI release, or other distributable builds unless the capability is explicitly approved.

Do this:

  • add the aggregate Ansight product or individual tool products only to local development builds
  • set ANSIGHT_ALLOW_REMOTE_TOOLS=true only for those local builds
  • use the narrowest runtime guard that works for the workflow

Do not do this:

  • ship tool products in distribution builds
  • leave ANSIGHT_ALLOW_REMOTE_TOOLS=true in shared release configuration
  • expose write or delete tools when read-only inspection is enough

Build-Time Opt-In

export ANSIGHT_ALLOW_REMOTE_TOOLS=true

Without this local-development opt-in, the SwiftPM build tool and CocoaPods build phase fail when they detect concrete AnsightTool implementations.

Runtime Registration

The aggregate Ansight product registers the standard native tool suites for you:

import Ansight

let options = try AnsightOptions.createBuilder(.ansightDeveloperDefaults)
    .withReadOnlyToolAccess()
    .build()

try AnsightRuntime.shared.initializeAndActivateAnsightSdk(options: options)

Core-only apps can register suites directly:

import AnsightCore
import AnsightToolsDatabase
import AnsightToolsFileSystem
import AnsightToolsPreferences
import AnsightToolsReflection
import AnsightToolsSecureStorage
import AnsightToolsVisualTree

try AnsightRuntime.shared.registerVisualTreeTools()
try AnsightRuntime.shared.registerDatabaseTools()
try AnsightRuntime.shared.registerFileSystemTools()
try AnsightRuntime.shared.registerPreferencesTools()
try AnsightRuntime.shared.registerReflectionTools()
try AnsightRuntime.shared.registerSecureStorageTools()

Registered tools stay hidden and unusable until toolGuard allows their scope.

Suite Registration API

SuiteProductCommon registration API
VisualTreeAnsightToolsVisualTreeregisterVisualTreeTools()
DatabaseAnsightToolsDatabaseregisterDatabaseTools(options:), AnsightDatabaseToolsOptions.createBuilder(), addRoot(alias:path:), includePlatformRoots(...)
FileSystemAnsightToolsFileSystemregisterFileSystemTools(options:), AnsightFileSystemToolsOptions.createBuilder(), addRoot(alias:path:)
PreferencesAnsightToolsPreferencesregisterPreferencesTools(options:), AnsightPreferencesToolOptions(defaultStore:allowedStores:allowedKeys:allowedKeyPrefixes:)
SecureStorageAnsightToolsSecureStorageregisterSecureStorageTools(options:), AnsightSecureStorageToolsOptions.createBuilder(), withStorageIdentifier(...), withAppleService(...), allowKey(...), allowKeyPrefix(...)
ReflectionAnsightToolsReflectionAnsightReflectionRootRegistry.register(...), registerGetter(...), deregister(...), clear(), registerReflectionTools(options:), AnsightReflectionToolsOptions.createBuilder(), allowRoot(...), allowTypePrefix(...)
Custom Toolsapp coderegisterTool(_:), registerTool(_:replaceExisting:), isToolRegistered(...)
ArtifactsAnsightCore / AnsightregisterArtifactProvider(...), registerArtifactProviders(...), unregisterArtifactProvider(...), clearArtifactProviders()

Guard Levels

GuardWhat it allows
withToolsDisabled() / .disabledNo discovery, no execution.
withReadOnlyToolAccess() / .readOnlyRead-scoped tools only.
withReadWriteToolAccess() / .readWriteRead and write tools. Delete tools remain blocked.
withAllToolAccess() / .fullAccessRead, write, and delete tools.

Tool Suites

Artifacts are a core provider model rather than a separate native tool package. Registering an artifact provider adds the read-scoped artifacts.query and artifacts.request tools. See Artifacts.

SuiteProductTypical use
VisualTreeAnsightToolsVisualTreeInspect the foreground UIKit hierarchy, capture screenshots, and manage diagnostic overlays.
DatabaseAnsightToolsDatabaseDiscover SQLite databases, inspect schema, and run read-only queries.
FileSystemAnsightToolsFileSystemList directories, read files, download files, push, copy, move, and delete files inside approved roots.
PreferencesAnsightToolsPreferencesRead and mutate UserDefaults values under store/key allow-lists.
SecureStorageAnsightToolsSecureStorageRead and mutate Keychain values under explicit key allow-lists.
ReflectionAnsightToolsReflectionInspect explicitly registered live object roots and optionally call root-owned mutation/invocation adapters.
Custom Toolsapp codeExpose narrow app-specific development operations.

For most teams:

  1. Start with VisualTree and Database.
  2. Use .readOnly by default.
  3. Add FileSystem, Preferences, or SecureStorage only for a specific debugging workflow.
  4. Add Reflection only after registering narrow roots and type/root filters.
  5. Add Artifacts when app-specific output should become a streamed file or durable session artifact.
  6. Add Custom Tools only for narrow operations that packaged suites cannot cover.
  7. Keep write and delete operations off unless the workflow genuinely depends on them.