/** * @fileoverview Shared genotype-call pull logic — the async-search machinery * (`POST /search/calls` → poll → page-walk) and the `CallRow` schema extracted * from `brapi-find-genotype-calls.tool.ts` so that `brapi_export_genotype_matrix` * can reuse the same pull infrastructure without duplicating it. * * This module owns: the `CallRowSchema`, `CallFormatting` type, and the * `collectCalls` / `consumePage` helpers. It does NOT contain `spillCalls` or * any tool-level concerns — those stay in the consuming tool files. * * @module mcp-server/tools/shared/genotype-calls */ import { type Context, z } from '@cyanheads/mcp-ts-core'; import type { BrapiClient } from '../../../services/brapi-client/index.js'; import type { RegisteredServer } from '../../../services/server-registry/types.js'; export declare const CallRowSchema: z.ZodObject<{ callSetDbId: z.ZodOptional>; callSetName: z.ZodOptional>; variantDbId: z.ZodOptional>; variantName: z.ZodOptional>; variantSetDbId: z.ZodOptional>; genotype: z.ZodOptional>>; }, z.core.$loose>>>; genotypeValue: z.ZodOptional>; phaseSet: z.ZodOptional>; }, z.core.$loose>; export type CallRow = z.infer; export interface CallFormatting { expandHomozygotes?: boolean | null; sepPhased?: string | null; sepUnphased?: string | null; unknownString?: string | null; } export interface CollectCallsInput { body: Record; client: BrapiClient; connection: RegisteredServer; ctx: Context; maxCalls: number; warnings: string[]; } export interface CollectCallsResult { callFormatting: CallFormatting; rows: CallRow[]; truncated: boolean; } /** * Build the POST /search/calls body from named filter params. Handles both the * singular `variantSetDbId` convenience and the plural `variantSetDbIds` array, * merging and deduplicating them. */ export declare function buildCallsSearchBody(input: { variantSetDbId?: string | undefined; variantSetDbIds?: string[] | undefined; germplasmDbIds?: string[] | undefined; callSetDbIds?: string[] | undefined; variantDbIds?: string[] | undefined; callFormat?: string | undefined; }): Record; /** * Pull all genotype call pages for a given search body, capping at `maxCalls`. * Uses BrAPI's async-search pattern: `POST /search/calls` → `GET /search/calls/{id}` * with 202-retry. Pages are collected until all results are fetched or `maxCalls` * is reached. */ export declare function collectCalls(input: CollectCallsInput): Promise; /** * Extract call rows and `callFormatting` hints from one BrAPI envelope page. * Mutates `rows` in-place; invokes `setCallFormatting` when formatting hints * are present so the caller can merge across pages. */ export declare function consumePage(envelope: Awaited>, rows: CallRow[], setCallFormatting: (f: CallFormatting) => void): void; /** * Render the genotype string for one call row given the server's callFormatting * hints. Prefers `genotype.values` joined with the appropriate separator; * falls back to `genotypeValue`; returns the `unknownString` (or ".") when * no data is available. */ export declare function renderGenotypeString(row: CallRow, callFormatting: CallFormatting, phased?: boolean): string; //# sourceMappingURL=genotype-calls.d.ts.map