execute_sql
Execute SQL statements on registered database instances with automatic classification into read-only, destructive, or blocked operations, ensuring safety by requiring confirmation for destructive commands.
Instructions
Execute a SQL statement on a registered instance.
SQL is classified before execution:
Read-only (SELECT/SHOW/WITH/EXPLAIN/DESC): executes directly.
Destructive (DROP/DELETE/UPDATE/INSERT/ALTER/TRUNCATE/CREATE/...): requires confirm_destructive=true.
Blocked (OUTFILE/DUMPFILE/LOAD_FILE/SHUTDOWN/KILL): always rejected.
Args: instance_id: The instance name from register_instance. sql: The SQL statement to execute. database: Optional database to switch to before executing. confirm_destructive: Set to true to allow destructive operations.
Returns: JSON string with query results (columns/rows/row_count) or affected_rows for DML, or error/safety rejection details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| database | No | ||
| instance_id | Yes | ||
| confirm_destructive | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |