Skip to content

Database Tools

Database tools connect to configured databases via named connections. All connections are lazy (created on first use) and read-only by default.

Supported engines: PostgreSQL, MySQL, SQLite.

query_db

Execute a parameterized SQL query.

InputTypeRequiredDescription
connectionstringnoConnection name (default: "default")
sqlstringyesSQL query (SELECT only when readOnly)
paramsunknown[]noQuery parameters

Output: { rows, rowCount, columns }

Security: When readOnly: true, the SQL is parsed to reject write keywords, and the query runs inside a read-only transaction at the engine level.

Values are serialized for JSON safety: Date → ISO string, Buffer → base64, BigInt → tagged string.


list_tables

List tables in a database.

InputTypeRequiredDescription
connectionstringnoConnection name (default: "default")
schemastringnoSchema filter (PostgreSQL)

Output: { tables: [{ name, schema?, type }] }


describe_table

Return column metadata for a table.

InputTypeRequiredDescription
connectionstringnoConnection name (default: "default")
tablestringyesTable name

Output: { columns: [{ name, type, nullable, defaultValue, isPrimaryKey }] }

Released under the MIT License.