SQLite Query
sqlite_queryExecute SQL statements on a local SQLite database, returning rows for queries or change count for data modifications.
Instructions
Run a SQL statement against a local SQLite database file and return the rows or change count. Use this to query or modify structured data instead of inventing values.
To explore an unfamiliar database, first run: SELECT name FROM sqlite_master WHERE type='table'.
Args:
db_path (string): Path to the .sqlite/.db file (created if missing unless read_only).
sql (string): A single SQL statement. SELECT/PRAGMA return rows; INSERT/UPDATE/DELETE return a change count.
params (array): Optional positional parameters for ? placeholders.
read_only (boolean): Open read-only (default false).
Returns rows (for SELECT) or { changes, lastInsertRowid }.
Example: { "db_path": "~/data/app.db", "sql": "SELECT * FROM users WHERE age > ?", "params": [18] }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| db_path | Yes | Path to SQLite database file | |
| sql | Yes | Single SQL statement | |
| params | No | Positional params for ? placeholders | |
| read_only | No | Open read-only |