DBTrail
Claude Integration

Tools Reference

Complete reference for the tools available to Claude via the bintrail-mcp server

Six read-only tools. Look: query, status, list_schema_changes. Undo: recover and recover_cascade, SQL text you review and that is never executed. Time travel: reconstruct, a row at a moment, needs a backup for that server.

All tools are annotated ReadOnlyHint and IdempotentHint, read the index, and never touch the source database.

Web interface /mcp (setup)Standalone bintrail-mcp
ConnectionThe web interface owns it; index_dsn rejectedBINTRAIL_INDEX_DSN or per-call index_dsn
Server/mcp default, /mcp/{name} one serverOne DSN per call
profileRejectedAccepted
baseline_dir / baseline_s3Rejected; uses the server's backupAccepted, or BINTRAIL_BASELINE_DIR / _S3
LimitsWeb interface result capsEnv-tunable query ceiling, recover uncapped

Transport and flags: MCP server reference. Times accept YYYY-MM-DD HH:MM:SS or RFC 3339. Composite keys are pipe-delimited: 123|2.

query

Search indexed changes. Returns before and after images, timestamps, metadata; merges live index and Parquet archives.

ParameterNotes
schema, table
pk / pksOne key or several (pks needs schema and table; exclusive with pk)
pk_min, pk_maxInteger range, one integer key column only; pair with since/until
limit_per_pkLatest N events per key; needs pk or pks
event_typeINSERT, UPDATE, DELETE
gtide.g. uuid:42
since, until
changed_columnUPDATEs that modified this column
query_hashEvery execution of one statement shape; not on surfaces that withhold statement text
column_eqArray of column=value, AND-ed; literal NULL matches JSON null
flagTables or columns carrying this flag
formatjson (default), table, csv
limitDefault 100
orderASC (default, keeps oldest) or DESC (keeps newest; use for "last N")
profileStandalone only
no_archiveSkip Parquet archives

recover

Reversal SQL, dry-run only: BEGIN/COMMIT, newest change first. DELETE → INSERT, UPDATE → reverse UPDATE, INSERT → DELETE.

Parameters: the query filters except changed_column, query_hash, format and order (reversing a filtered subset of a row's history could produce a state that never existed). limit defaults to 1000.

Transport parameterNotes
summary_onlyStatement count and script size, no SQL
sql_offset, sql_limitFetch a large script in statement-aligned chunks that concatenate into the exact script

A script over the response size limit is not returned whole: the result is a JSON summary with the statement count and how to page it.

recover_cascade

Reversal SQL for rows changed by a foreign-key ON DELETE / ON UPDATE CASCADE or SET NULL, which InnoDB applies below the binlog. Dry-run only.

ParameterNotes
schema, tableParent table (required)
pk / pksChanged parent keys; exclusive
since, untilParent changes in the window
lookbackHow far back to search child state (default 30d)
max_depthParent → child → grandchild (default 5)
limitParent events, applied separately to DELETE and UPDATE scans (default 1000)
allow_incompleteReturn a provably partial script instead of failing
baseline_dir, baseline_s3Standalone: enables the backup fallback
summary_only, sql_offset, sql_limitSame as recover

Result: SQL plus counts (parents, children re-inserted, SET NULL and key restores), incomplete (why it is partial), warnings, and complete (incomplete is empty).

status

Indexed binlog files, partition layout with estimated row counts, event summary. No parameters besides index_dsn (standalone).

list_schema_changes

CREATE, CREATE OR REPLACE, ALTER, DROP, RENAME, TRUNCATE with statement, time, binlog file, position, GTID and covering snapshot_id (null = no snapshot after it). Newest first; same-second changes by binlog file and position.

ParameterNotes
schema, table, since, until
ddl_typePrefix match, e.g. ALTER. CREATE also matches MariaDB's CREATE OR REPLACE TABLE; CREATE TABLE does not
limitDefault 100
uncovered_onlyOnly changes with no covering snapshot, excluding TRUNCATE

Same history in the web interface: Investigate → Schema changes.

reconstruct

One row's full state at a moment: backup plus the events after it, so columns never touched in the window still resolve. Needs a backup.

ParameterNotes
schema, table, pkRequired
atDefault now
historyEvery state transition from the backup to at
allow_gapsProceed over missing history; what was overridden comes back in warnings
baseline_dir, baseline_s3Standalone only

Result: state, baseline_time, event_count, and the three outcomes: the state, deleted: true, or found: false (no backup row for that key).

Access control

profile on query or recover (standalone) applies table denies and column redaction, authored in Settings → Access profiles or with bintrail flag / bintrail profile / bintrail access. An active profile disables archive routing.

On this page