execute_sql
Execute T-SQL queries and scripts against SQL Server, including SELECT, DML, DDL, and stored procedures, returning result sets, messages, and errors.
Instructions
Execute any T-SQL: SELECT, INSERT/UPDATE/DELETE/MERGE, DDL (CREATE/ALTER/DROP), EXEC, DBCC, BACKUP, ...
Scripts may contain
GObatch separators (GO nrepeats). CREATE PROCEDURE/VIEW/FUNCTION/TRIGGER must be alone in its batch.params: values for
?placeholders (single batch only), e.g. sql="SELECT * FROM t WHERE id = ?", params=[5].database: run in this database (the connection's previous database is restored afterwards).
max_rows: per result set (default from the profile, 1000). continue_on_error: keep running later batches.
output_format: 'json' (default) or 'markdown'. Returns result_sets, rows_affected, messages (PRINT / info), errors, open transaction warnings.
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": "execute_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| params | No | ||
| database | No | ||
| max_rows | No | ||
| connection | No | ||
| output_format | No | json | |
| timeout_seconds | No | ||
| continue_on_error | No |