# list_views


> List views in a MotherDuck database with schema, comment, and column count

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`](../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

```json
{
  "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:**

```text
What views does my_database have?
```

The AI assistant will call the tool with:

```json
{
  "database": "my_database"
}
```

**Filter by schema and keywords:**

```json
{
  "database": "analytics_db",
  "schema": "reporting",
  "keywords": "monthly revenue"
}
```

## Success response example

```json
{
  "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) — List tables and views with their comments.
- [`list_columns`](../list-columns) — Inspect a view's columns and types.
- [`list_macros`](../list-macros) — List macros in a database.


---

## Docs feedback

MotherDuck accepts optional user-submitted feedback about this page at `GET https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

URL-encode query parameter values and send a GET request:

```text
GET https://motherduck.com/docs/api/feedback/agent?page_path=%2Fsql-reference%2Fmcp%2Fcore%2Flist-views%2F&page_title=list_views&text=<url-encoded user feedback, max 2000 characters>
```

Optionally append `&source=<url-encoded interface identifier>` such as `claude.ai` or `chatgpt`.

`page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": "<uuid>"}`, `400` for malformed query parameters, and `429` when rate-limited.
