query_sqlserver
Run read-only T-SQL SELECT or WITH queries against a pipeline's SQL Server or Azure SQL destination, with server-resolved credentials and automatic row limits; omit SQL to preview the loaded table.
Instructions
Run a read-only query against the SQL Server or Azure SQL database a pipeline loads into. Pass the pipeline name; the server resolves the host, database, and credentials (any authMethod) from the pipeline's config — same connection the loader uses, credentials never leave the server. Only works for pipelines whose destination is SQL Server (database with useSqlServer=true). Allowed statements: SELECT and WITH (CTE) only, written in T-SQL. Rows are capped automatically: a statement with a top-level ORDER BY gets OFFSET 0 ROWS FETCH NEXT ROWS ONLY, any other is wrapped in SELECT TOP () — do not add LIMIT (not T-SQL). Omit sql to preview the pipeline's destination table (the 'did my load land?' check). Metadata discovery uses the same tool through INFORMATION_SCHEMA views — there are no separate list_sqlserver_* tools: SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES, SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = '<table>'. Queries run on the customer's server — keep them targeted and let the default limit stand unless the user asks for more.
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": {
"pipeline": "<pipeline>"
},
"name": "query_sqlserver"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | No | Read-only T-SQL statement: SELECT or WITH. Omit to preview the pipeline's destination table. | |
| limit | No | Maximum rows to return (default: 100). Pass -1 for unlimited. | |
| pipeline | Yes | Pipeline name (from list_pipelines). Must have a SQL Server destination. |