Skip to main content

Overview

List all databases available in the connection with their names and types. This tool is particularly useful when multiple DuckDB databases are attached or when connected to MotherDuck. For MotherDuck connections, it uses the MD_ALL_DATABASES() function to list all databases. For local DuckDB connections, it uses the duckdb_databases() system function. Internal databases (system and temp) are automatically excluded from the results.

Parameters

This tool does not require any input parameters.

Response

success
boolean
required
Indicates whether the operation completed successfully.
databases
array
required
Array of database objects. Each object contains:
  • name (string): Database name or alias
  • type (string): Database type (e.g., “motherduck”, “duckdb”, “sqlite”)
databaseCount
integer
required
Total number of databases returned (excludes system and temp databases).
error
string
Error message when success is false.
errorType
string
Type of error that occurred.

Examples

MotherDuck Connection with Multiple Databases

Response:
{
  "success": true,
  "databases": [
    {
      "name": "my_db",
      "type": "motherduck"
    },
    {
      "name": "analytics",
      "type": "motherduck"
    },
    {
      "name": "shared_data",
      "type": "motherduck"
    }
  ],
  "databaseCount": 3
}

Local DuckDB with Single Database

Response:
{
  "success": true,
  "databases": [
    {
      "name": "main",
      "type": "duckdb"
    }
  ],
  "databaseCount": 1
}

Local DuckDB with Attached Databases

Response:
{
  "success": true,
  "databases": [
    {
      "name": "main",
      "type": "duckdb"
    },
    {
      "name": "warehouse",
      "type": "duckdb"
    },
    {
      "name": "archive",
      "type": "duckdb"
    }
  ],
  "databaseCount": 3
}

In-Memory Database

Response:
{
  "success": true,
  "databases": [
    {
      "name": "memory",
      "type": "duckdb"
    }
  ],
  "databaseCount": 1
}

Error Response

Response:
{
  "success": false,
  "error": "Failed to query database catalog",
  "errorType": "CatalogException"
}

Use Cases

When to Use list_databases

  1. MotherDuck Connections: Discover all available databases in your MotherDuck account
  2. Multi-Database Setups: Understand which databases are attached in a local DuckDB session
  3. Database Discovery: Before querying data, verify which databases are accessible
  4. Context Building: Help AI assistants understand the database environment before executing queries

When NOT to Use list_databases

  • Single Local Database: For simple single-file DuckDB connections, you typically know the database name already
  • In-Memory Only: If working exclusively with :memory:, listing databases is usually unnecessary

Tool Annotations

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

Build docs developers (and LLMs) love