@cyanheads/brapi-mcp-server 0.6.4 → 0.7.1

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.
Files changed (74) hide show
  1. package/CLAUDE.md +11 -4
  2. package/README.md +10 -6
  3. package/changelog/0.7.x/0.7.0.md +23 -0
  4. package/changelog/0.7.x/0.7.1.md +17 -0
  5. package/dist/index.js +2 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/mcp-server/resources/definitions/brapi-variable.resource.d.ts +30 -0
  8. package/dist/mcp-server/resources/definitions/brapi-variable.resource.d.ts.map +1 -0
  9. package/dist/mcp-server/resources/definitions/brapi-variable.resource.js +78 -0
  10. package/dist/mcp-server/resources/definitions/brapi-variable.resource.js.map +1 -0
  11. package/dist/mcp-server/tools/definitions/brapi-build-phenotype-matrix.tool.d.ts +82 -0
  12. package/dist/mcp-server/tools/definitions/brapi-build-phenotype-matrix.tool.d.ts.map +1 -0
  13. package/dist/mcp-server/tools/definitions/brapi-build-phenotype-matrix.tool.js +366 -0
  14. package/dist/mcp-server/tools/definitions/brapi-build-phenotype-matrix.tool.js.map +1 -0
  15. package/dist/mcp-server/tools/definitions/brapi-export-genotype-matrix.tool.d.ts +89 -0
  16. package/dist/mcp-server/tools/definitions/brapi-export-genotype-matrix.tool.d.ts.map +1 -0
  17. package/dist/mcp-server/tools/definitions/brapi-export-genotype-matrix.tool.js +494 -0
  18. package/dist/mcp-server/tools/definitions/brapi-export-genotype-matrix.tool.js.map +1 -0
  19. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.d.ts +1 -0
  20. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.d.ts.map +1 -1
  21. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.js +17 -93
  22. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.js.map +1 -1
  23. package/dist/mcp-server/tools/definitions/brapi-find-germplasm.tool.d.ts +1 -0
  24. package/dist/mcp-server/tools/definitions/brapi-find-germplasm.tool.d.ts.map +1 -1
  25. package/dist/mcp-server/tools/definitions/brapi-find-images.tool.d.ts +1 -0
  26. package/dist/mcp-server/tools/definitions/brapi-find-images.tool.d.ts.map +1 -1
  27. package/dist/mcp-server/tools/definitions/brapi-find-locations.tool.d.ts +1 -0
  28. package/dist/mcp-server/tools/definitions/brapi-find-locations.tool.d.ts.map +1 -1
  29. package/dist/mcp-server/tools/definitions/brapi-find-observations.tool.d.ts +1 -0
  30. package/dist/mcp-server/tools/definitions/brapi-find-observations.tool.d.ts.map +1 -1
  31. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.d.ts +1 -0
  32. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.d.ts.map +1 -1
  33. package/dist/mcp-server/tools/definitions/brapi-find-variables.tool.d.ts +1 -0
  34. package/dist/mcp-server/tools/definitions/brapi-find-variables.tool.d.ts.map +1 -1
  35. package/dist/mcp-server/tools/definitions/brapi-find-variants.tool.d.ts +1 -0
  36. package/dist/mcp-server/tools/definitions/brapi-find-variants.tool.d.ts.map +1 -1
  37. package/dist/mcp-server/tools/definitions/brapi-germplasm-performance.tool.d.ts +60 -0
  38. package/dist/mcp-server/tools/definitions/brapi-germplasm-performance.tool.d.ts.map +1 -0
  39. package/dist/mcp-server/tools/definitions/brapi-germplasm-performance.tool.js +416 -0
  40. package/dist/mcp-server/tools/definitions/brapi-germplasm-performance.tool.js.map +1 -0
  41. package/dist/mcp-server/tools/definitions/brapi-raw-get.tool.d.ts +1 -0
  42. package/dist/mcp-server/tools/definitions/brapi-raw-get.tool.d.ts.map +1 -1
  43. package/dist/mcp-server/tools/definitions/brapi-raw-search.tool.d.ts +1 -0
  44. package/dist/mcp-server/tools/definitions/brapi-raw-search.tool.d.ts.map +1 -1
  45. package/dist/mcp-server/tools/definitions/brapi-walk-pedigree.tool.d.ts.map +1 -1
  46. package/dist/mcp-server/tools/definitions/brapi-walk-pedigree.tool.js +19 -6
  47. package/dist/mcp-server/tools/definitions/brapi-walk-pedigree.tool.js.map +1 -1
  48. package/dist/mcp-server/tools/definitions/index.d.ts +160 -0
  49. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
  50. package/dist/mcp-server/tools/definitions/index.js +6 -0
  51. package/dist/mcp-server/tools/definitions/index.js.map +1 -1
  52. package/dist/mcp-server/tools/shared/canvas-columns.d.ts +55 -0
  53. package/dist/mcp-server/tools/shared/canvas-columns.d.ts.map +1 -0
  54. package/dist/mcp-server/tools/shared/canvas-columns.js +151 -0
  55. package/dist/mcp-server/tools/shared/canvas-columns.js.map +1 -0
  56. package/dist/mcp-server/tools/shared/find-helpers.d.ts +1 -0
  57. package/dist/mcp-server/tools/shared/find-helpers.d.ts.map +1 -1
  58. package/dist/mcp-server/tools/shared/find-helpers.js +12 -0
  59. package/dist/mcp-server/tools/shared/find-helpers.js.map +1 -1
  60. package/dist/mcp-server/tools/shared/genotype-calls.d.ts +81 -0
  61. package/dist/mcp-server/tools/shared/genotype-calls.d.ts.map +1 -0
  62. package/dist/mcp-server/tools/shared/genotype-calls.js +172 -0
  63. package/dist/mcp-server/tools/shared/genotype-calls.js.map +1 -0
  64. package/dist/mcp-server/tools/shared/observations.d.ts +87 -0
  65. package/dist/mcp-server/tools/shared/observations.d.ts.map +1 -0
  66. package/dist/mcp-server/tools/shared/observations.js +285 -0
  67. package/dist/mcp-server/tools/shared/observations.js.map +1 -0
  68. package/dist/services/canvas-bridge/canvas-bridge.d.ts +6 -0
  69. package/dist/services/canvas-bridge/canvas-bridge.d.ts.map +1 -1
  70. package/dist/services/canvas-bridge/canvas-bridge.js +10 -2
  71. package/dist/services/canvas-bridge/canvas-bridge.js.map +1 -1
  72. package/manifest.json +1 -1
  73. package/package.json +3 -3
  74. package/server.json +3 -3
@@ -230,6 +230,66 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
230
230
  readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
231
231
  readonly when: "Upstream returned no study record for the requested DbId";
232
232
  readonly recovery: "Verify the studyDbId on the target server, or run brapi_find_studies to discover valid IDs.";
233
+ }], undefined> | import("@cyanheads/mcp-ts-core").ToolDefinition<import("zod").ZodObject<{
234
+ alias: import("zod").ZodOptional<import("zod").ZodString>;
235
+ studies: import("zod").ZodArray<import("zod").ZodString>;
236
+ variables: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
237
+ germplasm: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
238
+ shape: import("zod").ZodDefault<import("zod").ZodEnum<{
239
+ wide: "wide";
240
+ long: "long";
241
+ }>>;
242
+ aggregate: import("zod").ZodDefault<import("zod").ZodEnum<{
243
+ all: "all";
244
+ mean: "mean";
245
+ median: "median";
246
+ first: "first";
247
+ }>>;
248
+ loadLimit: import("zod").ZodOptional<import("zod").ZodNumber>;
249
+ extraFilters: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
250
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
251
+ alias: import("zod").ZodString;
252
+ studies: import("zod").ZodArray<import("zod").ZodString>;
253
+ shape: import("zod").ZodEnum<{
254
+ wide: "wide";
255
+ long: "long";
256
+ }>;
257
+ aggregate: import("zod").ZodEnum<{
258
+ all: "all";
259
+ mean: "mean";
260
+ median: "median";
261
+ first: "first";
262
+ }>;
263
+ observationCount: import("zod").ZodNumber;
264
+ germplasmCount: import("zod").ZodNumber;
265
+ variableCount: import("zod").ZodNumber;
266
+ variableLegend: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>;
267
+ dataframe: import("zod").ZodOptional<import("zod").ZodObject<{
268
+ tableName: import("zod").ZodString;
269
+ rowCount: import("zod").ZodNumber;
270
+ columns: import("zod").ZodArray<import("zod").ZodString>;
271
+ columnLegend: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
272
+ createdAt: import("zod").ZodString;
273
+ expiresAt: import("zod").ZodString;
274
+ truncated: import("zod").ZodOptional<import("zod").ZodBoolean>;
275
+ maxRows: import("zod").ZodOptional<import("zod").ZodNumber>;
276
+ }, import("zod/v4/core").$strip>>;
277
+ warnings: import("zod").ZodArray<import("zod").ZodString>;
278
+ }, import("zod/v4/core").$strip>, readonly [{
279
+ readonly reason: "unknown_alias";
280
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
281
+ readonly when: "No connection has been registered under the requested alias";
282
+ readonly recovery: "Run brapi_connect with this alias (or omit `alias` to use the default connection) before calling brapi_build_phenotype_matrix.";
283
+ }, {
284
+ readonly reason: "all_filters_dropped";
285
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
286
+ readonly when: "The active dialect dropped every filter supplied — the call would silently widen to the unfiltered baseline";
287
+ readonly recovery: "Drop unsupported filters or use studies / germplasm / variables to scope the query to supported filter paths on the active dialect.";
288
+ }, {
289
+ readonly reason: "no_observation_path";
290
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ServiceUnavailable;
291
+ readonly when: "Neither /observations nor /observationunits returned data for any requested study after probing both paths";
292
+ readonly recovery: "Verify the studyDbIds exist and the BrAPI server exposes /observations or /observationunits. Use brapi_server_info to inspect the capability list.";
233
293
  }], undefined> | import("@cyanheads/mcp-ts-core").ToolDefinition<import("zod").ZodObject<{
234
294
  baseUrl: import("zod").ZodOptional<import("zod").ZodString>;
235
295
  auth: import("zod").ZodOptional<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
@@ -363,6 +423,62 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
363
423
  readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
364
424
  readonly when: "SQL violated read-only rules (multi-statement, non-SELECT, or disallowed operation)";
365
425
  readonly recovery: "Submit a single SELECT statement using only registered dataframes. For changes, use `registerAs` in this tool to materialize a result, or brapi_dataframe_drop to remove a dataframe.";
426
+ }], undefined> | import("@cyanheads/mcp-ts-core").ToolDefinition<import("zod").ZodObject<{
427
+ alias: import("zod").ZodOptional<import("zod").ZodString>;
428
+ germplasmDbIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
429
+ variantSetDbId: import("zod").ZodString;
430
+ format: import("zod").ZodEnum<{
431
+ plink: "plink";
432
+ "vcf-lite": "vcf-lite";
433
+ "matrix-json": "matrix-json";
434
+ }>;
435
+ maxCalls: import("zod").ZodOptional<import("zod").ZodNumber>;
436
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
437
+ alias: import("zod").ZodString;
438
+ format: import("zod").ZodEnum<{
439
+ plink: "plink";
440
+ "vcf-lite": "vcf-lite";
441
+ "matrix-json": "matrix-json";
442
+ }>;
443
+ rowCount: import("zod").ZodNumber;
444
+ columnCount: import("zod").ZodNumber;
445
+ variantColumnLegend: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>;
446
+ callFormatting: import("zod").ZodObject<{
447
+ expandHomozygotes: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
448
+ unknownString: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
449
+ sepPhased: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
450
+ sepUnphased: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
451
+ }, import("zod/v4/core").$strip>;
452
+ dataframe: import("zod").ZodObject<{
453
+ tableName: import("zod").ZodString;
454
+ rowCount: import("zod").ZodNumber;
455
+ columns: import("zod").ZodArray<import("zod").ZodString>;
456
+ columnLegend: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
457
+ createdAt: import("zod").ZodString;
458
+ expiresAt: import("zod").ZodString;
459
+ truncated: import("zod").ZodOptional<import("zod").ZodBoolean>;
460
+ maxRows: import("zod").ZodOptional<import("zod").ZodNumber>;
461
+ }, import("zod/v4/core").$strip>;
462
+ vcf: import("zod").ZodOptional<import("zod").ZodString>;
463
+ ped: import("zod").ZodOptional<import("zod").ZodString>;
464
+ map: import("zod").ZodOptional<import("zod").ZodString>;
465
+ truncated: import("zod").ZodBoolean;
466
+ warnings: import("zod").ZodArray<import("zod").ZodString>;
467
+ }, import("zod/v4/core").$strip>, readonly [{
468
+ readonly reason: "unknown_alias";
469
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
470
+ readonly when: "No connection has been registered under the requested alias";
471
+ readonly recovery: "Run brapi_connect with this alias (or omit `alias` to use the default connection) before calling brapi_export_genotype_matrix.";
472
+ }, {
473
+ readonly reason: "no_filters";
474
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
475
+ readonly when: "No variantSetDbId was provided";
476
+ readonly recovery: "Provide variantSetDbId before retrying — unfiltered genotype-call pulls are too expensive.";
477
+ }, {
478
+ readonly reason: "search_endpoint_disabled";
479
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ValidationError;
480
+ readonly when: "The active dialect declares POST /search/calls as known-dead on this server";
481
+ readonly recovery: "Connect to a different BrAPI server that exposes a working /search/calls route — genotype-call workflows are not viable here.";
366
482
  }], undefined> | import("@cyanheads/mcp-ts-core").ToolDefinition<import("zod").ZodObject<{
367
483
  alias: import("zod").ZodOptional<import("zod").ZodString>;
368
484
  variantSetDbId: import("zod").ZodOptional<import("zod").ZodString>;
@@ -407,6 +523,7 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
407
523
  tableName: import("zod").ZodString;
408
524
  rowCount: import("zod").ZodNumber;
409
525
  columns: import("zod").ZodArray<import("zod").ZodString>;
526
+ columnLegend: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
410
527
  createdAt: import("zod").ZodString;
411
528
  expiresAt: import("zod").ZodString;
412
529
  truncated: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -484,6 +601,7 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
484
601
  tableName: import("zod").ZodString;
485
602
  rowCount: import("zod").ZodNumber;
486
603
  columns: import("zod").ZodArray<import("zod").ZodString>;
604
+ columnLegend: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
487
605
  createdAt: import("zod").ZodString;
488
606
  expiresAt: import("zod").ZodString;
489
607
  truncated: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -549,6 +667,7 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
549
667
  tableName: import("zod").ZodString;
550
668
  rowCount: import("zod").ZodNumber;
551
669
  columns: import("zod").ZodArray<import("zod").ZodString>;
670
+ columnLegend: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
552
671
  createdAt: import("zod").ZodString;
553
672
  expiresAt: import("zod").ZodString;
554
673
  truncated: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -612,6 +731,7 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
612
731
  tableName: import("zod").ZodString;
613
732
  rowCount: import("zod").ZodNumber;
614
733
  columns: import("zod").ZodArray<import("zod").ZodString>;
734
+ columnLegend: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
615
735
  createdAt: import("zod").ZodString;
616
736
  expiresAt: import("zod").ZodString;
617
737
  truncated: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -684,6 +804,7 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
684
804
  tableName: import("zod").ZodString;
685
805
  rowCount: import("zod").ZodNumber;
686
806
  columns: import("zod").ZodArray<import("zod").ZodString>;
807
+ columnLegend: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
687
808
  createdAt: import("zod").ZodString;
688
809
  expiresAt: import("zod").ZodString;
689
810
  truncated: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -751,6 +872,7 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
751
872
  tableName: import("zod").ZodString;
752
873
  rowCount: import("zod").ZodNumber;
753
874
  columns: import("zod").ZodArray<import("zod").ZodString>;
875
+ columnLegend: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
754
876
  createdAt: import("zod").ZodString;
755
877
  expiresAt: import("zod").ZodString;
756
878
  truncated: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -837,6 +959,7 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
837
959
  tableName: import("zod").ZodString;
838
960
  rowCount: import("zod").ZodNumber;
839
961
  columns: import("zod").ZodArray<import("zod").ZodString>;
962
+ columnLegend: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
840
963
  createdAt: import("zod").ZodString;
841
964
  expiresAt: import("zod").ZodString;
842
965
  truncated: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -896,6 +1019,7 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
896
1019
  tableName: import("zod").ZodString;
897
1020
  rowCount: import("zod").ZodNumber;
898
1021
  columns: import("zod").ZodArray<import("zod").ZodString>;
1022
+ columnLegend: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
899
1023
  createdAt: import("zod").ZodString;
900
1024
  expiresAt: import("zod").ZodString;
901
1025
  truncated: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -919,6 +1043,40 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
919
1043
  readonly notice: import("zod").ZodOptional<import("zod").ZodString>;
920
1044
  readonly warnings: import("zod").ZodArray<import("zod").ZodString>;
921
1045
  }> | import("@cyanheads/mcp-ts-core").ToolDefinition<import("zod").ZodObject<{
1046
+ alias: import("zod").ZodOptional<import("zod").ZodString>;
1047
+ germplasmDbId: import("zod").ZodString;
1048
+ variables: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1049
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1050
+ alias: import("zod").ZodString;
1051
+ germplasmDbId: import("zod").ZodString;
1052
+ germplasmName: import("zod").ZodOptional<import("zod").ZodString>;
1053
+ studyCount: import("zod").ZodNumber;
1054
+ studyDbIds: import("zod").ZodArray<import("zod").ZodString>;
1055
+ perVariable: import("zod").ZodArray<import("zod").ZodObject<{
1056
+ observationVariableDbId: import("zod").ZodString;
1057
+ observationVariableName: import("zod").ZodOptional<import("zod").ZodString>;
1058
+ n: import("zod").ZodNumber;
1059
+ mean: import("zod").ZodOptional<import("zod").ZodNumber>;
1060
+ median: import("zod").ZodOptional<import("zod").ZodNumber>;
1061
+ sd: import("zod").ZodOptional<import("zod").ZodNumber>;
1062
+ min: import("zod").ZodOptional<import("zod").ZodString>;
1063
+ max: import("zod").ZodOptional<import("zod").ZodString>;
1064
+ studyCount: import("zod").ZodNumber;
1065
+ studyDbIds: import("zod").ZodArray<import("zod").ZodString>;
1066
+ seasons: import("zod").ZodArray<import("zod").ZodString>;
1067
+ }, import("zod/v4/core").$strip>>;
1068
+ warnings: import("zod").ZodArray<import("zod").ZodString>;
1069
+ }, import("zod/v4/core").$strip>, readonly [{
1070
+ readonly reason: "unknown_alias";
1071
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
1072
+ readonly when: "No connection has been registered under the requested alias";
1073
+ readonly recovery: "Run brapi_connect with this alias (or omit `alias` to use the default connection) before calling brapi_germplasm_performance.";
1074
+ }, {
1075
+ readonly reason: "germplasm_not_found";
1076
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
1077
+ readonly when: "Upstream returned no germplasm record for the requested germplasmDbId";
1078
+ readonly recovery: "Verify the germplasmDbId on the target server, or run brapi_find_germplasm to discover valid IDs.";
1079
+ }], undefined> | import("@cyanheads/mcp-ts-core").ToolDefinition<import("zod").ZodObject<{
922
1080
  imageDbIds: import("zod").ZodArray<import("zod").ZodString>;
923
1081
  alias: import("zod").ZodOptional<import("zod").ZodString>;
924
1082
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
@@ -990,6 +1148,7 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
990
1148
  tableName: import("zod").ZodString;
991
1149
  rowCount: import("zod").ZodNumber;
992
1150
  columns: import("zod").ZodArray<import("zod").ZodString>;
1151
+ columnLegend: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
993
1152
  createdAt: import("zod").ZodString;
994
1153
  expiresAt: import("zod").ZodString;
995
1154
  truncated: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -1032,6 +1191,7 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
1032
1191
  tableName: import("zod").ZodString;
1033
1192
  rowCount: import("zod").ZodNumber;
1034
1193
  columns: import("zod").ZodArray<import("zod").ZodString>;
1194
+ columnLegend: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
1035
1195
  createdAt: import("zod").ZodString;
1036
1196
  expiresAt: import("zod").ZodString;
1037
1197
  truncated: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAyBH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;yDAAuB,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAyB,CAAC;AAE5D,qEAAqE;AACrE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAA4B,CAAC"}
@@ -10,12 +10,14 @@
10
10
  *
11
11
  * @module mcp-server/tools/definitions/index
12
12
  */
13
+ import { brapiBuildPhenotypeMatrix } from './brapi-build-phenotype-matrix.tool.js';
13
14
  import { brapiConnect } from './brapi-connect.tool.js';
14
15
  import { brapiDataframeDescribe } from './brapi-dataframe-describe.tool.js';
15
16
  import { brapiDataframeDrop } from './brapi-dataframe-drop.tool.js';
16
17
  import { brapiDataframeExport } from './brapi-dataframe-export.tool.js';
17
18
  import { brapiDataframeQuery } from './brapi-dataframe-query.tool.js';
18
19
  import { brapiDescribeFilters } from './brapi-describe-filters.tool.js';
20
+ import { brapiExportGenotypeMatrix } from './brapi-export-genotype-matrix.tool.js';
19
21
  import { brapiFindGenotypeCalls } from './brapi-find-genotype-calls.tool.js';
20
22
  import { brapiFindGermplasm } from './brapi-find-germplasm.tool.js';
21
23
  import { brapiFindImages } from './brapi-find-images.tool.js';
@@ -24,6 +26,7 @@ import { brapiFindObservations } from './brapi-find-observations.tool.js';
24
26
  import { brapiFindStudies } from './brapi-find-studies.tool.js';
25
27
  import { brapiFindVariables } from './brapi-find-variables.tool.js';
26
28
  import { brapiFindVariants } from './brapi-find-variants.tool.js';
29
+ import { brapiGermplasmPerformance } from './brapi-germplasm-performance.tool.js';
27
30
  import { brapiGetGermplasm } from './brapi-get-germplasm.tool.js';
28
31
  import { brapiGetImage } from './brapi-get-image.tool.js';
29
32
  import { brapiGetStudy } from './brapi-get-study.tool.js';
@@ -39,6 +42,7 @@ import { brapiWalkPedigree } from './brapi-walk-pedigree.tool.js';
39
42
  */
40
43
  export const readOnlyToolDefinitions = [
41
44
  brapiConnect,
45
+ brapiBuildPhenotypeMatrix,
42
46
  brapiServerInfo,
43
47
  brapiDescribeFilters,
44
48
  brapiFindStudies,
@@ -46,6 +50,7 @@ export const readOnlyToolDefinitions = [
46
50
  brapiFindGermplasm,
47
51
  brapiGetGermplasm,
48
52
  brapiWalkPedigree,
53
+ brapiGermplasmPerformance,
49
54
  brapiFindVariables,
50
55
  brapiFindObservations,
51
56
  brapiFindImages,
@@ -53,6 +58,7 @@ export const readOnlyToolDefinitions = [
53
58
  brapiFindLocations,
54
59
  brapiFindVariants,
55
60
  brapiFindGenotypeCalls,
61
+ brapiExportGenotypeMatrix,
56
62
  brapiDataframeDescribe,
57
63
  brapiDataframeQuery,
58
64
  brapiRawGet,
@@ -1 +1 @@
1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B,EAAE,MAAM,+BAA+B,CAAC;AAElE;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,YAAY;IACZ,eAAe;IACf,oBAAoB;IACpB,gBAAgB;IAChB,aAAa;IACb,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;IAClB,qBAAqB;IACrB,eAAe;IACf,aAAa;IACb,kBAAkB;IAClB,iBAAiB;IACjB,sBAAsB;IACtB,sBAAsB;IACtB,mBAAmB;IACnB,WAAW;IACX,cAAc;CACf,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAExD;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAE5D,qEAAqE;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,uBAAuB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO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AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAE5D,qEAAqE;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @fileoverview Shared canvas column-name sanitizer. The two matrix-building
3
+ * tools (`brapi_build_phenotype_matrix`, `brapi_export_genotype_matrix`) pivot
4
+ * upstream IDs (`observationVariableDbId`, `variantDbId`) into dataframe column
5
+ * names. The framework's canvas registers tables through `assertValidIdentifier`,
6
+ * which rejects any column whose name fails `/^[A-Za-z_][A-Za-z0-9_]{0,62}$/` or
7
+ * matches a reserved SQL keyword. BrAPI DbIds are routinely numeric (Breedbase
8
+ * uses integers) or collide with reserved words, so column names must be
9
+ * sanitized to SQL-safe identifiers before registration — paired with a legend
10
+ * mapping the safe name back to the original ID so the correlation is never lost.
11
+ *
12
+ * `sanitizeRowColumns` applies the same rules to whole spilled rows at the
13
+ * `CanvasBridge.registerDataframe` choke point, so every generic `find_*`
14
+ * spillover (not just the matrix pivots) is protected — a `/variants` row's
15
+ * reserved `end` key no longer fails registration.
16
+ *
17
+ * @module mcp-server/tools/shared/canvas-columns
18
+ */
19
+ /**
20
+ * Sanitize an arbitrary upstream ID into a valid DuckDB column identifier.
21
+ * Mirrors the framework's `CANVAS_IDENTIFIER_REGEX` (`/^[A-Za-z_][A-Za-z0-9_]{0,62}$/`):
22
+ * replace illegal characters with `_`, prefix `v_` when the result would start
23
+ * with a digit, truncate to 63 chars, and suffix `_` when the result collides
24
+ * with a reserved SQL keyword.
25
+ */
26
+ export declare function sanitizeColumnName(raw: string): string;
27
+ /**
28
+ * Sanitize a list of IDs into unique column names, preserving input order. When
29
+ * two IDs sanitize to the same name, later collisions get a numeric suffix
30
+ * (`_2`, `_3`, …). Returns the column names in order plus a legend mapping each
31
+ * safe column name back to its original ID.
32
+ */
33
+ export declare function buildUniqueColumns(ids: readonly string[]): {
34
+ columns: string[];
35
+ toOriginal: Record<string, string>;
36
+ };
37
+ /**
38
+ * Sanitize every column key across a spilled row set into SQL-safe DuckDB
39
+ * identifiers, reusing {@link buildUniqueColumns}. Returns the (possibly
40
+ * rewritten) rows plus a legend mapping each *renamed* safe column back to its
41
+ * original upstream key — entries are added only for columns that actually
42
+ * changed. When every key is already a valid identifier the input rows are
43
+ * returned by reference and the legend is empty, so the common (all-safe) path
44
+ * stays allocation-free.
45
+ *
46
+ * Centralizing this at `CanvasBridge.registerDataframe` keeps every spill
47
+ * consumer safe by construction: a row carrying a reserved word (`end`,
48
+ * `order`, …) or a digit-leading key no longer trips the framework's
49
+ * `assertValidIdentifier` gate at table registration.
50
+ */
51
+ export declare function sanitizeRowColumns(rows: ReadonlyArray<Record<string, unknown>>): {
52
+ legend: Record<string, string>;
53
+ rows: Record<string, unknown>[];
54
+ };
55
+ //# sourceMappingURL=canvas-columns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvas-columns.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/shared/canvas-columns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA+CH;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAStD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG;IAC1D,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,CAaA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IAChF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;CACjC,CAmCA"}
@@ -0,0 +1,151 @@
1
+ /**
2
+ * @fileoverview Shared canvas column-name sanitizer. The two matrix-building
3
+ * tools (`brapi_build_phenotype_matrix`, `brapi_export_genotype_matrix`) pivot
4
+ * upstream IDs (`observationVariableDbId`, `variantDbId`) into dataframe column
5
+ * names. The framework's canvas registers tables through `assertValidIdentifier`,
6
+ * which rejects any column whose name fails `/^[A-Za-z_][A-Za-z0-9_]{0,62}$/` or
7
+ * matches a reserved SQL keyword. BrAPI DbIds are routinely numeric (Breedbase
8
+ * uses integers) or collide with reserved words, so column names must be
9
+ * sanitized to SQL-safe identifiers before registration — paired with a legend
10
+ * mapping the safe name back to the original ID so the correlation is never lost.
11
+ *
12
+ * `sanitizeRowColumns` applies the same rules to whole spilled rows at the
13
+ * `CanvasBridge.registerDataframe` choke point, so every generic `find_*`
14
+ * spillover (not just the matrix pivots) is protected — a `/variants` row's
15
+ * reserved `end` key no longer fails registration.
16
+ *
17
+ * @module mcp-server/tools/shared/canvas-columns
18
+ */
19
+ /**
20
+ * Reserved SQL keywords rejected by the framework canvas gate
21
+ * (`assertValidIdentifier`, reason `identifierReserved`). Kept in sync with the
22
+ * framework's `RESERVED_IDENTIFIERS` set — a sanitized name matching one of
23
+ * these (case-insensitive) is suffixed with `_` to clear the gate.
24
+ */
25
+ const RESERVED_IDENTIFIERS = new Set([
26
+ 'select',
27
+ 'from',
28
+ 'where',
29
+ 'order',
30
+ 'group',
31
+ 'having',
32
+ 'limit',
33
+ 'offset',
34
+ 'union',
35
+ 'intersect',
36
+ 'except',
37
+ 'all',
38
+ 'distinct',
39
+ 'as',
40
+ 'and',
41
+ 'or',
42
+ 'not',
43
+ 'null',
44
+ 'true',
45
+ 'false',
46
+ 'case',
47
+ 'when',
48
+ 'then',
49
+ 'else',
50
+ 'end',
51
+ 'join',
52
+ 'inner',
53
+ 'outer',
54
+ 'left',
55
+ 'right',
56
+ 'full',
57
+ 'cross',
58
+ 'on',
59
+ 'using',
60
+ 'with',
61
+ 'recursive',
62
+ ]);
63
+ /**
64
+ * Sanitize an arbitrary upstream ID into a valid DuckDB column identifier.
65
+ * Mirrors the framework's `CANVAS_IDENTIFIER_REGEX` (`/^[A-Za-z_][A-Za-z0-9_]{0,62}$/`):
66
+ * replace illegal characters with `_`, prefix `v_` when the result would start
67
+ * with a digit, truncate to 63 chars, and suffix `_` when the result collides
68
+ * with a reserved SQL keyword.
69
+ */
70
+ export function sanitizeColumnName(raw) {
71
+ let name = raw.replace(/[^A-Za-z0-9_]/g, '_');
72
+ if (/^[0-9]/.test(name))
73
+ name = `v_${name}`;
74
+ if (name.length > 63)
75
+ name = name.slice(0, 63);
76
+ if (name.length === 0)
77
+ name = 'v_unknown';
78
+ if (RESERVED_IDENTIFIERS.has(name.toLowerCase())) {
79
+ name = name.length >= 63 ? `${name.slice(0, 62)}_` : `${name}_`;
80
+ }
81
+ return name;
82
+ }
83
+ /**
84
+ * Sanitize a list of IDs into unique column names, preserving input order. When
85
+ * two IDs sanitize to the same name, later collisions get a numeric suffix
86
+ * (`_2`, `_3`, …). Returns the column names in order plus a legend mapping each
87
+ * safe column name back to its original ID.
88
+ */
89
+ export function buildUniqueColumns(ids) {
90
+ const used = new Map();
91
+ const columns = [];
92
+ const toOriginal = {};
93
+ for (const id of ids) {
94
+ const base = sanitizeColumnName(id);
95
+ const count = (used.get(base) ?? 0) + 1;
96
+ used.set(base, count);
97
+ const colName = count === 1 ? base : `${base}_${count}`;
98
+ columns.push(colName);
99
+ toOriginal[colName] = id;
100
+ }
101
+ return { columns, toOriginal };
102
+ }
103
+ /**
104
+ * Sanitize every column key across a spilled row set into SQL-safe DuckDB
105
+ * identifiers, reusing {@link buildUniqueColumns}. Returns the (possibly
106
+ * rewritten) rows plus a legend mapping each *renamed* safe column back to its
107
+ * original upstream key — entries are added only for columns that actually
108
+ * changed. When every key is already a valid identifier the input rows are
109
+ * returned by reference and the legend is empty, so the common (all-safe) path
110
+ * stays allocation-free.
111
+ *
112
+ * Centralizing this at `CanvasBridge.registerDataframe` keeps every spill
113
+ * consumer safe by construction: a row carrying a reserved word (`end`,
114
+ * `order`, …) or a digit-leading key no longer trips the framework's
115
+ * `assertValidIdentifier` gate at table registration.
116
+ */
117
+ export function sanitizeRowColumns(rows) {
118
+ // Ordered union of keys across all (sparse) rows — later rows may introduce
119
+ // columns the first row lacks.
120
+ const order = [];
121
+ const seen = new Set();
122
+ for (const row of rows) {
123
+ for (const key of Object.keys(row)) {
124
+ if (!seen.has(key)) {
125
+ seen.add(key);
126
+ order.push(key);
127
+ }
128
+ }
129
+ }
130
+ const { columns } = buildUniqueColumns(order);
131
+ const rename = new Map();
132
+ const legend = {};
133
+ order.forEach((original, i) => {
134
+ const safe = columns[i] ?? original;
135
+ rename.set(original, safe);
136
+ if (safe !== original)
137
+ legend[safe] = original;
138
+ });
139
+ if (Object.keys(legend).length === 0) {
140
+ return { rows: rows, legend: {} };
141
+ }
142
+ const rewritten = rows.map((row) => {
143
+ const out = {};
144
+ for (const [key, value] of Object.entries(row)) {
145
+ out[rename.get(key) ?? key] = value;
146
+ }
147
+ return out;
148
+ });
149
+ return { rows: rewritten, legend };
150
+ }
151
+ //# sourceMappingURL=canvas-columns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvas-columns.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/shared/canvas-columns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,WAAW;IACX,QAAQ;IACR,KAAK;IACL,UAAU;IACV,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IACL,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;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AAI,KAAK,QAAQ;YAAE,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,EAAE,IAAI,EAAE,IAAiC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACjE,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACjC,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC;QACtC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AACrC,CAAC"}
@@ -239,6 +239,7 @@ export declare const DataframeHandleSchema: z.ZodObject<{
239
239
  tableName: z.ZodString;
240
240
  rowCount: z.ZodNumber;
241
241
  columns: z.ZodArray<z.ZodString>;
242
+ columnLegend: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
242
243
  createdAt: z.ZodString;
243
244
  expiresAt: z.ZodString;
244
245
  truncated: z.ZodOptional<z.ZodBoolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"find-helpers.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/shared/find-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,O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E,CAAC;CACtC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACrD,OAAO,GAAE,qBAA0B,GAClC,MAAM,GAAG,SAAS,CAqBpB;AA8BD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,GAChC,MAAM,EAAE,CAOV;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,GAChC,IAAI,CAKN;AAED,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC"}
@@ -367,6 +367,10 @@ export const DataframeHandleSchema = z.object({
367
367
  columns: z
368
368
  .array(z.string().describe('Column name from the materialized rows.'))
369
369
  .describe('Full column list of the dataframe.'),
370
+ columnLegend: z
371
+ .record(z.string(), z.string())
372
+ .optional()
373
+ .describe('Maps a sanitized column name back to its original upstream key, for columns renamed to clear the SQL-safe-identifier gate (e.g. `end` → `end_`). Present only when a column was renamed — write SQL against the sanitized (left-hand) names.'),
370
374
  createdAt: z.string().describe('ISO 8601 timestamp the dataframe was created.'),
371
375
  expiresAt: z
372
376
  .string()
@@ -396,6 +400,12 @@ export function renderDataframeHandle(handle) {
396
400
  `- createdAt: ${handle.createdAt}`,
397
401
  `- expiresAt: ${handle.expiresAt} (${formatExpiresIn(handle.expiresAt)})`,
398
402
  ];
403
+ if (handle.columnLegend && Object.keys(handle.columnLegend).length > 0) {
404
+ const pairs = Object.entries(handle.columnLegend)
405
+ .map(([safe, original]) => `${safe} → ${original}`)
406
+ .join(', ');
407
+ lines.push(`- renamedColumns: ${pairs} (query using the left-hand names)`);
408
+ }
399
409
  if (handle.truncated)
400
410
  lines.push(`- truncated: true`);
401
411
  if (typeof handle.maxRows === 'number')
@@ -436,6 +446,8 @@ export function toDataframeHandle(result) {
436
446
  createdAt: result.createdAt,
437
447
  expiresAt: result.expiresAt,
438
448
  };
449
+ if (result.columnLegend)
450
+ handle.columnLegend = result.columnLegend;
439
451
  if (result.truncated)
440
452
  handle.truncated = true;
441
453
  if (typeof result.maxRows === 'number')