Database

Register the database tool suite to discover SQLite databases, inspect schema, and run read-only queries inside the app sandbox.

Install

dotnet add package Ansight.Tools.Database

Register the Suite

using Ansight;
using Ansight.Tools.Database;

var options = Options.CreateBuilder()
    .WithDatabaseTools()
    .WithReadOnlyToolAccess()
    .Build();

Registration API

  • WithDatabaseTools(): registers the SQLite discovery, schema, and read-only query tools. No suite-specific configuration is currently required.

Specific Concerns

  • The suite is SQLite-focused.
  • Paths must stay inside approved sandbox roots.
  • Query execution is read-only by design.
  • Schema and query results can expose sensitive user or app data.

Default search roots include:

  • Android: appData, cache, temp
  • iOS and Mac Catalyst: appData, documents, cache, temp

Tool Matrix

NameIdScopeDescriptionSecurity
List Databasesdata.list_databasesReadLists the known app databases that can be inspected.Moderate
Describe Schemadata.describe_schemaReadReturns schema metadata for a database or table.Moderate
Query Databasedata.queryReadExecutes a constrained read query against an app database.High

List Databases

Arguments:

  • includeSystemStores: include cache and system-store databases
  • maxResults: maximum number of matches

Returns:

  • databases
  • truncated
  • capturedAtUtc

Example:

{
  "toolId": "data.list_databases",
  "arguments": {
    "includeSystemStores": false,
    "maxResults": 100
  }
}

Describe Schema

Arguments:

  • path: required absolute or sandbox-relative database path
  • database: alternate field name for the same path
  • table: optional table filter

Returns:

  • databasePath
  • tables
  • capturedAtUtc

Example:

{
  "toolId": "data.describe_schema",
  "arguments": {
    "path": "my-app.db",
    "table": "users"
  }
}

Query Database

Arguments:

  • path: required absolute or sandbox-relative database path
  • database: alternate field name for the same path
  • sql: required read-only SQL statement
  • maxRows: maximum rows to return, default 100

Returns:

  • databasePath
  • sql
  • columns
  • rows
  • truncated
  • capturedAtUtc

Example:

{
  "toolId": "data.query",
  "arguments": {
    "path": "my-app.db",
    "sql": "select id, email from users order by created_at desc limit 20",
    "maxRows": 20
  }
}