/** * @fileoverview Per-connection batch cache for BrAPI reference nouns — * programs, trials, locations. Used by tools (e.g. `find_studies`) to * resolve foreign keys in a single upstream call per noun instead of N+1 * per-row lookups. Cache keys are tenant-scoped via `ctx.state` with TTL * from `BRAPI_REFERENCE_CACHE_TTL_SECONDS`. * * @module services/reference-data-cache/reference-data-cache */ import type { Context } from '@cyanheads/mcp-ts-core'; import type { ServerConfig } from '../../config/server-config.js'; import { type BrapiClient, type BrapiRequestOptions } from '../../services/brapi-client/index.js'; import type { BrapiDialect } from '../../services/brapi-dialect/index.js'; import type { Location, Program, Trial } from './types.js'; export interface ReferenceLookupOptions { auth?: BrapiRequestOptions['auth']; /** * Active dialect for the connection. Threaded through to the BrapiClient so * the v2.1 plural ID filter (`trialDbIds`, `programDbIds`, …) is translated * to the singular form servers like CassavaBase honor. Without this, the * filter is silently ignored upstream and the response carries an arbitrary * page-zero row instead of the requested record. */ dialect?: BrapiDialect; /** Optional warnings sink — receives any dialect-translation warnings. */ warnings?: string[]; } export declare class ReferenceDataCache { private readonly serverConfig; private readonly client; constructor(serverConfig: ServerConfig, client?: () => BrapiClient); getPrograms(baseUrl: string, programDbIds: readonly string[], ctx: Context, options?: ReferenceLookupOptions): Promise>; getTrials(baseUrl: string, trialDbIds: readonly string[], ctx: Context, options?: ReferenceLookupOptions): Promise>; getLocations(baseUrl: string, locationDbIds: readonly string[], ctx: Context, options?: ReferenceLookupOptions): Promise>; /** Drop every cached entry for a base URL across all reference nouns. */ invalidate(baseUrl: string, ctx: Context): Promise; private batchResolve; private fetchBatch; private deletePrefix; } export declare function initReferenceDataCache(serverConfig: ServerConfig): void; export declare function getReferenceDataCache(): ReferenceDataCache; export declare function resetReferenceDataCache(): void; //# sourceMappingURL=reference-data-cache.d.ts.map