mssql_query
Execute read-only SQL queries on Microsoft SQL Server, supporting SELECT, temp table batches, and whitelisted stored procedures. Returns data as JSON or Markdown.
Instructions
Execute a read-only SQL query against the MS SQL Server database. Accepts: a single SELECT / WITH...SELECT; a multi-statement batch led by DECLARE, INSERT, or CREATE TABLE # that writes ONLY to session-local #temp tables or @table variables (global ##temp is never allowed); or EXEC of a whitelisted stored procedure whose definition does not write to a persistent table. Writes to real tables, DDL on persistent objects, dynamic SQL, EXEC inside batches, and DBCC are blocked (server runs with MSSQL_READ_ONLY=true). Returns results as JSON or Markdown.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The SQL to execute. Must be read-only: a SELECT/WITH query, a DECLARE batch using only #temp/@table targets, or EXEC of an allowed read-only stored procedure. | |
| offset | No | Row offset for pagination (default: 0) | |
| maxRows | No | Maximum number of rows to return per page (default: 100, max: 1000) | |
| response_format | No | Response format: 'json' for machine-readable, 'markdown' for human-readable (default: json) | json |