get_schema
Discover database structure by listing tables, columns, foreign keys, and indexes. Supports ERD diagram generation with Mermaid format.
Instructions
Discover database schema - tables, columns, relationships, indexes.
LEVEL: Database (lists all schemas) or Schema (specific schema details)
USE FOR: listing tables, columns, foreign keys, ERD generation. DO NOT USE FOR: table data (execute_query), index health (maintenance_analysis).
ERROR RECOVERY:
"schema not found": Call get_schema() without params to list all schemas
"no tables found": Schema exists but is empty, verify with execute_query
"not connected": Call connect() first or pass url parameter
PAGINATION: For large schemas (100+ tables), use limit/offset.
Examples: get_schema() - List all schemas get_schema(schema='public') - Tables in public get_schema(schema='public', limit=50, offset=50) - Page 2 get_schema(format='mermaid') - ERD diagram
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | No | Schema name. Omit or 'all' for all schemas; specific name for tables. | |
| format | No | Output format | json |
| limit | No | Max tables to return (1-500) | |
| offset | No | Skip first N tables (for pagination) | |
| url | No | Database URL for auto-connection |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |