SQLite connector
Query, inspect, and (optionally) update SQLite database files from AgentRuntime workflow steps.
On this page
SQLite is a small database that lives in a single .db file. The sqlite connector lets a workflow read that file with SQL, look at its tables, views, and indexes, preview rows, and, if you allow it, change data. Typical uses are a local reporting database, an embedded app's data, a prototype you are not ready to move to Postgres or MySQL, and exploring an unfamiliar schema.
The connector opens the file on the machine where the connector runs. It reads and updates existing database files; it does not create new ones. Make sure your deployment can reach the file you want to use before you set this up.
Prerequisites
- An existing SQLite database file (
.db) that the connector can reach, and its path. - The project_contributor role or higher in your project.
- Optional: a root folder you want to restrict access to (
sqlite_data_root). - Only if workflows must change data: a decision to turn on
sqlite_allow_write. It is off by default.
This connector needs no account or password. All its settings are plain configuration values.
Connect in AgentRuntime
- Add the connector
Click MCP in the sidebar, click Add connectors, find sqlite, select it, and click Add to workspace.
- Open Instance config
Open the new instance. On Instance config, under Profiles for this connector, click New profile and enter a Display name.
- Enter the settings
In the credentials section, choose Type secrets on this screen and fill in the fields from Configuration. At minimum set
sqlite_default_database_pathto your file, for example/data/app/metrics.db. Leavesqlite_allow_writeempty orfalsefor a read-only setup. - Make the profile active
Set Status to Active — can be used in workflows, click Save, then click Use this profile for workflows. The profile shows an active badge.
- Test it in a workflow
In Workflow Studio, add a connector tool step for this instance and choose
sqlite_get_database_info. Run it. A successful result shows the resolveddatabase_pathand thesqlite_version.
See MCP instances for more on profiles.
What you can build
- Metrics report. Run
sqlite_queryon a schedule to pull daily totals, summarize them with an LLM step, and post the summary to a channel. - Schema explorer for an agent. Give an agent
sqlite_list_tablesandsqlite_describe_table, so it can learn the shape of a database before it writes its ownSELECT. - Quick data checks. Use
sqlite_sample_table_rowsto preview a table, orsqlite_get_table_schemato confirm columns and indexes before a migration. - Lightweight ETL. With
sqlite_allow_writeon, load cleaned rows into a staging table withsqlite_execute, then verify them withsqlite_query.
Tools
Every tool accepts database_path. Pass an empty string to use sqlite_default_database_path.
Read
| Tool | What it does |
|---|---|
sqlite_get_database_info | Returns the resolved file path, the SQLite version, and the attached databases |
sqlite_query | Runs one read-only statement and returns columns, rows, and row_count |
sqlite_list_tables | Lists the user tables |
sqlite_list_views | Lists the views |
sqlite_describe_table | Lists a table's columns (table_name required) |
sqlite_get_table_schema | Returns a table's columns and indexes (table_name required) |
sqlite_list_indexes | Lists the indexes on a table (table_name required) |
sqlite_sample_table_rows | Previews rows from a table (table_name required, optional limit, default 10) |
Write
These change data and fail unless sqlite_allow_write is true.
| Tool | What it does |
|---|---|
sqlite_execute | Runs one statement that may change data (INSERT, UPDATE, DELETE, or schema changes). Returns rows_affected and last_insert_id |
sqlite_execute_sql | The same as sqlite_execute under a second name |
Example
Report the last seven days of sales from a read-only database:
{
"id": "daily_sales",
"type": "mcp",
"name": "Daily sales total",
"tool_name": "sqlite_query",
"tool_args": {
"database_path": "",
"sql": "SELECT date(created_at) AS day, SUM(amount) AS total FROM orders GROUP BY day ORDER BY day DESC LIMIT 7"
},
"timeout_s": 30
}Studio fills in instance_id when you pick the instance. Later steps read the result with {{steps.daily_sales.result.rows}}.
sqlite_query accepts a single statement that starts with SELECT or PRAGMA. A statement containing a semicolon is rejected, and so is one that starts with WITH.
Configuration
Set these on the profile's Instance config screen. All are optional.
| Key | Default | Description |
|---|---|---|
sqlite_data_root | none | A root folder. When set, every database path must resolve to a location inside it |
sqlite_default_database_path | none | The .db file used when a tool call leaves database_path empty |
sqlite_query_timeout_seconds | 30 | Time limit for one query, in seconds |
sqlite_max_rows | 1000 | The most rows a read query or row preview returns. Extra rows are dropped without an error |
sqlite_allow_write | false | Set to true to allow sqlite_execute and sqlite_execute_sql |
Troubleshooting
| Issue | Fix |
|---|---|
database_path is required (or set sqlite_default_database_path) | Pass database_path in the step, or set sqlite_default_database_path on the profile |
database path must be under sqlite_data_root | Use a file inside the configured root, or change sqlite_data_root |
sqlite_execute is disabled (set sqlite_allow_write=true) | Set sqlite_allow_write to true on the active profile, save, and run again |
sqlite_query only allows SELECT, PRAGMA, or WITH statements | Send a single statement that starts with SELECT or PRAGMA, without a semicolon. For anything that changes data use sqlite_execute |
invalid table_name | Table names must use only letters, digits, and underscores, and not start with a digit |
| Fewer rows than expected | The result was cut at sqlite_max_rows. Raise it or add a WHERE or LIMIT to narrow the query |
database is locked | Another process is writing to the file. The connector retries a few times before it fails; run the step again later |
| The file cannot be opened | Check the path exists where the connector runs. The connector does not create database files |
Related
- Integrations quickstart
- MCP instances
- Postgres connector for hosted databases
- MySQL connector
- Connector catalog
- Troubleshooting