listTriggers
List user-defined triggers, with name search and optional timing, events, and definitions
List user-defined triggers on tables in a database. Internal constraint, foreign-key, and sqlite_* triggers are excluded. Results are paginated — see Cursor Pagination for the protocol. On MySQL/MariaDB and PostgreSQL the database parameter selects which database to inspect (defaults to the active database); SQLite operates on a single file and has no database parameter. PostgreSQL restricts the listing to the public schema.
The tool accepts these optional parameters:
cursor— opaque pagination token; pass back the prior response'snextCursorto fetch the next page.search— a case-insensitive substring filter on trigger name:auditmatchesaudit,audit_insert, andorders_audit. The value is wrapped as%audit%in aLIKE/ILIKEpattern, so%and_inside it still act as wildcards (_matches any single character). Thesearchvalue must remain identical across paginated calls for cursor continuity.detailed— whentrue, the response includes per-trigger metadata (timing, events, fullCREATE TRIGGERtext, and backend-specific extras) so a single call enumerates triggers and inspects them. Defaults tofalse.
In brief mode (default) the response shape is:
{
"entries": ["customers_audit_after_insert", "orders_audit_after_insert", "set_updated_at"],
"nextCursor": "<opaque or absent>"
}In detailed mode the response is keyed by trigger name. The PostgreSQL payload is the richest:
{
"entries": {
"orders_audit_after_iu": {
"schema": "public",
"table": "orders",
"status": "ENABLED",
"timing": "AFTER",
"events": ["INSERT", "UPDATE"],
"activationLevel": "ROW",
"functionName": "audit_orders",
"definition": "CREATE TRIGGER orders_audit_after_iu AFTER INSERT OR UPDATE ON public.orders FOR EACH ROW EXECUTE FUNCTION public.audit_orders()"
}
}
}The detailed-mode field set diverges per backend:
- PostgreSQL —
schema(always"public"),table,status(ENABLED/DISABLED/REPLICA/ALWAYS),timing(BEFORE/AFTER/INSTEAD OF),events(non-empty subset ofINSERT/UPDATE/DELETE/TRUNCATEin that fixed order),activationLevel(ROW/STATEMENT),functionName(handler function),definition(full output ofpg_get_triggerdef). - MySQL / MariaDB —
schema,table,timing(BEFORE/AFTER),events(always single-element:["INSERT"],["UPDATE"], or["DELETE"]),activationLevel(always"ROW"),definition(reconstructedCREATE DEFINER=…TRIGGER…FOR EACH ROW…), plus the session context active at trigger-creation time:sqlMode,characterSetClient,collationConnection,databaseCollation.statusandfunctionNameare absent — MySQL/MariaDB has no per-trigger enabled flag and no separate handler function (the body is inline). - SQLite —
schema(always"main"),table(may be a view name forINSTEAD OFtriggers), anddefinition(the originalCREATE TRIGGERtext fromsqlite_schema.sql, byte-for-byte). All other fields are absent — SQLite's catalogue does not exposetiming,events,activationLevel, etc. as columns; clients that need those keywords can read them off the prefix ofdefinition. Triggers whosesqlite_schema.sqlisNULL(rare; extension-generated rows or hand-edited catalogues) are silently omitted from detailed mode but still listed by name in brief mode.