run_query
Execute SQL or MongoDB queries against PostgreSQL, MySQL, SQLite, and MongoDB databases; destructive writes are blocked by default.
Instructions
Execute a SQL query (PostgreSQL/MySQL/SQLite) or MongoDB query (JSON format). For SQL databases: provide standard SQL. For MongoDB: provide JSON like {"collection":"users","operation":"find","query":{"age":{"$gt":25}},"options":{"limit":10}}. MongoDB operations: find, aggregate, count, distinct. Results are limited to 100 rows by default (max 1000). By default, destructive queries (DROP, TRUNCATE, INSERT, UPDATE, DELETE) are blocked. Set readonly=false to allow writes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max rows to return (default: 100, max: 1000) | |
| query | Yes | SQL query or MongoDB JSON query | |
| readonly | No | Block destructive queries (default: true). Set to false to allow writes. | |
| connection | No | Connection alias (default: 'default') |