Building a Data Stack Live with AI AgentsLivestream August 18

Skip to main content

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

ParameterTypeRequiredDescription
databasestringYesDatabase name to list views from
schemastringNoSchema name (defaults to all schemas)
keywordsstringNoFilter views by name or comment (case-insensitive, any word can match)
limitnumberNoMaximum 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
}