Describe a database table
describe-tableInspect a PostgreSQL table’s columns, types, defaults, constraints, indexes, comments, foreign keys, and view SQL before writing queries.
Instructions
[PostgreSQL] Show one table's columns — name, type, nullability, default, identity, and enumValues where the type is an enum — plus its primary key, unique and CHECK constraints, indexes, comments, and BOTH directions of its foreign keys: foreignKeys is where this table points, referencedBy is what points at it. Those two are the join graph — read them before inventing a join condition. enumValues and the CHECK constraints are a column's permitted values: a filter on a value outside them returns no rows and reads like an empty result rather than a mistake. For a view, viewDefinition is the SQL it is defined as, which names its base tables and join keys. Use the exact schema and name that list-tables returned; identifiers are case-sensitive. Read this before writing SQL against a table you have not already described in this conversation: guessing a column name costs a round trip, and guessing a type produces a query that runs and quietly returns the wrong thing. A foreign key whose reachable is false points at a table this token cannot describe or query, and referencedByOutOfScope counts inbound keys from tables it cannot name — in both cases tell the user, since only the account owner can widen the allowlist. If the table itself is not reachable the answer is a refusal, not an empty description — call list-tables to see what is reachable.
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": {
"name": "<name>"
},
"name": "describe-table"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Table name exactly as list-tables reported it, including capitalisation | |
| schema | No | Schema exactly as list-tables reported it | public |