/** * @fileoverview Reader and local search for the full USGS parameter-code catalog, served by the * USGS Water Data OGC API (`collections/parameter-codes`). The whole catalog (~19,600 codes) is read * in one request, cached in module scope for 24 hours, and searched in memory. * @module services/waterdata/parameter-catalog */ import { type Context } from '@cyanheads/mcp-ts-core'; import { type CuratedParameter } from './curated-parameters.js'; /** One record of the USGS parameter-code catalog. */ export interface CatalogParameter { /** 5-digit USGS parameter code. */ code: string; /** Long-form description (e.g. "Discharge, cubic feet per second"). */ description: string; /** Short parameter name (e.g. "Discharge"). */ name: string; /** Unit of measure as the catalog writes it (e.g. "ft3/s"). */ unit: string; } /** A search result: a curated entry, or a catalog record for a code outside the curated table. */ export type ParameterEntry = (CuratedParameter & { source: 'curated'; }) | (CatalogParameter & { source: 'usgs-catalog'; }); /** * The full parameter-code catalog, sorted by code. Served from the module-scope cache while it is * younger than 24 hours; otherwise fetched, with concurrent callers sharing one fetch. A failed * fetch is never cached, so the next call tries again. * * @throws {McpError} `ServiceUnavailable` when any page fails, times out, or is not a catalog page. */ export declare function getParameterCatalog(ctx: Context): Promise; /** * Search the catalog and the curated table. * * A bare 5-digit query matches that code alone. Otherwise every token must start a word in the * name or the description (case-insensitive); a query with no letters or digits matches nothing. * Results run: curated entries that match (by their own name or their catalog record), in curated * order, each once; then catalog records whose name holds every token; then description-only * matches — both by code. */ export declare function searchParameters(catalog: readonly CatalogParameter[], query: string): ParameterEntry[]; //# sourceMappingURL=parameter-catalog.d.ts.map