execute_query
Execute read-only SQL SELECT queries against SQL Server databases, returning structured JSON results with columns, rows, and automatic row limiting.
Instructions
Execute a SQL SELECT query and return results.
Executes ad-hoc SELECT queries with automatic row limiting for safety. Write operations (INSERT, UPDATE, DELETE) are blocked. Results are returned as a structured JSON with columns and rows.
Large text values (>1000 chars) and binary data are automatically truncated to keep responses token-efficient.
Args: connection_id: Connection ID from connect_database query_text: SQL query to execute (SELECT only) row_limit: Maximum rows to return, 1-10000 (default: 1000)
Returns: TOON-encoded string with query results:
status: "success" | "blocked" | "error"
query_id: string // on success only
query_type: string // on success only
columns: list of string // on success only
rows: list of object // on success only
rows_returned: int // on success only
rows_available: int // on success only
limited: bool // on success only
execution_time_ms: float // on success only
error_message: string // on error/blocked only
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| row_limit | No | ||
| query_text | Yes | ||
| connection_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |