list_views
List all views in a MotherDuck database with their schema, comment, and column count.
Description
The list_views tool returns the views in a specified database, including their schema, any comments, and the number of columns. You can optionally filter by schema or keywords. To inspect a view's columns in detail, follow up with list_columns.
Input parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
database | string | Yes | Database name to list views from |
schema | string | No | Schema name (defaults to all schemas) |
keywords | string | No | Filter views by name or comment (case-insensitive, any word can match) |
limit | number | No | Maximum results to return (default: 100, maximum: 500) |
Output schema
{
"success": boolean,
"database": string, // Database name
"schema": string, // Schema filter used ("all" if not specified)
"views": [ // List of views (on success)
{
"schema": string, // Schema name
"name": string, // View name
"comment": string | null, // View comment if set
"column_count": number // Number of columns
}
],
"count": number, // Number of views returned
"totalCount": number, // Total number of matching views
"truncated": boolean, // Present when results were cut to fit the limit
"error": string // Error message (on failure)
}
Example usage
List all views in a database:
What views does my_database have?
The AI assistant will call the tool with:
{
"database": "my_database"
}
Filter by schema and keywords:
{
"database": "analytics_db",
"schema": "reporting",
"keywords": "monthly revenue"
}
Success response example
{
"success": true,
"database": "analytics_db",
"schema": "reporting",
"views": [
{
"schema": "reporting",
"name": "monthly_revenue",
"comment": "Revenue aggregated by calendar month",
"column_count": 4
}
],
"count": 1,
"totalCount": 1
}
Related
list_tables— List tables and views with their comments.list_columns— Inspect a view's columns and types.list_macros— List macros in a database.