ashlr__sql
Run SQL against SQLite or Postgres and return a compact, token-dense text result.
Server: ashlr-sql — servers/sql-server.ts
Collapses the typical "shell out to psql/sqlite3 + reparse stdout" loop into one tool call. Supports SQLite (via bun:sqlite) and Postgres (via porsager/postgres). Returns results as a compact table, truncating large result sets.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
query | string | no | SQL query to execute |
connection | string | no | Connection URL (postgres://…) or SQLite path. If omitted, reads $DATABASE_URL, then looks for *.db / *.sqlite files in cwd. |
explain | boolean | no | Wrap in EXPLAIN ANALYZE (postgres) / EXPLAIN QUERY PLAN (sqlite). Default false. |
limit | number | no | Max rows to return in the compact output (default 20). Total row count is always reported. |
schema | boolean | no | Skip the query and instead list tables, columns, and row counts. Cheaper than many \d / SHOW TABLES round-trips. |
bypassSummary | boolean | no | Skip LLM summarization of long output |
Output format
A header line gives the connection (passwords redacted), elapsed time and result shape, then a compact table. Rows past limit (default 20) are elided, and the total row count is still reported. With limit: 2 against a 49-row table:
Driver detection
postgres://orpostgresql://: Postgres drivermysql://,mssql://orsqlserver://: rejected with an "is not supported" errorsqlite://<path>, or any other string: treated as a SQLite file path (:memory:works too)connectionomitted: readsDATABASE_URL, then looks for a*.db,*.sqlite,*.sqlite3or*.s3dbfile in the cwd (not recursive). If there are several, it prefers the one named after the directory, then the most recently modified.
Example
Unsupported
MySQL and MSSQL are not supported. Passing a mysql://, mssql:// or sqlserver:// connection returns a clear error.
Related tools
ashlr__bash— raw shell fallback if you needpsqlflags