Skip to main content
SQLTools connects an agent to a database. Point it at a read-only connection and the agent can introspect the schema and run queries.
The agent’s db and the SQLTools connection are separate. db stores the agent’s sessions. SQLTools points at the warehouse you are answering questions about. Keep them distinct.

Introspect before generating

SQLTools provides list_tables and describe_table so the agent can read the current schema before generating SQL. The instruction above makes schema introspection part of each request. run_sql_query(query, limit=10) returns at most 10 rows unless the agent passes a different limit. Pass limit=None for the full result set. Otherwise a GROUP BY over more than 10 groups comes back truncated with no sign that rows were dropped, so tell the agent when an answer needs every row.

Scope the connection

SQLTools executes any SQL the engine permits. It does not classify statements as read-only. This engine starts transactions with default_transaction_read_only=on, which blocks ordinary write statements. Because that setting is a configurable session default, use a non-owner database role with no write grants as the hard boundary. See Safe data access for the full read and write split.

Next steps

Developer Resources