connect_database
Connect to PostgreSQL, MySQL, SQLite, or MSSQL databases via a connection string. Set access mode, row limits, and credential storage for safe AI-driven queries.
Instructions
Connect to a database.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Permission mode — 'read_only' | 'read_write' | 'admin'. Default: 'read_only' (safest). | read_only |
| alias | Yes | Short name for this connection (e.g., 'prod', 'staging'). | |
| max_rows | No | Maximum rows returned by SELECT queries (auto-LIMIT). | |
| output_mode | No | Controls how query results are returned to the AI. 'smart' (default) — Full results for small queries; 10-row sample + column stats for large ones. 'raw' — Always return full raw rows (good for debugging). 'analytics' — Return only column statistics, zero rows (good for Snowflake / BigQuery / data warehouses). | smart |
| save_credential | No | If True, saves to OS Keyring for future sessions. | |
| forbidden_tables | No | Tables to block access to. Supports wildcards: '*.passwords', 'auth.*', 'users_secrets' | |
| connection_string | Yes | Full database URL. PostgreSQL: postgresql://user:pass@host:5432/dbname MySQL: mysql://user:pass@host:3306/dbname SQLite: sqlite:///path/to/file.db MSSQL: mssql://user:pass@host:1433/dbname |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |