Skip to main content

Overview

List all columns of a table or view with their data types, nullability, and comments. If database or schema parameters are not specified, the tool uses the current database and schema. This tool queries DuckDB’s duckdb_columns() system function to retrieve column metadata and automatically determines whether the object is a table or view.

Parameters

table
string
required
Table or view name to inspect. Can be a simple name (e.g., “customers”) or a fully qualified name (e.g., “analytics.main.customers”).
database
string
Database name containing the table. If not specified, defaults to the current database obtained via current_database().
schema
string
Schema name containing the table. If not specified, defaults to the current schema obtained via current_schema() (typically “main”).

Response

success
boolean
required
Indicates whether the operation completed successfully.
database
string
required
The database that was queried.
schema
string
required
The schema that was queried.
table
string
required
The table or view name that was inspected.
objectType
string
required
Either “table” or “view”.
columns
array
required
Array of column objects. Each object contains:
  • name (string): Column name
  • type (string): DuckDB data type (e.g., “VARCHAR”, “BIGINT”, “TIMESTAMP”, “DOUBLE”)
  • nullable (boolean): Whether the column accepts NULL values
  • comment (string | null): User-defined comment, or null if not set
columnCount
integer
required
Total number of columns in the table or view.
error
string
Error message when success is false.
errorType
string
Type of error that occurred.

Examples

Simple Table in Current Database

Request:
{
  "table": "customers"
}
Response:
{
  "success": true,
  "database": "main",
  "schema": "main",
  "table": "customers",
  "objectType": "table",
  "columns": [
    {
      "name": "id",
      "type": "BIGINT",
      "nullable": false,
      "comment": "Primary key"
    },
    {
      "name": "name",
      "type": "VARCHAR",
      "nullable": false,
      "comment": "Customer full name"
    },
    {
      "name": "email",
      "type": "VARCHAR",
      "nullable": false,
      "comment": "Email address"
    },
    {
      "name": "phone",
      "type": "VARCHAR",
      "nullable": true,
      "comment": null
    },
    {
      "name": "created_at",
      "type": "TIMESTAMP",
      "nullable": false,
      "comment": "Account creation timestamp"
    },
    {
      "name": "lifetime_value",
      "type": "DOUBLE",
      "nullable": true,
      "comment": "Total revenue from customer"
    }
  ],
  "columnCount": 6
}

Table in Specific Database

Request:
{
  "table": "orders",
  "database": "warehouse"
}
Response:
{
  "success": true,
  "database": "warehouse",
  "schema": "main",
  "table": "orders",
  "objectType": "table",
  "columns": [
    {
      "name": "order_id",
      "type": "BIGINT",
      "nullable": false,
      "comment": null
    },
    {
      "name": "customer_id",
      "type": "BIGINT",
      "nullable": false,
      "comment": null
    },
    {
      "name": "order_date",
      "type": "DATE",
      "nullable": false,
      "comment": null
    },
    {
      "name": "total_amount",
      "type": "DECIMAL(18,2)",
      "nullable": false,
      "comment": null
    },
    {
      "name": "status",
      "type": "VARCHAR",
      "nullable": false,
      "comment": null
    }
  ],
  "columnCount": 5
}

View with Specific Schema

Request:
{
  "table": "monthly_sales",
  "database": "analytics",
  "schema": "reporting"
}
Response:
{
  "success": true,
  "database": "analytics",
  "schema": "reporting",
  "table": "monthly_sales",
  "objectType": "view",
  "columns": [
    {
      "name": "month",
      "type": "DATE",
      "nullable": true,
      "comment": null
    },
    {
      "name": "total_revenue",
      "type": "DECIMAL(18,2)",
      "nullable": true,
      "comment": null
    },
    {
      "name": "order_count",
      "type": "BIGINT",
      "nullable": true,
      "comment": null
    },
    {
      "name": "avg_order_value",
      "type": "DOUBLE",
      "nullable": true,
      "comment": null
    }
  ],
  "columnCount": 4
}

Table with Complex Types

Request:
{
  "table": "events"
}
Response:
{
  "success": true,
  "database": "main",
  "schema": "main",
  "table": "events",
  "objectType": "table",
  "columns": [
    {
      "name": "event_id",
      "type": "UUID",
      "nullable": false,
      "comment": null
    },
    {
      "name": "event_time",
      "type": "TIMESTAMP WITH TIME ZONE",
      "nullable": false,
      "comment": null
    },
    {
      "name": "user_id",
      "type": "VARCHAR",
      "nullable": false,
      "comment": null
    },
    {
      "name": "properties",
      "type": "JSON",
      "nullable": true,
      "comment": "Event metadata as JSON"
    },
    {
      "name": "tags",
      "type": "VARCHAR[]",
      "nullable": true,
      "comment": "Array of tag strings"
    }
  ],
  "columnCount": 5
}

Error - Table Not Found

Request:
{
  "table": "nonexistent_table"
}
Response:
{
  "success": false,
  "error": "Table 'nonexistent_table' not found in database 'main' schema 'main'",
  "errorType": "CatalogException"
}

Fully Qualified Table Names

You can specify the table using fully qualified names instead of separate parameters:
  • database.schema.table - Full qualification
  • database.table - Uses default schema
  • table - Uses current database and schema
However, the separate database and schema parameters provide more explicit control.

Default Behavior

Current Database: When no database parameter is provided, uses current_database() (typically “main” for local files).
Current Schema: When no schema parameter is provided, uses current_schema() (typically “main”).

Common Column Types

DuckDB supports many data types that may appear in column type fields:
  • Numeric: BIGINT, INTEGER, SMALLINT, TINYINT, DOUBLE, FLOAT, DECIMAL(p,s)
  • String: VARCHAR, TEXT
  • Date/Time: DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIME, INTERVAL
  • Boolean: BOOLEAN
  • Binary: BLOB
  • Structured: JSON, STRUCT, LIST, MAP
  • Special: UUID, ENUM

Tool Annotations

This tool is always read-only with readOnlyHint: true and destructiveHint: false, regardless of server mode.

Build docs developers (and LLMs) love