whodb_columns
Retrieve column names, data types, primary and foreign key relationships for a database table. Inspect table structure before writing queries to ensure correct column usage.
Instructions
Describe the columns in a database table.
Best for: Understanding table structure before writing queries; discovering primary keys and foreign key relationships. Not recommended for: When you need actual data (use whodb_query with SELECT). Common mistakes: Forgetting to specify the table name; not using this before writing INSERT/UPDATE queries.
Usage Example:
{
"name": "whodb_columns",
"arguments": {
"connection": "mydb",
"table": "users",
"schema": "public"
}
}Returns: Array of column objects with:
name: Column name
type: Data type (varchar, integer, timestamp, etc.)
is_primary: Whether this is a primary key
is_foreign_key: Whether this references another table
referenced_table/referenced_column: Foreign key target (if applicable)
Pro tip: Always call this before writing INSERT queries to ensure correct column names and types.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connection | Yes | Connection name (optional if only one exists) | |
| schema | No | Schema name (uses default if omitted) | |
| table | Yes | Table name to describe |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| columns | Yes | ||
| table | Yes | ||
| schema | Yes | ||
| error | No | ||
| request_id | No |