get_database_schema
Retrieves an entire database schema as JSON or a self-contained SQL DDL script, so you can inspect structure or recreate tables, keys, indexes, and triggers.
Instructions
Get the whole database's schema at once, as JSON or as a runnable SQL script.
format="json" (default): every table with columns, types, nullability, primary key, and foreign keys. format="sql": a SELF-CONTAINED DDL script that recreates the schema — tables, columns, sequences, PK/FK/UNIQUE/CHECK, indexes, trigger functions, and triggers — so running it rebuilds the structure. No extra tools needed; covers the common cases (for a byte-faithful dump use dump_schema_faithful).
Output is deterministic. Returned inline by default; pass output_dir to instead WRITE
it to {database}_schema_{UTC}.{json|sql} and get back the path plus a summary —
recommended for large schemas too big to return inline.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"database": "<database>"
},
"name": "get_database_schema"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | json | |
| database | Yes | ||
| output_dir | No |