Problem
executeAdhocQuery in redashClient.ts hardcodes apply_auto_limit: true in the request payload:
// redashClient.ts, line ~530
const payload = {
query: query,
data_source_id: dataSourceId,
max_age: 0,
apply_auto_limit: true, // Apply auto limit like in the web version
parameters: {}
};
When the target data source is MSSQL (type: "mssql" or "mssql_odbc"), Redash appends LIMIT 1000 to the query — which is valid PostgreSQL/MySQL syntax but invalid T-SQL. Every ad-hoc query against an MSSQL source fails with:
Incorrect syntax near 'LIMIT'.
This makes execute_adhoc_query completely unusable against MSSQL data sources (e.g. data source IDs with supports_auto_limit: true and type mssql/mssql_odbc).
Workaround
The current workaround is to use create_query + execute_query instead, which bypasses auto-limit injection for saved queries.
Proposed Fix
Expose apply_auto_limit as an optional parameter on executeAdhocQuery, keeping the default true for backwards compatibility:
async executeAdhocQuery(
query: string,
dataSourceId: number,
applyAutoLimit = true // default preserved for backwards compatibility
): Promise<RedashQueryResult> {
const payload = {
query,
data_source_id: dataSourceId,
max_age: 0,
apply_auto_limit: applyAutoLimit,
parameters: {}
};
// ...
}
And expose it as an optional boolean input in the MCP tool definition (default true). Callers targeting MSSQL data sources can then pass apply_auto_limit: false to avoid the broken LIMIT injection.
Problem
executeAdhocQueryinredashClient.tshardcodesapply_auto_limit: truein the request payload:When the target data source is MSSQL (
type: "mssql"or"mssql_odbc"), Redash appendsLIMIT 1000to the query — which is valid PostgreSQL/MySQL syntax but invalid T-SQL. Every ad-hoc query against an MSSQL source fails with:This makes
execute_adhoc_querycompletely unusable against MSSQL data sources (e.g. data source IDs withsupports_auto_limit: trueand typemssql/mssql_odbc).Workaround
The current workaround is to use
create_query+execute_queryinstead, which bypasses auto-limit injection for saved queries.Proposed Fix
Expose
apply_auto_limitas an optional parameter onexecuteAdhocQuery, keeping the defaulttruefor backwards compatibility:And expose it as an optional boolean input in the MCP tool definition (default
true). Callers targeting MSSQL data sources can then passapply_auto_limit: falseto avoid the brokenLIMITinjection.