describe_postgres_schema
Inspect a PostgreSQL schema and return its full structure as JSON, including columns, foreign keys, and indexes for accurate query writing.
Instructions
Inspect a PostgreSQL schema and return its full structure as JSON.
Call this before writing any query, JOIN, or EXPLAIN — it gives you exact table/column names and indexes so you don't guess.
Returns a JSON object:
"columns": table_name, column_name, data_type, is_nullable, column_default
"foreign_keys": which columns reference which tables (use for JOINs)
"indexes": full CREATE INDEX definitions (check before running EXPLAIN)
Large schemas (100+ tables) return a lot of JSON — filter by table_name client-side rather than calling this multiple times.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |