run_sql_query
Execute a single read-only SQL statement and return structured results, with automatic LIMIT injection, hard row caps, and timeout guarding to keep responses bounded.
Instructions
Execute a read-only SQL query and return structured results.
Safety guardrails (see README "Design decisions"):
Only SELECT / WITH / EXPLAIN / DESCRIBE / SHOW statements are permitted; DDL/DML and system commands are rejected.
Only one statement per call.
If the query has no LIMIT clause, one is auto-injected using
row_limit(or the server default). Results are always hard-capped at the server's max_row_limit, regardless of what you request, to keep responses bounded.The query is cancelled if it runs longer than the server's configured timeout.
Use get_row_count first if you need to know the true size of a table beyond what this capped result shows.
Args: sql: A single read-only SQL statement. row_limit: Desired max rows (capped at the server's max_row_limit). Ignored if your query already has LIMIT.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sql": "<sql>"
},
"name": "run_sql_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| row_limit | No |