Reference

Every tool and prompt pg_licht 4.3.3 offers: 68 read-only tools in 10 groups, and 12 guided prompts. Each page is generated from the binary itself.

Privileges

Schema exploration

Catalog search

Cluster-wide objects

Extensibility and text search

Foreign data and replication

Monitoring and statistics

Diagnostics and query planning

Topology

Connections

Prompts

Arguments every tool takes

connection optional
Which configured connection to ask. Omitted, the default one. One server holds any number of connections, so this is how a single pg_licht answers for a whole fleet.
instance, replication_group, group optional
Ask every member of a topology label instead, and get one result per member in configuration order. Offered only by tools whose answer really differs across that set: an instance-wide reading is not swept across the databases of one postmaster, and a catalog read is not swept across replicas that are byte-identical.
role optional
With a sweep, only members observed right now to be primary or replica.

These five names are read by the server itself, out of the arguments of every call. A tool that declares an argument of its own by one of those names keeps it — roleDependencies takes a role, naming the role to ask about — and cannot be targeted by that selector. The tool's argument wins, in its published schema and in the call alike.

Privileges

ToolWhat it answers
checkPrivilegesReport which tools the current role can actually use on this connection, and how the rest fall short.
roleDependenciesReturn what depends on one role, cluster-wide, from pg_shdepend.
defaultPrivilegesReturn ALTER DEFAULT PRIVILEGES entries (pg_default_acl): what grants the NEXT object of each type will get, per granting role and per schema.
checkRoleAccessAnswer whether one role holds privileges on one table, view, sequence, function or procedure -- as PostgreSQL evaluates it, via has_table_privilege and its relatives, so role inheritance, grants to PUBLIC, ownership and superuser are all folded in the way the server folds them…

Schema exploration

ToolWhat it answers
listSchemasReturn schema list with basic summaries: table_count, up to 25 table names, and role grants per schema.
listTablesReturn the structure of every table, view and materialised view in a schema: kind, comment, storage options, columns and their per-column index counts, index count and constraint count.
tableDetailsReturn the structure of one table: columns with types, defaults, storage and compression, primary key, indexes with their definition and whether each is valid, constraints, foreign keys, inbound foreign keys (referenced_by), triggers with their enabled state, rules, row-level… data values
tableStatsReturn the statistics PostgreSQL keeps for one table: estimated row count, seq_scan and idx_scan counts, live and dead tuples, rows modified since the last analyze, rows inserted since the last vacuum, the manual and automatic vacuum and analyze times as four separate fields… data values
largeObjectsReturn how many large objects this database holds and who owns them (pg_largeobject_metadata).
listPartitionsReturn every partitioned table in a schema with its partitioning strategy (range/list/hash), the partition key, how many partitions it has, the combined estimated row count and size of every leaf partition at any depth (a sub-partitioned child holds nothing itself), whether a…
partitionDetailsReturn one partitioned table with every partition: its bound expression verbatim, whether it is the DEFAULT, whether it is itself partitioned, estimated rows and size (both null, not 0, for a partition never analyzed), and the per-partition live/dead tuples, scan counters and…
listTableStatsReturn the statistics PostgreSQL keeps for every table in a schema: estimated row count, seq_scan and idx_scan counts, live and dead tuples, rows modified since the last analyze, rows inserted since the last vacuum, and the manual and automatic vacuum and analyze times as four…
tableSizeMeasure one table on disk: main fork, total table size including TOAST and the free space and visibility maps, index size, grand total, the TOAST relation and each index individually.
listTableSizesMeasure every table in a schema on disk: table size, index size and grand total per relation.
listFunctionsReturn function and procedure list for a schema.
functionDetailsReturn detailed function or procedure info including source and trigger usage. data values
listEnumsReturn enum type list for a schema with their values and descriptions.
enumDetailsReturn enum type details including values and which columns use it.
listTypesReturn composite type, domain, and range type list for a schema (excludes enums and implicit table/view row types); composites include their attribute list, domains include base type/nullability/default/constraints, ranges include subtype and the auto-generated multirange type…
typeDetailsReturn composite type, domain, or range type details including attributes/constraints/subtype and which columns use it.
columnHistogramReturn the whole value distribution of one column: the most common values with their frequencies, and the full histogram of everything else. data values
listExtendedStatisticsReturn extended statistics objects (CREATE STATISTICS) for a schema with target table, columns, the statistics kinds declared (ndistinct, dependencies, mcv, expressions), and description -- plus whether they have actually been BUILT.
listSequencesReturn sequence list for a schema with type, range, increment, cycle, cache, current value, and owning table.column (for SERIAL/IDENTITY columns).
ToolWhat it answers
searchTablesFind tables across every non-system schema by full-text search over table names, comments, column names and comments, enum labels and grantee names, and return their structure.
searchFunctionsSearch functions and procedures by name, source, language, trigger name, or description.
searchEnumsSearch enum types by name, values, or description.

Cluster-wide objects

ToolWhat it answers
listRolesReturn cluster-wide roles with kind (login/group), attributes (superuser, create_role, create_db, replication, bypass_rls, connection_limit, valid_until), and group memberships.
listTablespacesReturn cluster-wide tablespaces with owner, filesystem location, options, and description.
listEventTriggersReturn cluster-wide event triggers with event type, tags, function, owner, enabled status, and description.
listLanguagesReturn procedural languages installed in the current database (e.g. plpgsql, plpython3u) with owner, trusted/procedural flags, handler function, and description.
listAccessMethodsReturn index and table access methods available in the cluster (btree, gist, gin, heap, etc) with type and handler function.
listCastsReturn type casts involving at least one user-defined type (excludes built-in-to-built-in casts) with source/target types, context (implicit/assignment/explicit), and method.
listExtensionsReturn installed PostgreSQL extensions with version, schema, relocatable flag, and description.
ToolWhat it answers
listCollationsReturn collations usable in the current database's encoding for a schema, with provider, locale settings, and determinism flag.
listOperatorsReturn custom operators in a schema with left/right operand types, result type, and implementing function; mostly relevant for schemas using extensions with custom types (e.g. PostGIS).
listOperatorClassesReturn operator classes in a schema with their index access method, input type, and default flag; describes what index types (btree/gist/gin/etc) a type supports.
listTextSearchConfigsReturn full-text search configurations for a schema with parser and the token-type-to-dictionary mapping.

Foreign data and replication

ToolWhat it answers
replicationStatsReturn every WAL sender on this server (pg_stat_replication) with its state, sync_state, sent/write/flush/replay LSNs, the byte gap to replay (on a cascading standby, measured from the WAL it has received), and write_lag/flush_lag/replay_lag as SECONDS -- plus replication…
listForeignTablesReturn foreign tables in a schema with their foreign server, FDW, options, and columns (does not expose user mapping credentials).
listForeignServersReturn cluster-wide foreign servers with their FDW, owner, and options (host/port/dbname-style options only, never user mapping credentials).
listPublicationsReturn logical replication publications with owner, all-tables flag, per-operation flags (insert/update/delete/truncate), table_count, up to 50 member table names, and on PostgreSQL 15+ the schemas published wholesale via FOR TABLES IN SCHEMA.
listSubscriptionsReturn logical replication subscriptions for the current database with owner, enabled status, publications, slot name, and sync settings (never exposes the connection string, which may contain credentials).
subscriptionStatsReturn the runtime state of every logical replication subscription in this database: each worker with its type, pid, the relation it is syncing and how long since it last heard from the publisher; per-table sync state, with the tables that are not yet ready listed individually…
replicationSlotsReturn replication slots with retained WAL bytes; a lagging or unused slot holds back WAL indefinitely and is a common cause of disk bloat incidents.

Monitoring and statistics

ToolWhat it answers
diskUsageReport what PostgreSQL is holding on disk without needing a shell on the server: WAL directory size and file count, the archive status backlog, temporary files currently on disk, log directory size, per-tablespace sizes and per-database sizes across the whole cluster.
databaseSizeReturn the current database name and its total disk size.
serverSettingsReturn PostgreSQL server settings (pg_settings) grouped by category, each with current value, unit, description, context, type, source, and pending_restart flag. data values
currentActivityReturn current server connections and running queries (pg_stat_activity) across all databases: pid, database, user, application_name, backend_type, state, wait event, query text, transaction and query duration, leader_pid for parallel workers, and the backend's xid and xmin. data values
currentLocksReturn current locks (pg_locks) joined with the holding backend's query and user, plus which pids are blocking each waiting lock; use to diagnose lock contention. data values
databaseStatsReturn per-database statistics (pg_stat_database) for every database in the cluster: connections, commits/rollbacks, block hit ratio inputs, tuple counts, conflicts, deadlocks, temp file usage, and checksum failures.
statementStatsReturn tracked queries from pg_stat_statements under 'statements', with calls, timing, row counts, buffer usage, temporary block I/O and WAL volume, alongside an 'info' block from pg_stat_statements_info whose dealloc counter says whether entries are being evicted -- if it is… data values
wraparoundStatusReturn transaction id and multixact wraparound headroom: age(datfrozenxid) and age(datminmxid) for every database, the oldest tables by age(relfrozenxid) including TOAST tables (often the relation actually holding the horizon back), each xid and multixact age as a percentage of…
progressStatsReturn every long-running maintenance command currently reporting progress (pg_stat_progress_vacuum, _analyze, _create_index, _cluster, _copy, _basebackup), with the phase, the blocks or tuples done against the total, a completion percentage, and how long it has been running.
ioStatsReturn cumulative I/O statistics under 'io', per backend type, object and context (pg_stat_io, PostgreSQL 16+): reads, writes, extends, hits, evictions, reuses, fsyncs and their timings, with a hit percentage.
checkpointStatsReturn checkpoint, WAL, and background writer activity (pg_stat_checkpointer and pg_stat_bgwriter on PostgreSQL 17+, pg_stat_bgwriter alone before that, plus pg_stat_wal) with field names normalized across both shapes: timed versus requested checkpoint counts and the ratio…
tableIOStatsReturn per-object buffer cache hit ratios (pg_statio_all_tables): heap_blks_read versus heap_blks_hit, idx_blks_read versus idx_blks_hit, the TOAST and TOAST-index pairs, and a combined ratio, with relation size and scan counts.
hostCapacityCorrelate memory and parallelism settings with the capacity of the machine PostgreSQL runs on.
bufferCacheSummaryReturn how much of shared_buffers is used, dirty and pinned, with the usage-count histogram from pg_buffercache.
bufferCacheContentsReturn which relations own shared_buffers, aggregated per relation and fork and ranked by buffers held: cached bytes, percent of that fork resident, percent of shared_buffers consumed, dirty buffers, average usagecount and pins.

Diagnostics and query planning

ToolWhat it answers
evaluateIndexPlan a statement as if the indexes were different, using hypopg. data values
duplicateIndexesReturn indexes that duplicate or are covered by another index on the same table.
tableBloatReturn physical storage bloat for a table (pgstattuple/pgstattuple_approx): table size, live/dead tuple counts and percentages, free space and percentage.
indexBloatReturn physical statistics for one index, from whichever pgstattuple function matches its access method: pgstatindex for btree (tree level, leaf/internal/empty/deleted pages, average leaf density, leaf fragmentation), pgstatginindex for GIN (pending list pages and tuples…
checkKeyCheck if a row exists by primary key; validates value types against the PK column types before querying.
explainQueryReturn the raw EXPLAIN (FORMAT JSON) plan for a statement, either recovered from pg_stat_statements by queryid (full untruncated text) or supplied directly as sql. data values

Topology

ToolWhat it answers
verifyTopologyConnect to every configured connection and report what each server actually is: its role (primary or replica, from pg_is_in_recovery(), observed now rather than configured), its system identifier, database, address, port and version -- then check the declared topology against…
listTopologyReturn the configured topology: which connections share an instance (one postmaster, so they share shared_buffers, WAL, autovacuum workers and disk), which belong to the same replication_group (a primary and its replicas, holding the same data on different servers), and which…

Connections

ToolWhat it answers
listConnectionsReturn the configured database connections by name, with the libpq service name or host/port/dbname/user for each, its instance, replication_group and group labels where configured, and which is the default; passwords are never returned and a service file is never expanded.

Prompts

A prompt is a ready-made investigation: the client inserts its text as the opening message, and the model works through the tools it names.

PromptWhat it works out
diagnose-slow-queryTrace a slow statement from pg_stat_statements to a plan and a fix.
triage-lock-contentionFind what is blocking what, and who to look at first.
diagnose-deadlockWork out why a logged deadlock happened, from the log entry plus the schema.
triage-active-sessionsFind why a server is running more sessions at once than it has CPUs to run them on.
triage-disk-spaceFind what is filling the disk, and what can safely be freed right now.
bloat-and-vacuum-reviewDecide whether bloat is real, and whether autovacuum is keeping up.
buffer-cache-reviewSee what is occupying shared buffers and whether it is the right thing.
capacity-checkCheck memory and parallelism settings against the machine.
replication-slot-reviewFind what a replication slot is holding back, and what it costs to release it.
plan-schema-changeChoose how to apply a DDL change by measuring the table it targets.
check-role-accessWork out whether a role can use a table, view, function or procedure, and which rows.
explain-and-fixExplain one statement, establish why it is slow, and propose a fix that is verified rather than guessed.