Database

Register the native iOS database tool suite to discover SQLite databases, inspect schema, and run read-only queries.

Install

Published pod: AnsightToolsDatabase.

SwiftPM:

.product(name: "AnsightToolsDatabase", package: "ansight-sdk")

CocoaPods:

pod 'AnsightToolsDatabase', '1.0.2-preview.1'

Register the Suite

import AnsightCore
import AnsightToolsDatabase

try AnsightRuntime.shared.registerDatabaseTools()

Configure roots when the default platform roots are not enough:

let database = AnsightDatabaseToolsOptions.createBuilder()
    .addRoot(alias: "fixtures", path: "/path/to/db-fixtures")
    .build()

try AnsightRuntime.shared.registerDatabaseTools(options: database)

Registration API

  • registerDatabaseTools(options:): registers SQLite discovery, schema, and read-only query tools.
  • AnsightDatabaseToolsOptions.createBuilder(): creates a suite options builder.
  • addRoot(alias:path:): exposes an additional approved database root.
  • includePlatformRoots(...): controls whether standard app roots are searched.

Specific Concerns

  • The suite is SQLite-focused.
  • Query execution is read-only.
  • Schema and query results can expose sensitive user or app data.
  • Paths are constrained to approved roots.

Tool Matrix

NameIdScopeDescriptionSecurity
List Databasesdata.list_databasesReadLists inspectable SQLite databases.Moderate
Describe Schemadata.describe_schemaReadReturns schema metadata for a database or table.Moderate
Query Databasedata.queryReadExecutes a constrained read query.High

Tool Details

List Databases

Use data.list_databases to discover SQLite databases under the configured roots.

Describe Schema

Use data.describe_schema with a database path and optional table filter to inspect tables and columns.

Query Database

Use data.query with a database path, read-only SQL statement, and row limit to inspect data.