SQL Database
Query databases directly from your agent. Supports SQLite, PostgreSQL, and MySQL with read-only safety mode.Requires the appropriate database driver as a peer dependency:
better-sqlite3, pg, or mysql2.Quick Start
Config
Database dialect.
Connection string (for postgres/mysql) or file path (for sqlite).
Restrict to read-only queries (SELECT, SHOW, DESCRIBE, EXPLAIN, PRAGMA, WITH).
Max rows to return per query.
Tools
| Tool | Description |
|---|---|
sql_query | Execute a SQL query. Returns formatted table results. |
sql_tables | List all tables in the database. |
sql_describe | Describe the schema (columns, types) of a table. |
Peer Dependencies
Install the driver for your database:Security
The SQL toolkit includes built-in protections:- Read-only mode (default): Only
SELECT,SHOW,DESCRIBE,EXPLAIN,PRAGMA, andWITHqueries are permitted. - Parameterized queries: Schema introspection (
sql_describe) uses parameterized queries ($1bind parameters) for PostgreSQL to prevent SQL injection. - Table name validation: Table names are validated against
^[a-zA-Z_]\w*$to reject injection attempts.