Skip to content

Commit 7316ca5

Browse files
committed
Improve timeout error message in SQL execution for better clarity
1 parent b42b295 commit 7316ca5

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

tools/execute_sql.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ func ExecuteSQL(ctx context.Context, request mcp.CallToolRequest) (interface{},
2222
maxRows := ExtractFloatParam(request, "max_rows", 100)
2323
warehouseId := ExtractStringParam(request, "warehouse_id", "")
2424

25-
// Poll every 10 seconds
26-
if timeoutSeconds < 5 {
27-
timeoutSeconds = 0
28-
}
2925
// Convert timeout to string format for API and calculate a polling interval
3026
pollingInterval := 10 * time.Second
3127
// Poll for statement completion
@@ -87,7 +83,7 @@ func ExecuteSQL(ctx context.Context, request mcp.CallToolRequest) (interface{},
8783
_ = w.StatementExecution.CancelExecution(ctx, sql.CancelExecutionRequest{
8884
StatementId: res.StatementId,
8985
})
90-
return nil, fmt.Errorf("error executing the statement, current status %s, canceled execution", res.Status.State)
86+
return nil, fmt.Errorf("statement execution timed out after %v seconds, current status %s.\nHint: Try with a higher timeout or simplying the query.", timeoutSeconds, res.Status.State)
9187
}
9288

9389
// Collect all result chunks

0 commit comments

Comments
 (0)