> ## Documentation Index
> Fetch the complete documentation index at: https://dbhub.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

## Available Tools

| Tool           | Command Name                              | Description                                                                                                                                       |
| -------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| Execute SQL    | `execute_sql` or `execute_sql_{id}`       | Execute single or multiple SQL statements (separated by semicolons)                                                                               |
| Search Objects | `search_objects` or `search_objects_{id}` | Search and list database objects (schemas, tables, columns, procedures, indexes) with pattern matching and token-efficient progressive disclosure |
| Custom Tools   | User-defined names                        | Define reusable, parameterized SQL operations in your `dbhub.toml` configuration file                                                             |

## Tool Configuration

By default, both `execute_sql` and `search_objects` are enabled for each database source. You can customize which tools are available using `[[tools]]` entries in your `dbhub.toml`:

### Default Behavior

If no `[[tools]]` entries are defined for a source, both `execute_sql` and `search_objects` are enabled by default:

```toml theme={null}
[[sources]]
id = "dev"
dsn = "sqlite:///dev.db"
# No [[tools]] entries = both execute_sql and search_objects enabled
```

### Selective Tool Exposure

Control which tools are exposed for each database source:

```toml theme={null}
[[sources]]
id = "production"
dsn = "postgres://..."

# Only enable search_objects - execute_sql will NOT be available
[[tools]]
name = "search_objects"
source = "production"
```

This is useful when you want to restrict AI models to read-only schema exploration without allowing SQL execution.

### Per-Tool Settings

Configure built-in tools with specific settings like `readonly` and `max_rows`:

```toml theme={null}
[[sources]]
id = "production"
dsn = "postgres://..."

[[tools]]
name = "execute_sql"
source = "production"
readonly = true    # Only allow SELECT, SHOW, DESCRIBE, EXPLAIN
max_rows = 100     # Limit query results

[[tools]]
name = "search_objects"
source = "production"
```

See [execute\_sql documentation](/tools/execute-sql) for details on `readonly` and `max_rows` settings.

### Mixed Configuration

Different sources can have different tool configurations:

```toml theme={null}
[[sources]]
id = "production"
dsn = "postgres://..."

[[sources]]
id = "analytics"
dsn = "postgres://..."

# Production: only search_objects (no SQL execution)
[[tools]]
name = "search_objects"
source = "production"

# Analytics: full access with no row limit
[[tools]]
name = "execute_sql"
source = "analytics"

[[tools]]
name = "search_objects"
source = "analytics"
```

### Custom Tools

You can also define custom tools alongside built-in tools:

```toml theme={null}
[[sources]]
id = "production"
dsn = "postgres://..."

# Built-in tools
[[tools]]
name = "search_objects"
source = "production"

# Custom tool - no execute_sql for unrestricted queries
[[tools]]
name = "get_active_users"
source = "production"
description = "Get list of active users"
statement = "SELECT id, name, email FROM users WHERE status = 'active' LIMIT $1"

[[tools.parameters]]
name = "limit"
type = "integer"
description = "Maximum number of users to return"
default = 10
```

This approach gives you fine-grained control: disable general SQL execution while providing specific, safe operations through custom tools.

## Tool Naming

The tool name varies based on your configuration:

**Single database without `--id`:**

```bash theme={null}
npx @bytebase/dbhub@latest --dsn "postgres://..."
```

Tool name: `execute_sql`

**Single database with `--id`:**

```bash theme={null}
npx @bytebase/dbhub@latest --id prod --dsn "postgres://..."
```

Tool name: `execute_sql_prod`

**Multiple databases via TOML config:**

```toml theme={null}
[[sources]]
id = "prod-pg"
dsn = "postgres://..."

[[sources]]
id = "staging.mysql"
dsn = "mysql://..."
```

Tool names: `execute_sql_prod_pg` and `execute_sql_staging_mysql`

<Note>
  Special characters in source IDs (hyphens, dots, etc.) are converted to underscores in tool names. For example, `prod-pg` becomes `execute_sql_prod_pg`.
</Note>

## Next Steps

<CardGroup cols={3}>
  <Card title="Execute SQL" icon="play" href="/tools/execute-sql">
    Execute SQL queries and statements on your database
  </Card>

  <Card title="Search Objects" icon="magnifying-glass" href="/tools/search-objects">
    Search and explore database schemas, tables, and objects
  </Card>

  <Card title="Custom Tools" icon="wrench" href="/tools/custom-tools">
    Create reusable parameterized SQL operations
  </Card>
</CardGroup>
