@squadbase/vite-server 0.1.10 → 0.1.11-dev.0c78963
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +203 -130
- package/dist/connectors/oracle.js +1 -1
- package/dist/index.js +203 -130
- package/dist/main.js +203 -130
- package/dist/vite-plugin.js +203 -130
- package/package.json +1 -1
package/dist/vite-plugin.js
CHANGED
|
@@ -364,6 +364,37 @@ import { z } from "zod";
|
|
|
364
364
|
|
|
365
365
|
// ../connectors/src/connectors/snowflake/utils.ts
|
|
366
366
|
import crypto from "crypto";
|
|
367
|
+
|
|
368
|
+
// ../connectors/src/lib/approx-bytes.ts
|
|
369
|
+
function approxBytes(value, acc, limit) {
|
|
370
|
+
if (acc > limit) return acc;
|
|
371
|
+
if (value == null) return acc;
|
|
372
|
+
const t = typeof value;
|
|
373
|
+
if (t === "string") return acc + value.length;
|
|
374
|
+
if (t === "number" || t === "boolean") return acc + 8;
|
|
375
|
+
if (t === "bigint") return acc + 16;
|
|
376
|
+
if (value instanceof Date) return acc + 8;
|
|
377
|
+
if (Buffer.isBuffer(value)) return acc + value.byteLength;
|
|
378
|
+
if (Array.isArray(value)) {
|
|
379
|
+
for (const item of value) {
|
|
380
|
+
acc = approxBytes(item, acc, limit);
|
|
381
|
+
if (acc > limit) return acc;
|
|
382
|
+
}
|
|
383
|
+
return acc;
|
|
384
|
+
}
|
|
385
|
+
if (t === "object") {
|
|
386
|
+
const obj = value;
|
|
387
|
+
for (const k in obj) {
|
|
388
|
+
acc += k.length;
|
|
389
|
+
acc = approxBytes(obj[k], acc, limit);
|
|
390
|
+
if (acc > limit) return acc;
|
|
391
|
+
}
|
|
392
|
+
return acc;
|
|
393
|
+
}
|
|
394
|
+
return acc;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// ../connectors/src/connectors/snowflake/utils.ts
|
|
367
398
|
function decryptPrivateKey(pem, passphrase) {
|
|
368
399
|
if (!passphrase) return pem;
|
|
369
400
|
return crypto.createPrivateKey({
|
|
@@ -372,10 +403,46 @@ function decryptPrivateKey(pem, passphrase) {
|
|
|
372
403
|
passphrase
|
|
373
404
|
}).export({ type: "pkcs8", format: "pem" });
|
|
374
405
|
}
|
|
406
|
+
async function executeWithSizeLimit(conn, sql, options) {
|
|
407
|
+
const rows = [];
|
|
408
|
+
let acc = 0;
|
|
409
|
+
let exceeded = false;
|
|
410
|
+
await new Promise((resolve, reject) => {
|
|
411
|
+
const stmt = conn.execute({
|
|
412
|
+
sqlText: sql,
|
|
413
|
+
streamResult: true
|
|
414
|
+
});
|
|
415
|
+
const stream = stmt.streamRows();
|
|
416
|
+
stream.on("data", (row) => {
|
|
417
|
+
if (exceeded) return;
|
|
418
|
+
acc = approxBytes(row, acc, options.maxBytes);
|
|
419
|
+
if (acc > options.maxBytes) {
|
|
420
|
+
exceeded = true;
|
|
421
|
+
stream.destroy();
|
|
422
|
+
stmt.cancel(() => {
|
|
423
|
+
});
|
|
424
|
+
resolve();
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
rows.push(row);
|
|
428
|
+
});
|
|
429
|
+
stream.on("end", () => {
|
|
430
|
+
resolve();
|
|
431
|
+
});
|
|
432
|
+
stream.on("error", (err) => {
|
|
433
|
+
if (exceeded) return;
|
|
434
|
+
reject(new Error(`Snowflake query failed: ${err.message}`));
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
if (exceeded) {
|
|
438
|
+
return { exceeded: true };
|
|
439
|
+
}
|
|
440
|
+
return { exceeded: false, rows };
|
|
441
|
+
}
|
|
375
442
|
|
|
376
443
|
// ../connectors/src/connectors/snowflake/tools/execute-query.ts
|
|
377
|
-
var
|
|
378
|
-
var
|
|
444
|
+
var MAX_RESULT_BYTES = 5 * 1024 * 1024;
|
|
445
|
+
var STATEMENT_TIMEOUT_SECONDS = 60;
|
|
379
446
|
var inputSchema = z.object({
|
|
380
447
|
toolUseIntent: z.string().optional().describe(
|
|
381
448
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -389,7 +456,6 @@ var outputSchema = z.discriminatedUnion("success", [
|
|
|
389
456
|
z.object({
|
|
390
457
|
success: z.literal(true),
|
|
391
458
|
rowCount: z.number(),
|
|
392
|
-
truncated: z.boolean(),
|
|
393
459
|
rows: z.array(z.record(z.string(), z.unknown()))
|
|
394
460
|
}),
|
|
395
461
|
z.object({
|
|
@@ -399,9 +465,12 @@ var outputSchema = z.discriminatedUnion("success", [
|
|
|
399
465
|
]);
|
|
400
466
|
var executeQueryTool = new ConnectorTool({
|
|
401
467
|
name: "executeQuery",
|
|
402
|
-
description: `Execute SQL against Snowflake.
|
|
403
|
-
Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA),
|
|
404
|
-
|
|
468
|
+
description: `Execute SQL against Snowflake. Results are streamed; if the approximate result size exceeds 5MB the call fails with an explicit error and you must retry with a smaller query (add LIMIT, wrap wide text columns with SUBSTR, or aggregate inside Snowflake).
|
|
469
|
+
Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), sampling (LIMIT, SAMPLE), and analytical queries.
|
|
470
|
+
Memory guidance:
|
|
471
|
+
- Avoid SELECT * on tables with long text columns (logs, JSON, concatenated text). Project only the columns you need; truncate wide text with SUBSTR(col, 1, N).
|
|
472
|
+
- For full-dataset analysis, do the aggregation inside Snowflake (COUNT, SUM, GROUP BY, APPROX_TOP_K, HISTOGRAM) instead of returning raw rows.
|
|
473
|
+
- Exploration is iterative: start with a small LIMIT to inspect shape, then refine.`,
|
|
405
474
|
inputSchema,
|
|
406
475
|
outputSchema,
|
|
407
476
|
async execute({ connectionId, sql }, connections) {
|
|
@@ -443,39 +512,43 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
443
512
|
else resolve();
|
|
444
513
|
});
|
|
445
514
|
});
|
|
446
|
-
|
|
447
|
-
(resolve, reject) => {
|
|
448
|
-
const timeoutId = setTimeout(() => {
|
|
449
|
-
reject(
|
|
450
|
-
new Error(
|
|
451
|
-
"Snowflake query timeout: query exceeded 60 seconds"
|
|
452
|
-
)
|
|
453
|
-
);
|
|
454
|
-
}, QUERY_TIMEOUT_MS);
|
|
515
|
+
try {
|
|
516
|
+
await new Promise((resolve, reject) => {
|
|
455
517
|
conn.execute({
|
|
456
|
-
sqlText:
|
|
457
|
-
complete: (err
|
|
458
|
-
clearTimeout(timeoutId);
|
|
518
|
+
sqlText: `ALTER SESSION SET STATEMENT_TIMEOUT_IN_SECONDS = ${STATEMENT_TIMEOUT_SECONDS}`,
|
|
519
|
+
complete: (err) => {
|
|
459
520
|
if (err)
|
|
460
|
-
reject(
|
|
461
|
-
|
|
521
|
+
reject(
|
|
522
|
+
new Error(
|
|
523
|
+
`Failed to set Snowflake statement timeout: ${err.message}`
|
|
524
|
+
)
|
|
525
|
+
);
|
|
526
|
+
else resolve();
|
|
462
527
|
}
|
|
463
528
|
});
|
|
529
|
+
});
|
|
530
|
+
const result = await executeWithSizeLimit(conn, sql, {
|
|
531
|
+
maxBytes: MAX_RESULT_BYTES
|
|
532
|
+
});
|
|
533
|
+
if (result.exceeded) {
|
|
534
|
+
return {
|
|
535
|
+
success: false,
|
|
536
|
+
error: "Result size exceeded 5MB. Reduce the query: add LIMIT, wrap wide text columns with SUBSTR(col, 1, N), or aggregate inside Snowflake (COUNT/SUM/GROUP BY)."
|
|
537
|
+
};
|
|
464
538
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
};
|
|
539
|
+
return {
|
|
540
|
+
success: true,
|
|
541
|
+
rowCount: result.rows.length,
|
|
542
|
+
rows: result.rows
|
|
543
|
+
};
|
|
544
|
+
} finally {
|
|
545
|
+
conn.destroy((err) => {
|
|
546
|
+
if (err)
|
|
547
|
+
console.warn(
|
|
548
|
+
`[connector-query] Snowflake destroy error: ${err.message}`
|
|
549
|
+
);
|
|
550
|
+
});
|
|
551
|
+
}
|
|
479
552
|
} catch (err) {
|
|
480
553
|
const msg = err instanceof Error ? err.message : String(err);
|
|
481
554
|
return { success: false, error: msg };
|
|
@@ -664,8 +737,8 @@ var parameters2 = {
|
|
|
664
737
|
|
|
665
738
|
// ../connectors/src/connectors/snowflake-pat/tools/execute-query.ts
|
|
666
739
|
import { z as z2 } from "zod";
|
|
667
|
-
var
|
|
668
|
-
var
|
|
740
|
+
var MAX_ROWS = 500;
|
|
741
|
+
var QUERY_TIMEOUT_MS = 6e4;
|
|
669
742
|
var inputSchema2 = z2.object({
|
|
670
743
|
toolUseIntent: z2.string().optional().describe(
|
|
671
744
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -689,7 +762,7 @@ var outputSchema2 = z2.discriminatedUnion("success", [
|
|
|
689
762
|
]);
|
|
690
763
|
var executeQueryTool2 = new ConnectorTool({
|
|
691
764
|
name: "executeQuery",
|
|
692
|
-
description: `Execute SQL against Snowflake. Returns up to ${
|
|
765
|
+
description: `Execute SQL against Snowflake. Returns up to ${MAX_ROWS} rows.
|
|
693
766
|
Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), data sampling, analytical queries.
|
|
694
767
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
695
768
|
inputSchema: inputSchema2,
|
|
@@ -735,7 +808,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
735
808
|
"Snowflake query timeout: query exceeded 60 seconds"
|
|
736
809
|
)
|
|
737
810
|
);
|
|
738
|
-
},
|
|
811
|
+
}, QUERY_TIMEOUT_MS);
|
|
739
812
|
conn.execute({
|
|
740
813
|
sqlText: sql,
|
|
741
814
|
complete: (err, _stmt, rows) => {
|
|
@@ -753,12 +826,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
753
826
|
`[connector-query] Snowflake destroy error: ${err.message}`
|
|
754
827
|
);
|
|
755
828
|
});
|
|
756
|
-
const truncated = allRows.length >
|
|
829
|
+
const truncated = allRows.length > MAX_ROWS;
|
|
757
830
|
return {
|
|
758
831
|
success: true,
|
|
759
|
-
rowCount: Math.min(allRows.length,
|
|
832
|
+
rowCount: Math.min(allRows.length, MAX_ROWS),
|
|
760
833
|
truncated,
|
|
761
|
-
rows: allRows.slice(0,
|
|
834
|
+
rows: allRows.slice(0, MAX_ROWS)
|
|
762
835
|
};
|
|
763
836
|
} catch (err) {
|
|
764
837
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -1092,7 +1165,7 @@ var POSTGRES_DEFAULT_PORT = 5432;
|
|
|
1092
1165
|
|
|
1093
1166
|
// ../connectors/src/connectors/postgresql/tools/execute-query.ts
|
|
1094
1167
|
import { z as z3 } from "zod";
|
|
1095
|
-
var
|
|
1168
|
+
var MAX_ROWS2 = 500;
|
|
1096
1169
|
var CONNECT_TIMEOUT_MS = 1e4;
|
|
1097
1170
|
var STATEMENT_TIMEOUT_MS = 6e4;
|
|
1098
1171
|
var inputSchema3 = z3.object({
|
|
@@ -1116,7 +1189,7 @@ var outputSchema3 = z3.discriminatedUnion("success", [
|
|
|
1116
1189
|
]);
|
|
1117
1190
|
var executeQueryTool3 = new ConnectorTool({
|
|
1118
1191
|
name: "executeQuery",
|
|
1119
|
-
description: `Execute SQL against PostgreSQL. Returns up to ${
|
|
1192
|
+
description: `Execute SQL against PostgreSQL. Returns up to ${MAX_ROWS2} rows.
|
|
1120
1193
|
Use for: schema exploration (information_schema), data sampling, analytical queries.
|
|
1121
1194
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
1122
1195
|
inputSchema: inputSchema3,
|
|
@@ -1154,12 +1227,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1154
1227
|
STATEMENT_TIMEOUT_MS
|
|
1155
1228
|
);
|
|
1156
1229
|
const rows = result.rows;
|
|
1157
|
-
const truncated = rows.length >
|
|
1230
|
+
const truncated = rows.length > MAX_ROWS2;
|
|
1158
1231
|
return {
|
|
1159
1232
|
success: true,
|
|
1160
|
-
rowCount: Math.min(rows.length,
|
|
1233
|
+
rowCount: Math.min(rows.length, MAX_ROWS2),
|
|
1161
1234
|
truncated,
|
|
1162
|
-
rows: rows.slice(0,
|
|
1235
|
+
rows: rows.slice(0, MAX_ROWS2)
|
|
1163
1236
|
};
|
|
1164
1237
|
} finally {
|
|
1165
1238
|
await pool.end();
|
|
@@ -1296,9 +1369,9 @@ var MYSQL_DEFAULT_PORT = 3306;
|
|
|
1296
1369
|
|
|
1297
1370
|
// ../connectors/src/connectors/mysql/tools/execute-query.ts
|
|
1298
1371
|
import { z as z4 } from "zod";
|
|
1299
|
-
var
|
|
1372
|
+
var MAX_ROWS3 = 500;
|
|
1300
1373
|
var CONNECT_TIMEOUT_MS2 = 1e4;
|
|
1301
|
-
var
|
|
1374
|
+
var QUERY_TIMEOUT_MS2 = 6e4;
|
|
1302
1375
|
var inputSchema4 = z4.object({
|
|
1303
1376
|
toolUseIntent: z4.string().optional().describe(
|
|
1304
1377
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -1320,7 +1393,7 @@ var outputSchema4 = z4.discriminatedUnion("success", [
|
|
|
1320
1393
|
]);
|
|
1321
1394
|
var executeQueryTool4 = new ConnectorTool({
|
|
1322
1395
|
name: "executeQuery",
|
|
1323
|
-
description: `Execute SQL against MySQL. Returns up to ${
|
|
1396
|
+
description: `Execute SQL against MySQL. Returns up to ${MAX_ROWS3} rows.
|
|
1324
1397
|
Use for: schema exploration (information_schema), data sampling, analytical queries.
|
|
1325
1398
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
1326
1399
|
inputSchema: inputSchema4,
|
|
@@ -1353,16 +1426,16 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1353
1426
|
try {
|
|
1354
1427
|
const queryPromise = pool.query(sql);
|
|
1355
1428
|
const timeoutPromise = new Promise(
|
|
1356
|
-
(_, reject) => setTimeout(() => reject(new Error("Query timed out after 60 seconds")),
|
|
1429
|
+
(_, reject) => setTimeout(() => reject(new Error("Query timed out after 60 seconds")), QUERY_TIMEOUT_MS2)
|
|
1357
1430
|
);
|
|
1358
1431
|
const [rows] = await Promise.race([queryPromise, timeoutPromise]);
|
|
1359
1432
|
const resultRows = Array.isArray(rows) ? rows : [];
|
|
1360
|
-
const truncated = resultRows.length >
|
|
1433
|
+
const truncated = resultRows.length > MAX_ROWS3;
|
|
1361
1434
|
return {
|
|
1362
1435
|
success: true,
|
|
1363
|
-
rowCount: Math.min(resultRows.length,
|
|
1436
|
+
rowCount: Math.min(resultRows.length, MAX_ROWS3),
|
|
1364
1437
|
truncated,
|
|
1365
|
-
rows: resultRows.slice(0,
|
|
1438
|
+
rows: resultRows.slice(0, MAX_ROWS3)
|
|
1366
1439
|
};
|
|
1367
1440
|
} finally {
|
|
1368
1441
|
await pool.end();
|
|
@@ -1689,7 +1762,7 @@ var bigqueryOnboarding = new ConnectorOnboarding({
|
|
|
1689
1762
|
|
|
1690
1763
|
// ../connectors/src/connectors/bigquery/tools/execute-query.ts
|
|
1691
1764
|
import { z as z7 } from "zod";
|
|
1692
|
-
var
|
|
1765
|
+
var MAX_ROWS4 = 500;
|
|
1693
1766
|
var inputSchema7 = z7.object({
|
|
1694
1767
|
toolUseIntent: z7.string().optional().describe(
|
|
1695
1768
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -1713,7 +1786,7 @@ var outputSchema7 = z7.discriminatedUnion("success", [
|
|
|
1713
1786
|
]);
|
|
1714
1787
|
var executeQueryTool5 = new ConnectorTool({
|
|
1715
1788
|
name: "executeQuery",
|
|
1716
|
-
description: `Execute SQL against BigQuery. Returns up to ${
|
|
1789
|
+
description: `Execute SQL against BigQuery. Returns up to ${MAX_ROWS4} rows.
|
|
1717
1790
|
Use for: schema exploration (INFORMATION_SCHEMA), data sampling, analytical queries.
|
|
1718
1791
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
1719
1792
|
inputSchema: inputSchema7,
|
|
@@ -1740,12 +1813,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
1740
1813
|
const [job] = await bq.createQueryJob({ query: sql });
|
|
1741
1814
|
const [rows] = await job.getQueryResults();
|
|
1742
1815
|
const allRows = rows;
|
|
1743
|
-
const truncated = allRows.length >
|
|
1816
|
+
const truncated = allRows.length > MAX_ROWS4;
|
|
1744
1817
|
return {
|
|
1745
1818
|
success: true,
|
|
1746
|
-
rowCount: Math.min(allRows.length,
|
|
1819
|
+
rowCount: Math.min(allRows.length, MAX_ROWS4),
|
|
1747
1820
|
truncated,
|
|
1748
|
-
rows: allRows.slice(0,
|
|
1821
|
+
rows: allRows.slice(0, MAX_ROWS4)
|
|
1749
1822
|
};
|
|
1750
1823
|
} catch (err) {
|
|
1751
1824
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -2146,7 +2219,7 @@ var bigqueryOnboarding2 = new ConnectorOnboarding({
|
|
|
2146
2219
|
|
|
2147
2220
|
// ../connectors/src/connectors/bigquery-oauth/tools/execute-query.ts
|
|
2148
2221
|
import { z as z10 } from "zod";
|
|
2149
|
-
var
|
|
2222
|
+
var MAX_ROWS5 = 500;
|
|
2150
2223
|
var REQUEST_TIMEOUT_MS3 = 6e4;
|
|
2151
2224
|
var cachedToken3 = null;
|
|
2152
2225
|
async function getProxyToken3(config) {
|
|
@@ -2213,7 +2286,7 @@ function parseQueryResponse(data) {
|
|
|
2213
2286
|
}
|
|
2214
2287
|
var executeQueryTool6 = new ConnectorTool({
|
|
2215
2288
|
name: "executeQuery",
|
|
2216
|
-
description: `Execute SQL against BigQuery via OAuth. Returns up to ${
|
|
2289
|
+
description: `Execute SQL against BigQuery via OAuth. Returns up to ${MAX_ROWS5} rows.
|
|
2217
2290
|
Use for: schema exploration (INFORMATION_SCHEMA), data sampling, analytical queries.
|
|
2218
2291
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
2219
2292
|
inputSchema: inputSchema10,
|
|
@@ -2246,7 +2319,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2246
2319
|
body: JSON.stringify({
|
|
2247
2320
|
url: queryUrl,
|
|
2248
2321
|
method: "POST",
|
|
2249
|
-
body: { query: sql, useLegacySql: false, maxResults:
|
|
2322
|
+
body: { query: sql, useLegacySql: false, maxResults: MAX_ROWS5 }
|
|
2250
2323
|
}),
|
|
2251
2324
|
signal: controller.signal
|
|
2252
2325
|
});
|
|
@@ -2256,12 +2329,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2256
2329
|
return { success: false, error: errorMessage };
|
|
2257
2330
|
}
|
|
2258
2331
|
const rows = parseQueryResponse(data);
|
|
2259
|
-
const truncated = rows.length >
|
|
2332
|
+
const truncated = rows.length > MAX_ROWS5;
|
|
2260
2333
|
return {
|
|
2261
2334
|
success: true,
|
|
2262
|
-
rowCount: Math.min(rows.length,
|
|
2335
|
+
rowCount: Math.min(rows.length, MAX_ROWS5),
|
|
2263
2336
|
truncated,
|
|
2264
|
-
rows: rows.slice(0,
|
|
2337
|
+
rows: rows.slice(0, MAX_ROWS5)
|
|
2265
2338
|
};
|
|
2266
2339
|
} finally {
|
|
2267
2340
|
clearTimeout(timeout);
|
|
@@ -2441,7 +2514,7 @@ var parameters7 = {
|
|
|
2441
2514
|
|
|
2442
2515
|
// ../connectors/src/connectors/aws-athena/tools/execute-query.ts
|
|
2443
2516
|
import { z as z11 } from "zod";
|
|
2444
|
-
var
|
|
2517
|
+
var MAX_ROWS6 = 500;
|
|
2445
2518
|
var POLL_INTERVAL_MS = 1e3;
|
|
2446
2519
|
var POLL_TIMEOUT_MS = 12e4;
|
|
2447
2520
|
var inputSchema11 = z11.object({
|
|
@@ -2465,7 +2538,7 @@ var outputSchema11 = z11.discriminatedUnion("success", [
|
|
|
2465
2538
|
]);
|
|
2466
2539
|
var executeQueryTool7 = new ConnectorTool({
|
|
2467
2540
|
name: "executeQuery",
|
|
2468
|
-
description: `Execute SQL against AWS Athena. Returns up to ${
|
|
2541
|
+
description: `Execute SQL against AWS Athena. Returns up to ${MAX_ROWS6} rows.
|
|
2469
2542
|
Use for: schema exploration (SHOW DATABASES/TABLES, DESCRIBE TABLE), data sampling, analytical queries on S3 data.
|
|
2470
2543
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
2471
2544
|
inputSchema: inputSchema11,
|
|
@@ -2542,12 +2615,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
2542
2615
|
});
|
|
2543
2616
|
return obj;
|
|
2544
2617
|
});
|
|
2545
|
-
const truncated = dataRows.length >
|
|
2618
|
+
const truncated = dataRows.length > MAX_ROWS6;
|
|
2546
2619
|
return {
|
|
2547
2620
|
success: true,
|
|
2548
|
-
rowCount: Math.min(dataRows.length,
|
|
2621
|
+
rowCount: Math.min(dataRows.length, MAX_ROWS6),
|
|
2549
2622
|
truncated,
|
|
2550
|
-
rows: dataRows.slice(0,
|
|
2623
|
+
rows: dataRows.slice(0, MAX_ROWS6)
|
|
2551
2624
|
};
|
|
2552
2625
|
} catch (err) {
|
|
2553
2626
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -3462,7 +3535,7 @@ var parameters9 = {
|
|
|
3462
3535
|
|
|
3463
3536
|
// ../connectors/src/connectors/redshift/tools/execute-query.ts
|
|
3464
3537
|
import { z as z15 } from "zod";
|
|
3465
|
-
var
|
|
3538
|
+
var MAX_ROWS7 = 500;
|
|
3466
3539
|
var POLL_INTERVAL_MS2 = 1e3;
|
|
3467
3540
|
var POLL_TIMEOUT_MS2 = 12e4;
|
|
3468
3541
|
var inputSchema15 = z15.object({
|
|
@@ -3488,7 +3561,7 @@ var outputSchema15 = z15.discriminatedUnion("success", [
|
|
|
3488
3561
|
]);
|
|
3489
3562
|
var executeQueryTool8 = new ConnectorTool({
|
|
3490
3563
|
name: "executeQuery",
|
|
3491
|
-
description: `Execute SQL against Amazon Redshift. Returns up to ${
|
|
3564
|
+
description: `Execute SQL against Amazon Redshift. Returns up to ${MAX_ROWS7} rows.
|
|
3492
3565
|
Use for: schema exploration, data sampling, analytical queries.
|
|
3493
3566
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
3494
3567
|
inputSchema: inputSchema15,
|
|
@@ -3567,12 +3640,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
3567
3640
|
});
|
|
3568
3641
|
return row;
|
|
3569
3642
|
});
|
|
3570
|
-
const truncated = allRows.length >
|
|
3643
|
+
const truncated = allRows.length > MAX_ROWS7;
|
|
3571
3644
|
return {
|
|
3572
3645
|
success: true,
|
|
3573
|
-
rowCount: Math.min(allRows.length,
|
|
3646
|
+
rowCount: Math.min(allRows.length, MAX_ROWS7),
|
|
3574
3647
|
truncated,
|
|
3575
|
-
rows: allRows.slice(0,
|
|
3648
|
+
rows: allRows.slice(0, MAX_ROWS7)
|
|
3576
3649
|
};
|
|
3577
3650
|
} catch (err) {
|
|
3578
3651
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -3793,7 +3866,7 @@ var parameters10 = {
|
|
|
3793
3866
|
|
|
3794
3867
|
// ../connectors/src/connectors/databricks/tools/execute-query.ts
|
|
3795
3868
|
import { z as z16 } from "zod";
|
|
3796
|
-
var
|
|
3869
|
+
var MAX_ROWS8 = 500;
|
|
3797
3870
|
var inputSchema16 = z16.object({
|
|
3798
3871
|
toolUseIntent: z16.string().optional().describe(
|
|
3799
3872
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -3815,7 +3888,7 @@ var outputSchema16 = z16.discriminatedUnion("success", [
|
|
|
3815
3888
|
]);
|
|
3816
3889
|
var executeQueryTool9 = new ConnectorTool({
|
|
3817
3890
|
name: "executeQuery",
|
|
3818
|
-
description: `Execute SQL against Databricks. Returns up to ${
|
|
3891
|
+
description: `Execute SQL against Databricks. Returns up to ${MAX_ROWS8} rows.
|
|
3819
3892
|
Use for: schema exploration (SHOW CATALOGS/DATABASES/TABLES, DESCRIBE TABLE), data sampling, analytical queries.
|
|
3820
3893
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
3821
3894
|
inputSchema: inputSchema16,
|
|
@@ -3846,12 +3919,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
3846
3919
|
runAsync: true
|
|
3847
3920
|
});
|
|
3848
3921
|
const allRows = await operation.fetchAll();
|
|
3849
|
-
const truncated = allRows.length >
|
|
3922
|
+
const truncated = allRows.length > MAX_ROWS8;
|
|
3850
3923
|
return {
|
|
3851
3924
|
success: true,
|
|
3852
|
-
rowCount: Math.min(allRows.length,
|
|
3925
|
+
rowCount: Math.min(allRows.length, MAX_ROWS8),
|
|
3853
3926
|
truncated,
|
|
3854
|
-
rows: allRows.slice(0,
|
|
3927
|
+
rows: allRows.slice(0, MAX_ROWS8)
|
|
3855
3928
|
};
|
|
3856
3929
|
} finally {
|
|
3857
3930
|
if (operation) await operation.close().catch(() => {
|
|
@@ -10796,7 +10869,7 @@ var parameters29 = {
|
|
|
10796
10869
|
|
|
10797
10870
|
// ../connectors/src/connectors/squadbase-db/tools/execute-query.ts
|
|
10798
10871
|
import { z as z40 } from "zod";
|
|
10799
|
-
var
|
|
10872
|
+
var MAX_ROWS9 = 500;
|
|
10800
10873
|
var CONNECT_TIMEOUT_MS3 = 1e4;
|
|
10801
10874
|
var STATEMENT_TIMEOUT_MS2 = 6e4;
|
|
10802
10875
|
var inputSchema40 = z40.object({
|
|
@@ -10820,7 +10893,7 @@ var outputSchema40 = z40.discriminatedUnion("success", [
|
|
|
10820
10893
|
]);
|
|
10821
10894
|
var executeQueryTool10 = new ConnectorTool({
|
|
10822
10895
|
name: "executeQuery",
|
|
10823
|
-
description: `Execute SQL against Squadbase DB (PostgreSQL). Returns up to ${
|
|
10896
|
+
description: `Execute SQL against Squadbase DB (PostgreSQL). Returns up to ${MAX_ROWS9} rows.
|
|
10824
10897
|
Use for: schema exploration (information_schema), data sampling, analytical queries.
|
|
10825
10898
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
10826
10899
|
inputSchema: inputSchema40,
|
|
@@ -10849,12 +10922,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
10849
10922
|
try {
|
|
10850
10923
|
const result = await pool.query(sql);
|
|
10851
10924
|
const rows = result.rows;
|
|
10852
|
-
const truncated = rows.length >
|
|
10925
|
+
const truncated = rows.length > MAX_ROWS9;
|
|
10853
10926
|
return {
|
|
10854
10927
|
success: true,
|
|
10855
|
-
rowCount: Math.min(rows.length,
|
|
10928
|
+
rowCount: Math.min(rows.length, MAX_ROWS9),
|
|
10856
10929
|
truncated,
|
|
10857
|
-
rows: rows.slice(0,
|
|
10930
|
+
rows: rows.slice(0, MAX_ROWS9)
|
|
10858
10931
|
};
|
|
10859
10932
|
} finally {
|
|
10860
10933
|
await pool.end();
|
|
@@ -13628,8 +13701,8 @@ var parameters41 = {
|
|
|
13628
13701
|
|
|
13629
13702
|
// ../connectors/src/connectors/clickhouse/tools/execute-query.ts
|
|
13630
13703
|
import { z as z49 } from "zod";
|
|
13631
|
-
var
|
|
13632
|
-
var
|
|
13704
|
+
var MAX_ROWS10 = 500;
|
|
13705
|
+
var QUERY_TIMEOUT_MS3 = 6e4;
|
|
13633
13706
|
var inputSchema49 = z49.object({
|
|
13634
13707
|
toolUseIntent: z49.string().optional().describe(
|
|
13635
13708
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -13651,7 +13724,7 @@ var outputSchema49 = z49.discriminatedUnion("success", [
|
|
|
13651
13724
|
]);
|
|
13652
13725
|
var executeQueryTool11 = new ConnectorTool({
|
|
13653
13726
|
name: "executeQuery",
|
|
13654
|
-
description: `Execute SQL against ClickHouse. Returns up to ${
|
|
13727
|
+
description: `Execute SQL against ClickHouse. Returns up to ${MAX_ROWS10} rows.
|
|
13655
13728
|
Use for: schema exploration (SHOW DATABASES, SHOW TABLES, DESCRIBE TABLE), data sampling, analytical queries on large-scale columnar data.
|
|
13656
13729
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
13657
13730
|
inputSchema: inputSchema49,
|
|
@@ -13679,7 +13752,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
13679
13752
|
username,
|
|
13680
13753
|
password: password || "",
|
|
13681
13754
|
database: database || "default",
|
|
13682
|
-
request_timeout:
|
|
13755
|
+
request_timeout: QUERY_TIMEOUT_MS3
|
|
13683
13756
|
});
|
|
13684
13757
|
try {
|
|
13685
13758
|
const resultSet = await client.query({
|
|
@@ -13687,12 +13760,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
13687
13760
|
format: "JSONEachRow"
|
|
13688
13761
|
});
|
|
13689
13762
|
const allRows = await resultSet.json();
|
|
13690
|
-
const truncated = allRows.length >
|
|
13763
|
+
const truncated = allRows.length > MAX_ROWS10;
|
|
13691
13764
|
return {
|
|
13692
13765
|
success: true,
|
|
13693
|
-
rowCount: Math.min(allRows.length,
|
|
13766
|
+
rowCount: Math.min(allRows.length, MAX_ROWS10),
|
|
13694
13767
|
truncated,
|
|
13695
|
-
rows: allRows.slice(0,
|
|
13768
|
+
rows: allRows.slice(0, MAX_ROWS10)
|
|
13696
13769
|
};
|
|
13697
13770
|
} finally {
|
|
13698
13771
|
await client.close();
|
|
@@ -13848,7 +13921,7 @@ var parameters42 = {
|
|
|
13848
13921
|
import { z as z50 } from "zod";
|
|
13849
13922
|
var MAX_DOCUMENTS = 500;
|
|
13850
13923
|
var CONNECT_TIMEOUT_MS4 = 1e4;
|
|
13851
|
-
var
|
|
13924
|
+
var QUERY_TIMEOUT_MS4 = 6e4;
|
|
13852
13925
|
var inputSchema50 = z50.object({
|
|
13853
13926
|
toolUseIntent: z50.string().optional().describe(
|
|
13854
13927
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -13907,7 +13980,7 @@ For listing collections, use the aggregate tool with an empty pipeline on the sp
|
|
|
13907
13980
|
const client = new MongoClient(connectionUrl, {
|
|
13908
13981
|
connectTimeoutMS: CONNECT_TIMEOUT_MS4,
|
|
13909
13982
|
serverSelectionTimeoutMS: CONNECT_TIMEOUT_MS4,
|
|
13910
|
-
socketTimeoutMS:
|
|
13983
|
+
socketTimeoutMS: QUERY_TIMEOUT_MS4
|
|
13911
13984
|
});
|
|
13912
13985
|
try {
|
|
13913
13986
|
await client.connect();
|
|
@@ -13953,7 +14026,7 @@ For listing collections, use the aggregate tool with an empty pipeline on the sp
|
|
|
13953
14026
|
import { z as z51 } from "zod";
|
|
13954
14027
|
var MAX_DOCUMENTS2 = 500;
|
|
13955
14028
|
var CONNECT_TIMEOUT_MS5 = 1e4;
|
|
13956
|
-
var
|
|
14029
|
+
var QUERY_TIMEOUT_MS5 = 6e4;
|
|
13957
14030
|
var inputSchema51 = z51.object({
|
|
13958
14031
|
toolUseIntent: z51.string().optional().describe(
|
|
13959
14032
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -14004,7 +14077,7 @@ Common stages: $match (filter), $group (aggregate), $sort (order), $project (res
|
|
|
14004
14077
|
const client = new MongoClient(connectionUrl, {
|
|
14005
14078
|
connectTimeoutMS: CONNECT_TIMEOUT_MS5,
|
|
14006
14079
|
serverSelectionTimeoutMS: CONNECT_TIMEOUT_MS5,
|
|
14007
|
-
socketTimeoutMS:
|
|
14080
|
+
socketTimeoutMS: QUERY_TIMEOUT_MS5
|
|
14008
14081
|
});
|
|
14009
14082
|
try {
|
|
14010
14083
|
await client.connect();
|
|
@@ -23233,7 +23306,7 @@ function redactJdbcUrl(jdbcUrl) {
|
|
|
23233
23306
|
}
|
|
23234
23307
|
|
|
23235
23308
|
// ../connectors/src/connectors/jdbc/tools/execute-query.ts
|
|
23236
|
-
var
|
|
23309
|
+
var MAX_ROWS11 = 500;
|
|
23237
23310
|
var CONNECT_TIMEOUT_MS7 = 1e4;
|
|
23238
23311
|
var STATEMENT_TIMEOUT_MS3 = 6e4;
|
|
23239
23312
|
var inputSchema82 = z82.object({
|
|
@@ -23259,7 +23332,7 @@ var outputSchema82 = z82.discriminatedUnion("success", [
|
|
|
23259
23332
|
]);
|
|
23260
23333
|
var executeQueryTool12 = new ConnectorTool({
|
|
23261
23334
|
name: "executeQuery",
|
|
23262
|
-
description: `Execute a SQL query through the JDBC connector. Returns up to ${
|
|
23335
|
+
description: `Execute a SQL query through the JDBC connector. Returns up to ${MAX_ROWS11} rows.
|
|
23263
23336
|
Use for: schema exploration via \`information_schema\` (or USER_TABLES on Oracle), data sampling, analytical queries.
|
|
23264
23337
|
The connector dispatches by JDBC URL prefix to the matching driver
|
|
23265
23338
|
(PostgreSQL / Redshift / MySQL / MariaDB / SQL Server / Oracle), so use the dialect that matches the connection.
|
|
@@ -23300,9 +23373,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
23300
23373
|
const rows = result.rows;
|
|
23301
23374
|
return {
|
|
23302
23375
|
success: true,
|
|
23303
|
-
rowCount: Math.min(rows.length,
|
|
23304
|
-
truncated: rows.length >
|
|
23305
|
-
rows: rows.slice(0,
|
|
23376
|
+
rowCount: Math.min(rows.length, MAX_ROWS11),
|
|
23377
|
+
truncated: rows.length > MAX_ROWS11,
|
|
23378
|
+
rows: rows.slice(0, MAX_ROWS11)
|
|
23306
23379
|
};
|
|
23307
23380
|
}
|
|
23308
23381
|
if (parsed.driver === "oracle") {
|
|
@@ -23317,9 +23390,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
23317
23390
|
const rows = result.rows;
|
|
23318
23391
|
return {
|
|
23319
23392
|
success: true,
|
|
23320
|
-
rowCount: Math.min(rows.length,
|
|
23321
|
-
truncated: rows.length >
|
|
23322
|
-
rows: rows.slice(0,
|
|
23393
|
+
rowCount: Math.min(rows.length, MAX_ROWS11),
|
|
23394
|
+
truncated: rows.length > MAX_ROWS11,
|
|
23395
|
+
rows: rows.slice(0, MAX_ROWS11)
|
|
23323
23396
|
};
|
|
23324
23397
|
}
|
|
23325
23398
|
let tunnel;
|
|
@@ -23343,12 +23416,12 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
23343
23416
|
STATEMENT_TIMEOUT_MS3
|
|
23344
23417
|
);
|
|
23345
23418
|
const rows = result.rows;
|
|
23346
|
-
const truncated = rows.length >
|
|
23419
|
+
const truncated = rows.length > MAX_ROWS11;
|
|
23347
23420
|
return {
|
|
23348
23421
|
success: true,
|
|
23349
|
-
rowCount: Math.min(rows.length,
|
|
23422
|
+
rowCount: Math.min(rows.length, MAX_ROWS11),
|
|
23350
23423
|
truncated,
|
|
23351
|
-
rows: rows.slice(0,
|
|
23424
|
+
rows: rows.slice(0, MAX_ROWS11)
|
|
23352
23425
|
};
|
|
23353
23426
|
} finally {
|
|
23354
23427
|
await pool2.end();
|
|
@@ -23369,12 +23442,12 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
|
|
|
23369
23442
|
);
|
|
23370
23443
|
const [rows] = await Promise.race([queryPromise, timeoutPromise]);
|
|
23371
23444
|
const resultRows = Array.isArray(rows) ? rows : [];
|
|
23372
|
-
const truncated = resultRows.length >
|
|
23445
|
+
const truncated = resultRows.length > MAX_ROWS11;
|
|
23373
23446
|
return {
|
|
23374
23447
|
success: true,
|
|
23375
|
-
rowCount: Math.min(resultRows.length,
|
|
23448
|
+
rowCount: Math.min(resultRows.length, MAX_ROWS11),
|
|
23376
23449
|
truncated,
|
|
23377
|
-
rows: resultRows.slice(0,
|
|
23450
|
+
rows: resultRows.slice(0, MAX_ROWS11)
|
|
23378
23451
|
};
|
|
23379
23452
|
} finally {
|
|
23380
23453
|
await pool.end();
|
|
@@ -24643,7 +24716,7 @@ var parameters70 = {
|
|
|
24643
24716
|
|
|
24644
24717
|
// ../connectors/src/connectors/supabase/tools/execute-query.ts
|
|
24645
24718
|
import { z as z86 } from "zod";
|
|
24646
|
-
var
|
|
24719
|
+
var MAX_ROWS12 = 500;
|
|
24647
24720
|
var CONNECT_TIMEOUT_MS8 = 1e4;
|
|
24648
24721
|
var STATEMENT_TIMEOUT_MS4 = 6e4;
|
|
24649
24722
|
var inputSchema86 = z86.object({
|
|
@@ -24669,7 +24742,7 @@ var outputSchema86 = z86.discriminatedUnion("success", [
|
|
|
24669
24742
|
]);
|
|
24670
24743
|
var executeQueryTool13 = new ConnectorTool({
|
|
24671
24744
|
name: "executeQuery",
|
|
24672
|
-
description: `Execute SQL against a Supabase Postgres database. Returns up to ${
|
|
24745
|
+
description: `Execute SQL against a Supabase Postgres database. Returns up to ${MAX_ROWS12} rows.
|
|
24673
24746
|
Use for: schema exploration (information_schema), data sampling, and analytical queries against Supabase tables.
|
|
24674
24747
|
User tables live in the \`public\` schema by default; Supabase-managed metadata lives in \`auth\` and \`storage\`.
|
|
24675
24748
|
Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
@@ -24699,12 +24772,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
|
|
|
24699
24772
|
try {
|
|
24700
24773
|
const result = await pool.query(sql);
|
|
24701
24774
|
const rows = result.rows;
|
|
24702
|
-
const truncated = rows.length >
|
|
24775
|
+
const truncated = rows.length > MAX_ROWS12;
|
|
24703
24776
|
return {
|
|
24704
24777
|
success: true,
|
|
24705
|
-
rowCount: Math.min(rows.length,
|
|
24778
|
+
rowCount: Math.min(rows.length, MAX_ROWS12),
|
|
24706
24779
|
truncated,
|
|
24707
|
-
rows: rows.slice(0,
|
|
24780
|
+
rows: rows.slice(0, MAX_ROWS12)
|
|
24708
24781
|
};
|
|
24709
24782
|
} finally {
|
|
24710
24783
|
await pool.end();
|
|
@@ -25183,7 +25256,7 @@ var parameters72 = {
|
|
|
25183
25256
|
|
|
25184
25257
|
// ../connectors/src/connectors/sqlserver/tools/execute-query.ts
|
|
25185
25258
|
import { z as z88 } from "zod";
|
|
25186
|
-
var
|
|
25259
|
+
var MAX_ROWS13 = 500;
|
|
25187
25260
|
var inputSchema88 = z88.object({
|
|
25188
25261
|
toolUseIntent: z88.string().optional().describe(
|
|
25189
25262
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -25207,7 +25280,7 @@ var outputSchema88 = z88.discriminatedUnion("success", [
|
|
|
25207
25280
|
]);
|
|
25208
25281
|
var executeQueryTool14 = new ConnectorTool({
|
|
25209
25282
|
name: "executeQuery",
|
|
25210
|
-
description: `Execute a T-SQL query against Microsoft SQL Server. Returns up to ${
|
|
25283
|
+
description: `Execute a T-SQL query against Microsoft SQL Server. Returns up to ${MAX_ROWS13} rows.
|
|
25211
25284
|
Use for: schema exploration via \`INFORMATION_SCHEMA\`, data sampling, and analytical queries.
|
|
25212
25285
|
SQL Server uses \`TOP n\` instead of \`LIMIT n\`. Identifiers can be wrapped in square brackets (\`[schema].[table]\`).
|
|
25213
25286
|
Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
@@ -25240,12 +25313,12 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
|
25240
25313
|
const { rows } = await runMssqlQuery(parsed, sql, {
|
|
25241
25314
|
tunnelParams: connectionParamsToRecord(connection)
|
|
25242
25315
|
});
|
|
25243
|
-
const truncated = rows.length >
|
|
25316
|
+
const truncated = rows.length > MAX_ROWS13;
|
|
25244
25317
|
return {
|
|
25245
25318
|
success: true,
|
|
25246
|
-
rowCount: Math.min(rows.length,
|
|
25319
|
+
rowCount: Math.min(rows.length, MAX_ROWS13),
|
|
25247
25320
|
truncated,
|
|
25248
|
-
rows: rows.slice(0,
|
|
25321
|
+
rows: rows.slice(0, MAX_ROWS13)
|
|
25249
25322
|
};
|
|
25250
25323
|
} catch (err) {
|
|
25251
25324
|
let msg = err instanceof Error ? err.message : String(err);
|
|
@@ -25378,7 +25451,7 @@ var parameters73 = {
|
|
|
25378
25451
|
|
|
25379
25452
|
// ../connectors/src/connectors/azure-sql/tools/execute-query.ts
|
|
25380
25453
|
import { z as z89 } from "zod";
|
|
25381
|
-
var
|
|
25454
|
+
var MAX_ROWS14 = 500;
|
|
25382
25455
|
var inputSchema89 = z89.object({
|
|
25383
25456
|
toolUseIntent: z89.string().optional().describe(
|
|
25384
25457
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -25402,7 +25475,7 @@ var outputSchema89 = z89.discriminatedUnion("success", [
|
|
|
25402
25475
|
]);
|
|
25403
25476
|
var executeQueryTool15 = new ConnectorTool({
|
|
25404
25477
|
name: "executeQuery",
|
|
25405
|
-
description: `Execute a T-SQL query against Azure SQL Database. Returns up to ${
|
|
25478
|
+
description: `Execute a T-SQL query against Azure SQL Database. Returns up to ${MAX_ROWS14} rows.
|
|
25406
25479
|
Use for: schema exploration via \`INFORMATION_SCHEMA\`, data sampling, and analytical queries.
|
|
25407
25480
|
Azure SQL is T-SQL: use \`TOP n\` instead of \`LIMIT n\`. Identifiers can be wrapped in square brackets.
|
|
25408
25481
|
Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
@@ -25436,12 +25509,12 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
|
|
|
25436
25509
|
forceEncrypt: true,
|
|
25437
25510
|
tunnelParams: connectionParamsToRecord(connection)
|
|
25438
25511
|
});
|
|
25439
|
-
const truncated = rows.length >
|
|
25512
|
+
const truncated = rows.length > MAX_ROWS14;
|
|
25440
25513
|
return {
|
|
25441
25514
|
success: true,
|
|
25442
|
-
rowCount: Math.min(rows.length,
|
|
25515
|
+
rowCount: Math.min(rows.length, MAX_ROWS14),
|
|
25443
25516
|
truncated,
|
|
25444
|
-
rows: rows.slice(0,
|
|
25517
|
+
rows: rows.slice(0, MAX_ROWS14)
|
|
25445
25518
|
};
|
|
25446
25519
|
} catch (err) {
|
|
25447
25520
|
let msg = err instanceof Error ? err.message : String(err);
|
|
@@ -25918,7 +25991,7 @@ var parameters75 = {
|
|
|
25918
25991
|
|
|
25919
25992
|
// ../connectors/src/connectors/oracle/tools/execute-query.ts
|
|
25920
25993
|
import { z as z92 } from "zod";
|
|
25921
|
-
var
|
|
25994
|
+
var MAX_ROWS15 = 500;
|
|
25922
25995
|
var inputSchema92 = z92.object({
|
|
25923
25996
|
toolUseIntent: z92.string().optional().describe(
|
|
25924
25997
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -25942,7 +26015,7 @@ var outputSchema92 = z92.discriminatedUnion("success", [
|
|
|
25942
26015
|
]);
|
|
25943
26016
|
var executeQueryTool16 = new ConnectorTool({
|
|
25944
26017
|
name: "executeQuery",
|
|
25945
|
-
description: `Execute a query against an Oracle Database. Returns up to ${
|
|
26018
|
+
description: `Execute a query against an Oracle Database. Returns up to ${MAX_ROWS15} rows.
|
|
25946
26019
|
Use for: schema exploration via \`USER_TABLES\` / \`USER_TAB_COLUMNS\` / \`ALL_TABLES\`, data sampling, and analytical queries.
|
|
25947
26020
|
Oracle uses \`FETCH FIRST n ROWS ONLY\` (12c+) or \`ROWNUM\` for row limiting \u2014 there is no \`LIMIT\` keyword.
|
|
25948
26021
|
Unquoted identifiers are stored upper-case (\`SELECT * FROM employees\` resolves to \`EMPLOYEES\`).
|
|
@@ -25977,12 +26050,12 @@ Do NOT terminate statements with a semicolon; the driver rejects trailing termin
|
|
|
25977
26050
|
const { rows } = await runOracleQuery(parsed, cleanSql, {
|
|
25978
26051
|
tunnelParams: connectionParamsToRecord(connection)
|
|
25979
26052
|
});
|
|
25980
|
-
const truncated = rows.length >
|
|
26053
|
+
const truncated = rows.length > MAX_ROWS15;
|
|
25981
26054
|
return {
|
|
25982
26055
|
success: true,
|
|
25983
|
-
rowCount: Math.min(rows.length,
|
|
26056
|
+
rowCount: Math.min(rows.length, MAX_ROWS15),
|
|
25984
26057
|
truncated,
|
|
25985
|
-
rows: rows.slice(0,
|
|
26058
|
+
rows: rows.slice(0, MAX_ROWS15)
|
|
25986
26059
|
};
|
|
25987
26060
|
} catch (err) {
|
|
25988
26061
|
let msg = err instanceof Error ? err.message : String(err);
|
|
@@ -26001,7 +26074,7 @@ var oracleConnector = new ConnectorPlugin({
|
|
|
26001
26074
|
description: "Connect to Oracle Database using a JDBC-style URL via the pure-JS Thin driver (no Oracle Instant Client required).",
|
|
26002
26075
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3iGEdzvGHncU5bYqFOROiV/9e7bdda7230d7ca6b34e7f6a862de876/oracle-icon.webp",
|
|
26003
26076
|
parameters: parameters75,
|
|
26004
|
-
releaseFlag: { dev1: true, dev2:
|
|
26077
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
26005
26078
|
categories: ["database"],
|
|
26006
26079
|
onboarding: oracleOnboarding,
|
|
26007
26080
|
systemPrompt: {
|