@cyanheads/brapi-mcp-server 0.6.3 → 0.7.0

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 (106) hide show
  1. package/CLAUDE.md +11 -4
  2. package/README.md +7 -3
  3. package/changelog/0.6.x/0.6.4.md +14 -0
  4. package/changelog/0.7.x/0.7.0.md +23 -0
  5. package/changelog/template.md +1 -1
  6. package/dist/index.js +2 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/mcp-server/resources/definitions/brapi-variable.resource.d.ts +30 -0
  9. package/dist/mcp-server/resources/definitions/brapi-variable.resource.d.ts.map +1 -0
  10. package/dist/mcp-server/resources/definitions/brapi-variable.resource.js +78 -0
  11. package/dist/mcp-server/resources/definitions/brapi-variable.resource.js.map +1 -0
  12. package/dist/mcp-server/tools/definitions/brapi-build-phenotype-matrix.tool.d.ts +81 -0
  13. package/dist/mcp-server/tools/definitions/brapi-build-phenotype-matrix.tool.d.ts.map +1 -0
  14. package/dist/mcp-server/tools/definitions/brapi-build-phenotype-matrix.tool.js +366 -0
  15. package/dist/mcp-server/tools/definitions/brapi-build-phenotype-matrix.tool.js.map +1 -0
  16. package/dist/mcp-server/tools/definitions/brapi-connect.tool.d.ts +1 -1
  17. package/dist/mcp-server/tools/definitions/brapi-connect.tool.d.ts.map +1 -1
  18. package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.d.ts +1 -1
  19. package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.d.ts.map +1 -1
  20. package/dist/mcp-server/tools/definitions/brapi-dataframe-drop.tool.d.ts +1 -1
  21. package/dist/mcp-server/tools/definitions/brapi-dataframe-drop.tool.d.ts.map +1 -1
  22. package/dist/mcp-server/tools/definitions/brapi-dataframe-export.tool.d.ts +1 -1
  23. package/dist/mcp-server/tools/definitions/brapi-dataframe-export.tool.d.ts.map +1 -1
  24. package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.d.ts +1 -1
  25. package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.d.ts.map +1 -1
  26. package/dist/mcp-server/tools/definitions/brapi-describe-filters.tool.d.ts +1 -1
  27. package/dist/mcp-server/tools/definitions/brapi-describe-filters.tool.d.ts.map +1 -1
  28. package/dist/mcp-server/tools/definitions/brapi-export-genotype-matrix.tool.d.ts +88 -0
  29. package/dist/mcp-server/tools/definitions/brapi-export-genotype-matrix.tool.d.ts.map +1 -0
  30. package/dist/mcp-server/tools/definitions/brapi-export-genotype-matrix.tool.js +494 -0
  31. package/dist/mcp-server/tools/definitions/brapi-export-genotype-matrix.tool.js.map +1 -0
  32. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.d.ts +7 -5
  33. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.d.ts.map +1 -1
  34. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.js +67 -120
  35. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.js.map +1 -1
  36. package/dist/mcp-server/tools/definitions/brapi-find-germplasm.tool.d.ts +8 -6
  37. package/dist/mcp-server/tools/definitions/brapi-find-germplasm.tool.d.ts.map +1 -1
  38. package/dist/mcp-server/tools/definitions/brapi-find-germplasm.tool.js +54 -33
  39. package/dist/mcp-server/tools/definitions/brapi-find-germplasm.tool.js.map +1 -1
  40. package/dist/mcp-server/tools/definitions/brapi-find-images.tool.d.ts +8 -6
  41. package/dist/mcp-server/tools/definitions/brapi-find-images.tool.d.ts.map +1 -1
  42. package/dist/mcp-server/tools/definitions/brapi-find-images.tool.js +54 -33
  43. package/dist/mcp-server/tools/definitions/brapi-find-images.tool.js.map +1 -1
  44. package/dist/mcp-server/tools/definitions/brapi-find-locations.tool.d.ts +8 -6
  45. package/dist/mcp-server/tools/definitions/brapi-find-locations.tool.d.ts.map +1 -1
  46. package/dist/mcp-server/tools/definitions/brapi-find-locations.tool.js +62 -41
  47. package/dist/mcp-server/tools/definitions/brapi-find-locations.tool.js.map +1 -1
  48. package/dist/mcp-server/tools/definitions/brapi-find-observations.tool.d.ts +8 -6
  49. package/dist/mcp-server/tools/definitions/brapi-find-observations.tool.d.ts.map +1 -1
  50. package/dist/mcp-server/tools/definitions/brapi-find-observations.tool.js +54 -33
  51. package/dist/mcp-server/tools/definitions/brapi-find-observations.tool.js.map +1 -1
  52. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.d.ts +8 -6
  53. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.d.ts.map +1 -1
  54. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.js +52 -33
  55. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.js.map +1 -1
  56. package/dist/mcp-server/tools/definitions/brapi-find-variables.tool.d.ts +8 -6
  57. package/dist/mcp-server/tools/definitions/brapi-find-variables.tool.d.ts.map +1 -1
  58. package/dist/mcp-server/tools/definitions/brapi-find-variables.tool.js +54 -33
  59. package/dist/mcp-server/tools/definitions/brapi-find-variables.tool.js.map +1 -1
  60. package/dist/mcp-server/tools/definitions/brapi-find-variants.tool.d.ts +8 -6
  61. package/dist/mcp-server/tools/definitions/brapi-find-variants.tool.d.ts.map +1 -1
  62. package/dist/mcp-server/tools/definitions/brapi-find-variants.tool.js +54 -33
  63. package/dist/mcp-server/tools/definitions/brapi-find-variants.tool.js.map +1 -1
  64. package/dist/mcp-server/tools/definitions/brapi-germplasm-performance.tool.d.ts +60 -0
  65. package/dist/mcp-server/tools/definitions/brapi-germplasm-performance.tool.d.ts.map +1 -0
  66. package/dist/mcp-server/tools/definitions/brapi-germplasm-performance.tool.js +416 -0
  67. package/dist/mcp-server/tools/definitions/brapi-germplasm-performance.tool.js.map +1 -0
  68. package/dist/mcp-server/tools/definitions/brapi-get-germplasm.tool.d.ts +1 -1
  69. package/dist/mcp-server/tools/definitions/brapi-get-germplasm.tool.d.ts.map +1 -1
  70. package/dist/mcp-server/tools/definitions/brapi-get-image.tool.d.ts +1 -1
  71. package/dist/mcp-server/tools/definitions/brapi-get-image.tool.d.ts.map +1 -1
  72. package/dist/mcp-server/tools/definitions/brapi-get-study.tool.d.ts +1 -1
  73. package/dist/mcp-server/tools/definitions/brapi-get-study.tool.d.ts.map +1 -1
  74. package/dist/mcp-server/tools/definitions/brapi-raw-get.tool.d.ts +1 -1
  75. package/dist/mcp-server/tools/definitions/brapi-raw-get.tool.d.ts.map +1 -1
  76. package/dist/mcp-server/tools/definitions/brapi-raw-search.tool.d.ts +1 -1
  77. package/dist/mcp-server/tools/definitions/brapi-raw-search.tool.d.ts.map +1 -1
  78. package/dist/mcp-server/tools/definitions/brapi-server-info.tool.d.ts +1 -1
  79. package/dist/mcp-server/tools/definitions/brapi-server-info.tool.d.ts.map +1 -1
  80. package/dist/mcp-server/tools/definitions/brapi-submit-observations.tool.d.ts +1 -1
  81. package/dist/mcp-server/tools/definitions/brapi-submit-observations.tool.d.ts.map +1 -1
  82. package/dist/mcp-server/tools/definitions/brapi-walk-pedigree.tool.d.ts +1 -1
  83. package/dist/mcp-server/tools/definitions/brapi-walk-pedigree.tool.d.ts.map +1 -1
  84. package/dist/mcp-server/tools/definitions/index.d.ts +225 -61
  85. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
  86. package/dist/mcp-server/tools/definitions/index.js +6 -0
  87. package/dist/mcp-server/tools/definitions/index.js.map +1 -1
  88. package/dist/mcp-server/tools/shared/canvas-columns.d.ts +32 -0
  89. package/dist/mcp-server/tools/shared/canvas-columns.d.ts.map +1 -0
  90. package/dist/mcp-server/tools/shared/canvas-columns.js +98 -0
  91. package/dist/mcp-server/tools/shared/canvas-columns.js.map +1 -0
  92. package/dist/mcp-server/tools/shared/find-helpers.d.ts +1 -1
  93. package/dist/mcp-server/tools/shared/find-helpers.d.ts.map +1 -1
  94. package/dist/mcp-server/tools/shared/find-helpers.js +6 -2
  95. package/dist/mcp-server/tools/shared/find-helpers.js.map +1 -1
  96. package/dist/mcp-server/tools/shared/genotype-calls.d.ts +81 -0
  97. package/dist/mcp-server/tools/shared/genotype-calls.d.ts.map +1 -0
  98. package/dist/mcp-server/tools/shared/genotype-calls.js +172 -0
  99. package/dist/mcp-server/tools/shared/genotype-calls.js.map +1 -0
  100. package/dist/mcp-server/tools/shared/observations.d.ts +87 -0
  101. package/dist/mcp-server/tools/shared/observations.d.ts.map +1 -0
  102. package/dist/mcp-server/tools/shared/observations.js +285 -0
  103. package/dist/mcp-server/tools/shared/observations.js.map +1 -0
  104. package/manifest.json +1 -1
  105. package/package.json +6 -5
  106. package/server.json +3 -3
@@ -0,0 +1,494 @@
1
+ /**
2
+ * @fileoverview `brapi_export_genotype_matrix` — pull genotype calls for a
3
+ * germplasm × variant set and pivot them into a matrix in the requested format.
4
+ *
5
+ * Three output formats:
6
+ *
7
+ * - `matrix-json`: Wide germplasm × variant table registered as a canvas
8
+ * dataframe (`df_<uuid>`). One row per call-set (germplasm); one column per
9
+ * variant. Column names are sanitized for DuckDB (SQL-safe identifiers); a
10
+ * `variantColumnLegend` maps sanitized name → original variant ID.
11
+ *
12
+ * - `vcf-lite`: Standard VCF-subset text (`#CHROM POS ID REF ALT <sample…>`),
13
+ * one row per variant, returned in the `vcf` output field. CHROM/POS/REF/ALT
14
+ * come from a `/variants` metadata pull; `.` when the server doesn't provide
15
+ * them (common — the BrAPI test server leaves them null). The wide matrix is
16
+ * also registered as a dataframe for SQL follow-up.
17
+ *
18
+ * - `plink`: `.ped` and `.map` text returned in the `ped` / `map` output fields.
19
+ * `.map` carries chromosome + base-pair position from the variant pull; `.ped`
20
+ * carries biallelic genotype pairs split from each call's genotype string.
21
+ * Alleles are passed through verbatim (numeric 0/1 codings are not recoded to
22
+ * nucleotides). The wide matrix is also registered as a dataframe.
23
+ *
24
+ * The genotype-call pull infrastructure is shared with `brapi_find_genotype_calls`
25
+ * via `src/mcp-server/tools/shared/genotype-calls.ts`; column sanitization is
26
+ * shared via `src/mcp-server/tools/shared/canvas-columns.ts`.
27
+ *
28
+ * @module mcp-server/tools/definitions/brapi-export-genotype-matrix.tool
29
+ */
30
+ import { tool, z } from '@cyanheads/mcp-ts-core';
31
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
32
+ import { getServerConfig } from '../../../config/server-config.js';
33
+ import { getBrapiClient } from '../../../services/brapi-client/index.js';
34
+ import { resolveDialect } from '../../../services/brapi-dialect/index.js';
35
+ import { getCanvasBridge } from '../../../services/canvas-bridge/index.js';
36
+ import { getCapabilityRegistry } from '../../../services/capability-registry/index.js';
37
+ import { buildUniqueColumns } from '../shared/canvas-columns.js';
38
+ import { AliasInput, asString, buildRequestOptions, DataframeHandleSchema, extractRows, renderDataframeHandle, requireRegisteredConnection, toDataframeHandle, } from '../shared/find-helpers.js';
39
+ import { buildCallsSearchBody, collectCalls, renderGenotypeString, } from '../shared/genotype-calls.js';
40
+ /** Max variant records scanned when pulling coordinate metadata for vcf/plink. */
41
+ const MAX_VARIANT_METADATA_ROWS = 50_000;
42
+ const VARIANT_METADATA_PAGE_SIZE = 1_000;
43
+ /** Lines of format text shown inline in content[]; full text lives in structuredContent. */
44
+ const FORMAT_PREVIEW_LINES = 25;
45
+ // ---------------------------------------------------------------------------
46
+ // Output schema
47
+ // ---------------------------------------------------------------------------
48
+ const OutputSchema = z.object({
49
+ alias: z.string().describe('Alias of the registered BrAPI connection used.'),
50
+ format: z
51
+ .enum(['plink', 'vcf-lite', 'matrix-json'])
52
+ .describe('The output format that was produced.'),
53
+ rowCount: z
54
+ .number()
55
+ .int()
56
+ .nonnegative()
57
+ .describe('Number of call-set (germplasm) rows in the matrix.'),
58
+ columnCount: z
59
+ .number()
60
+ .int()
61
+ .nonnegative()
62
+ .describe('Number of variant columns in the matrix (excluding the germplasm ID column).'),
63
+ variantColumnLegend: z
64
+ .record(z.string(), z.string())
65
+ .describe('Map of sanitized column name → original variantDbId. Dataframe column names are SQL-safe identifiers; use this legend to correlate them back to the original variant IDs.'),
66
+ callFormatting: z
67
+ .object({
68
+ expandHomozygotes: z.boolean().nullish().describe('Homozygous allele expansion flag.'),
69
+ unknownString: z.string().nullish().describe('String used for unknown/missing calls.'),
70
+ sepPhased: z.string().nullish().describe('Phased allele separator.'),
71
+ sepUnphased: z.string().nullish().describe('Unphased allele separator.'),
72
+ })
73
+ .describe('Genotype-encoding hints echoed by the server.'),
74
+ dataframe: DataframeHandleSchema.describe('Canvas dataframe handle for the wide germplasm × variant matrix (registered for every format). Query with brapi_dataframe_query (SQL); export with brapi_dataframe_export. The vcf/ped/map text fields are the format-specific serialization of the same data.'),
75
+ vcf: z
76
+ .string()
77
+ .optional()
78
+ .describe('VCF-lite text — header `#CHROM POS ID REF ALT` plus one genotype column per sample, one row per variant. Present only when format="vcf-lite". CHROM/POS/REF/ALT come from /variants metadata; "." when the server does not provide them.'),
79
+ ped: z
80
+ .string()
81
+ .optional()
82
+ .describe('PLINK .ped text — FID IID PAT MAT SEX PHENO placeholders (all 0) followed by biallelic genotype pairs per variant, one row per sample. Present only when format="plink". Alleles are passed through verbatim; PLINK missing is `0`.'),
83
+ map: z
84
+ .string()
85
+ .optional()
86
+ .describe('PLINK .map text — chromosome, variant-id, genetic-distance (0 placeholder), base-pair position, one row per variant. Present only when format="plink". Chromosome/position come from /variants metadata; `0` when absent.'),
87
+ truncated: z
88
+ .boolean()
89
+ .describe('True when the call pull was capped before exhausting upstream data.'),
90
+ warnings: z.array(z.string()).describe('Advisory messages (truncation, missing fields, etc.).'),
91
+ });
92
+ // ---------------------------------------------------------------------------
93
+ // Tool definition
94
+ // ---------------------------------------------------------------------------
95
+ export const brapiExportGenotypeMatrix = tool('brapi_export_genotype_matrix', {
96
+ description: 'Pull genotype calls for a germplasm × variant set and pivot them into a matrix. `format` controls the output: `matrix-json` registers a wide germplasm × variant canvas dataframe for SQL analysis; `vcf-lite` returns VCF-subset text (in the `vcf` field) and also registers the dataframe; `plink` returns .ped/.map text (in the `ped`/`map` fields) and also registers the dataframe. vcf-lite/plink pull /variants metadata for CHROM/POS/REF/ALT (`.`/`0` when the server lacks them). Column names are SQL-safe identifiers; `variantColumnLegend` maps them back to original variant IDs.',
97
+ annotations: { readOnlyHint: true, openWorldHint: true },
98
+ errors: [
99
+ {
100
+ reason: 'unknown_alias',
101
+ code: JsonRpcErrorCode.NotFound,
102
+ when: 'No connection has been registered under the requested alias',
103
+ recovery: 'Run brapi_connect with this alias (or omit `alias` to use the default connection) before calling brapi_export_genotype_matrix.',
104
+ },
105
+ {
106
+ reason: 'no_filters',
107
+ code: JsonRpcErrorCode.ValidationError,
108
+ when: 'No variantSetDbId was provided',
109
+ recovery: 'Provide variantSetDbId before retrying — unfiltered genotype-call pulls are too expensive.',
110
+ },
111
+ {
112
+ reason: 'search_endpoint_disabled',
113
+ code: JsonRpcErrorCode.ValidationError,
114
+ when: 'The active dialect declares POST /search/calls as known-dead on this server',
115
+ recovery: 'Connect to a different BrAPI server that exposes a working /search/calls route — genotype-call workflows are not viable here.',
116
+ },
117
+ ],
118
+ input: z.object({
119
+ alias: AliasInput,
120
+ germplasmDbIds: z
121
+ .array(z.string())
122
+ .optional()
123
+ .describe('Restrict to these germplasm. Omit to pull all germplasm in the variant set (use with caution on large sets).'),
124
+ variantSetDbId: z.string().min(1).describe('Variant set to pull calls for. Required.'),
125
+ format: z
126
+ .enum(['plink', 'vcf-lite', 'matrix-json'])
127
+ .describe('Output format. `matrix-json` registers a wide canvas dataframe only. `vcf-lite` returns VCF-subset text and registers the dataframe. `plink` returns .ped/.map text and registers the dataframe.'),
128
+ maxCalls: z
129
+ .number()
130
+ .int()
131
+ .positive()
132
+ .optional()
133
+ .describe('Override the deployment-level pull cap (BRAPI_GENOTYPE_CALLS_MAX_PULL). Useful for large panels where the default is too low.'),
134
+ }),
135
+ output: OutputSchema,
136
+ async handler(input, ctx) {
137
+ const capabilities = getCapabilityRegistry();
138
+ const client = getBrapiClient();
139
+ const bridge = getCanvasBridge();
140
+ const connection = await requireRegisteredConnection(ctx, input.alias);
141
+ const capabilityLookup = {};
142
+ if (connection.resolvedAuth)
143
+ capabilityLookup.auth = connection.resolvedAuth;
144
+ await capabilities.ensure(connection.baseUrl, { service: 'search/calls', method: 'POST' }, ctx, capabilityLookup);
145
+ const dialect = await resolveDialect(connection, ctx, capabilityLookup);
146
+ if (dialect.disabledSearchEndpoints?.has('calls')) {
147
+ throw ctx.fail('search_endpoint_disabled', `Dialect '${dialect.id}' marks POST /search/calls as known-dead on this server. Genotype-call workflows are not viable here.`, { dialectId: dialect.id, ...ctx.recoveryFor('search_endpoint_disabled') });
148
+ }
149
+ const config = getServerConfig();
150
+ const maxCalls = input.maxCalls ?? config.genotypeCallsMaxPull;
151
+ const searchOpts = {
152
+ variantSetDbId: input.variantSetDbId,
153
+ };
154
+ if (input.germplasmDbIds !== undefined)
155
+ searchOpts.germplasmDbIds = input.germplasmDbIds;
156
+ const searchBody = buildCallsSearchBody(searchOpts);
157
+ if (!searchBody.variantSetDbIds) {
158
+ throw ctx.fail('no_filters', 'variantSetDbId is required — unfiltered genotype-call pulls are prohibitively expensive.', { ...ctx.recoveryFor('no_filters') });
159
+ }
160
+ const warnings = [];
161
+ const collected = await collectCalls({
162
+ client,
163
+ connection,
164
+ ctx,
165
+ body: searchBody,
166
+ maxCalls,
167
+ warnings,
168
+ });
169
+ // Build the pivot matrix plus the structured data the text encoders need.
170
+ const matrix = buildMatrix(collected.rows, collected.callFormatting);
171
+ // Register the wide matrix as a canvas dataframe (used by all three formats).
172
+ const registerInput = {
173
+ source: 'export_genotype_matrix',
174
+ baseUrl: connection.baseUrl,
175
+ query: searchBody,
176
+ rows: matrix.matrixRows,
177
+ };
178
+ if (collected.truncated) {
179
+ registerInput.truncated = true;
180
+ registerInput.maxRows = maxCalls;
181
+ }
182
+ const dfResult = await bridge.registerDataframe(ctx, registerInput);
183
+ const dataframeHandle = toDataframeHandle(dfResult);
184
+ // For text formats, pull variant coordinate metadata and render the text.
185
+ let vcf;
186
+ let ped;
187
+ let map;
188
+ if (input.format === 'vcf-lite' || input.format === 'plink') {
189
+ const variantMeta = await collectVariantMetadata({
190
+ client,
191
+ connection,
192
+ dialect,
193
+ variantSetDbId: input.variantSetDbId,
194
+ neededIds: new Set(matrix.variantIdOrder),
195
+ ctx,
196
+ warnings,
197
+ });
198
+ if (input.format === 'vcf-lite') {
199
+ vcf = buildVcfText(matrix, variantMeta, collected.callFormatting);
200
+ }
201
+ else {
202
+ ped = buildPedText(matrix, collected.callFormatting);
203
+ map = buildMapText(matrix, variantMeta);
204
+ warnings.push('PLINK alleles are passed through verbatim from the genotype calls; numeric (0/1) codings are not recoded to nucleotides and `0` denotes PLINK missing. Supply letter-coded genotypes or recode downstream if a true biallelic .ped is required.');
205
+ }
206
+ }
207
+ const result = {
208
+ alias: connection.alias,
209
+ format: input.format,
210
+ rowCount: matrix.matrixRows.length,
211
+ columnCount: matrix.columnCount,
212
+ variantColumnLegend: matrix.variantColumnLegend,
213
+ callFormatting: collected.callFormatting,
214
+ dataframe: dataframeHandle,
215
+ truncated: collected.truncated,
216
+ warnings,
217
+ };
218
+ if (vcf !== undefined)
219
+ result.vcf = vcf;
220
+ if (ped !== undefined)
221
+ result.ped = ped;
222
+ if (map !== undefined)
223
+ result.map = map;
224
+ return result;
225
+ },
226
+ format: (result) => {
227
+ const lines = [];
228
+ lines.push(`# Genotype matrix — ${result.format} — ${result.rowCount} germplasm × ${result.columnCount} variants — \`${result.alias}\``);
229
+ if (result.truncated)
230
+ lines.push('> **Truncated** at pull cap. See `warnings` for details.');
231
+ lines.push('');
232
+ lines.push('## Dataframe');
233
+ lines.push(...renderDataframeHandle(result.dataframe));
234
+ lines.push('');
235
+ lines.push('## Call formatting');
236
+ const f = result.callFormatting;
237
+ lines.push(`- expandHomozygotes: ${f.expandHomozygotes ?? '—'}`);
238
+ lines.push(`- unknownString: ${f.unknownString ?? '—'}`);
239
+ lines.push(`- sepPhased: ${f.sepPhased ?? '—'}`);
240
+ lines.push(`- sepUnphased: ${f.sepUnphased ?? '—'}`);
241
+ lines.push('');
242
+ const legendEntries = Object.entries(result.variantColumnLegend);
243
+ if (legendEntries.length > 0) {
244
+ const remapped = legendEntries.filter(([col, orig]) => col !== orig);
245
+ if (remapped.length > 0) {
246
+ lines.push('## Column name remappings (sanitized → original)');
247
+ for (const [col, orig] of remapped.slice(0, 20)) {
248
+ lines.push(`- \`${col}\` → \`${orig}\``);
249
+ }
250
+ if (remapped.length > 20)
251
+ lines.push(`- …and ${remapped.length - 20} more`);
252
+ lines.push('');
253
+ }
254
+ }
255
+ // Render the format text (preview-capped; full text is in structuredContent).
256
+ if (result.vcf !== undefined) {
257
+ lines.push(...renderTextPreview('VCF-lite', 'vcf', result.vcf));
258
+ }
259
+ if (result.map !== undefined) {
260
+ lines.push(...renderTextPreview('PLINK .map', 'map', result.map));
261
+ }
262
+ if (result.ped !== undefined) {
263
+ lines.push(...renderTextPreview('PLINK .ped', 'ped', result.ped));
264
+ }
265
+ if (result.warnings.length > 0) {
266
+ lines.push('## Warnings');
267
+ for (const w of result.warnings)
268
+ lines.push(`- ${w}`);
269
+ lines.push('');
270
+ }
271
+ return [{ type: 'text', text: lines.join('\n') }];
272
+ },
273
+ });
274
+ // ---------------------------------------------------------------------------
275
+ // content[] text preview
276
+ // ---------------------------------------------------------------------------
277
+ function renderTextPreview(label, field, text) {
278
+ const allLines = text.split('\n');
279
+ const preview = allLines.slice(0, FORMAT_PREVIEW_LINES);
280
+ const out = [`## ${label}`, '```', ...preview];
281
+ if (allLines.length > FORMAT_PREVIEW_LINES) {
282
+ out.push(`… ${allLines.length - FORMAT_PREVIEW_LINES} more line(s) — full text in structuredContent.${field}`);
283
+ }
284
+ out.push('```', '');
285
+ return out;
286
+ }
287
+ /**
288
+ * Pivot the flat call rows into a wide germplasm × variant matrix and capture
289
+ * the ordered structures the VCF/PLINK encoders consume.
290
+ *
291
+ * Row identity: `callSetDbId` (preferred) or `callSetName`, else `'unknown'`.
292
+ * Variant identity: `variantDbId` (preferred) or `variantName`.
293
+ */
294
+ function buildMatrix(rows, callFormatting) {
295
+ const variantSeen = new Set();
296
+ const variantIdOrder = [];
297
+ const sampleSeen = new Set();
298
+ const sampleOrder = [];
299
+ const sampleLabels = {};
300
+ const genotypeAt = new Map();
301
+ for (const row of rows) {
302
+ const vid = row.variantDbId ?? row.variantName ?? 'unknown_variant';
303
+ if (!variantSeen.has(vid)) {
304
+ variantSeen.add(vid);
305
+ variantIdOrder.push(vid);
306
+ }
307
+ const sampleKey = row.callSetDbId ?? row.callSetName ?? 'unknown';
308
+ if (!sampleSeen.has(sampleKey)) {
309
+ sampleSeen.add(sampleKey);
310
+ sampleOrder.push(sampleKey);
311
+ sampleLabels[sampleKey] = row.callSetName ?? sampleKey;
312
+ }
313
+ const gt = renderGenotypeString(row, callFormatting);
314
+ let byVariant = genotypeAt.get(sampleKey);
315
+ if (!byVariant) {
316
+ byVariant = new Map();
317
+ genotypeAt.set(sampleKey, byVariant);
318
+ }
319
+ byVariant.set(vid, gt);
320
+ }
321
+ const { columns: sanitizedCols, toOriginal: variantColumnLegend } = buildUniqueColumns(variantIdOrder);
322
+ const matrixRows = sampleOrder.map((sampleKey) => {
323
+ const row = { germplasmDbId: sampleKey };
324
+ const byVariant = genotypeAt.get(sampleKey);
325
+ variantIdOrder.forEach((vid, i) => {
326
+ const col = sanitizedCols[i] ?? `v_${i}`;
327
+ row[col] = byVariant?.get(vid) ?? null;
328
+ });
329
+ return row;
330
+ });
331
+ return {
332
+ matrixRows,
333
+ variantColumnLegend,
334
+ columnCount: variantIdOrder.length,
335
+ variantIdOrder,
336
+ sampleOrder,
337
+ sampleLabels,
338
+ genotypeAt,
339
+ };
340
+ }
341
+ // ---------------------------------------------------------------------------
342
+ // VCF-lite / PLINK text encoders
343
+ // ---------------------------------------------------------------------------
344
+ /** Tab-join a row of cells. */
345
+ function tsv(cells) {
346
+ return cells.map(String).join('\t');
347
+ }
348
+ function buildVcfText(matrix, variantMeta, callFormatting) {
349
+ const missing = callFormatting.unknownString ?? '.';
350
+ const header = [
351
+ '#CHROM',
352
+ 'POS',
353
+ 'ID',
354
+ 'REF',
355
+ 'ALT',
356
+ ...matrix.sampleOrder.map((s) => matrix.sampleLabels[s] ?? s),
357
+ ];
358
+ const lines = [tsv(header)];
359
+ for (const vid of matrix.variantIdOrder) {
360
+ const m = variantMeta.get(vid) ?? {};
361
+ const genotypes = matrix.sampleOrder.map((s) => matrix.genotypeAt.get(s)?.get(vid) ?? missing);
362
+ lines.push(tsv([m.chrom ?? '.', m.pos ?? '.', vid, m.ref ?? '.', m.alt ?? '.', ...genotypes]));
363
+ }
364
+ return lines.join('\n');
365
+ }
366
+ function buildMapText(matrix, variantMeta) {
367
+ // chromosome, variant-id, genetic-distance (0 placeholder), base-pair position
368
+ return matrix.variantIdOrder
369
+ .map((vid) => {
370
+ const m = variantMeta.get(vid) ?? {};
371
+ return tsv([m.chrom ?? '0', vid, '0', m.pos ?? '0']);
372
+ })
373
+ .join('\n');
374
+ }
375
+ function buildPedText(matrix, callFormatting) {
376
+ // FID IID PAT MAT SEX PHENO (all 0 placeholders) + biallelic genotype pairs.
377
+ return matrix.sampleOrder
378
+ .map((sampleKey) => {
379
+ const fields = [
380
+ '0',
381
+ matrix.sampleLabels[sampleKey] ?? sampleKey,
382
+ '0',
383
+ '0',
384
+ '0',
385
+ '0',
386
+ ];
387
+ const byVariant = matrix.genotypeAt.get(sampleKey);
388
+ for (const vid of matrix.variantIdOrder) {
389
+ const [a1, a2] = splitAlleles(byVariant?.get(vid), callFormatting);
390
+ fields.push(a1, a2);
391
+ }
392
+ return fields.join('\t');
393
+ })
394
+ .join('\n');
395
+ }
396
+ /**
397
+ * Split a rendered genotype string into a biallelic pair for PLINK .ped. Splits
398
+ * on `/` or `|`; a single allele is treated as homozygous; unknown/missing maps
399
+ * to PLINK's `0` sentinel. Polyploid calls keep the first two alleles.
400
+ */
401
+ function splitAlleles(gt, callFormatting) {
402
+ const unknown = callFormatting.unknownString ?? '.';
403
+ if (!gt || gt === unknown)
404
+ return ['0', '0'];
405
+ const norm = (t) => (t === unknown || t === '.' ? '0' : t);
406
+ const tokens = gt
407
+ .split(/[/|]/)
408
+ .map((t) => t.trim())
409
+ .filter((t) => t.length > 0);
410
+ if (tokens.length === 0)
411
+ return ['0', '0'];
412
+ if (tokens.length === 1) {
413
+ const a = norm(tokens[0]);
414
+ return [a, a];
415
+ }
416
+ return [norm(tokens[0]), norm(tokens[1])];
417
+ }
418
+ /**
419
+ * Page `/variants?variantSetDbId=…` and build a `variantDbId → VariantMeta` map
420
+ * (CHROM/POS/REF/ALT) for the variants in the matrix. Best-effort: a dropped
421
+ * filter, missing endpoint, or fetch error degrades to placeholders plus a
422
+ * warning rather than failing the export. Stops early once every needed variant
423
+ * is covered.
424
+ */
425
+ async function collectVariantMetadata(args) {
426
+ const { client, connection, dialect, variantSetDbId, neededIds, ctx, warnings } = args;
427
+ const meta = new Map();
428
+ try {
429
+ const adapted = dialect.adaptGetFilters('variants', { variantSetDbIds: [variantSetDbId] });
430
+ if (adapted.dropped.length > 0 && Object.keys(adapted.filters).length === 0) {
431
+ warnings.push(`Variant metadata pull skipped: dialect '${dialect.id}' dropped the variantSetDbId filter on /variants. CHROM/POS/REF/ALT use placeholders.`);
432
+ return meta;
433
+ }
434
+ let page = 0;
435
+ let totalPages = 1;
436
+ let scanned = 0;
437
+ while (page < totalPages && scanned < MAX_VARIANT_METADATA_ROWS && !ctx.signal.aborted) {
438
+ const opts = buildRequestOptions(connection, {
439
+ ...adapted.filters,
440
+ pageSize: VARIANT_METADATA_PAGE_SIZE,
441
+ page,
442
+ });
443
+ const envelope = await client.get(connection.baseUrl, '/variants', ctx, opts);
444
+ const rows = extractRows(envelope.result);
445
+ for (const r of rows) {
446
+ scanned++;
447
+ const vid = asString(r.variantDbId);
448
+ if (!vid)
449
+ continue;
450
+ meta.set(vid, extractVariantMeta(r));
451
+ }
452
+ totalPages = envelope.metadata?.pagination?.totalPages ?? page + 1;
453
+ page++;
454
+ if (neededIds.size > 0 && [...neededIds].every((id) => meta.has(id)))
455
+ break;
456
+ if (rows.length < VARIANT_METADATA_PAGE_SIZE)
457
+ break;
458
+ }
459
+ }
460
+ catch (err) {
461
+ warnings.push(`Variant metadata pull failed (${err instanceof Error ? err.message : String(err)}). CHROM/POS/REF/ALT use placeholders.`);
462
+ }
463
+ return meta;
464
+ }
465
+ function extractVariantMeta(r) {
466
+ const meta = {};
467
+ const chrom = asString(r.referenceName);
468
+ if (chrom)
469
+ meta.chrom = chrom;
470
+ const start = r.start;
471
+ if (typeof start === 'number')
472
+ meta.pos = String(start);
473
+ else {
474
+ const startStr = asString(start);
475
+ if (startStr)
476
+ meta.pos = startStr;
477
+ }
478
+ const ref = asString(r.referenceBases);
479
+ if (ref)
480
+ meta.ref = ref;
481
+ const altRaw = r.alternateBases;
482
+ if (Array.isArray(altRaw)) {
483
+ const alts = altRaw.filter((a) => typeof a === 'string' && a.length > 0);
484
+ if (alts.length > 0)
485
+ meta.alt = alts.join(',');
486
+ }
487
+ else {
488
+ const alt = asString(altRaw);
489
+ if (alt)
490
+ meta.alt = alt;
491
+ }
492
+ return meta;
493
+ }
494
+ //# sourceMappingURL=brapi-export-genotype-matrix.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brapi-export-genotype-matrix.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-export-genotype-matrix.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAoB,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACpF,OAAO,EAAqB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAE,eAAe,EAA+B,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,OAAO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CAAC;QAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACtF,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjD,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,GAAG;YAAE,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IAC1B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -41,8 +41,6 @@ export declare const brapiFindGenotypeCalls: import("@cyanheads/mcp-ts-core").To
41
41
  genotypeValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
42
  phaseSet: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
43
  }, z.core.$loose>>;
44
- returnedCount: z.ZodNumber;
45
- totalCount: z.ZodNumber;
46
44
  hasMore: z.ZodBoolean;
47
45
  callFormatting: z.ZodObject<{
48
46
  expandHomozygotes: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
@@ -65,8 +63,6 @@ export declare const brapiFindGenotypeCalls: import("@cyanheads/mcp-ts-core").To
65
63
  maxRows: z.ZodOptional<z.ZodNumber>;
66
64
  }, z.core.$strip>>;
67
65
  truncated: z.ZodBoolean;
68
- warnings: z.ZodArray<z.ZodString>;
69
- searchBody: z.ZodRecord<z.ZodString, z.ZodUnknown>;
70
66
  }, z.core.$strip>, readonly [{
71
67
  readonly reason: "unknown_alias";
72
68
  readonly code: JsonRpcErrorCode.NotFound;
@@ -82,5 +78,11 @@ export declare const brapiFindGenotypeCalls: import("@cyanheads/mcp-ts-core").To
82
78
  readonly code: JsonRpcErrorCode.ValidationError;
83
79
  readonly when: "The active dialect declares POST /search/calls as known-dead on this server";
84
80
  readonly recovery: "Connect to a different BrAPI server that exposes a working /search/calls route — genotype-call workflows are not viable here.";
85
- }]>;
81
+ }], {
82
+ readonly totalCount: z.ZodNumber;
83
+ readonly returnedCount: z.ZodNumber;
84
+ readonly appliedFilters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
85
+ readonly notice: z.ZodOptional<z.ZodString>;
86
+ readonly warnings: z.ZodArray<z.ZodString>;
87
+ }>;
86
88
  //# sourceMappingURL=brapi-find-genotype-calls.tool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"brapi-find-genotype-calls.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAsB,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA8HjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4NjC,CAAC"}
1
+ {"version":3,"file":"brapi-find-genotype-calls.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAsB,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAgHjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqQjC,CAAC"}