/** * @fileoverview Tool to query a Census dataset for variables at a specific geography. * @module mcp-server/tools/definitions/census-query-data */ import { z } from '@cyanheads/mcp-ts-core'; import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors'; export declare const censusQueryData: import("@cyanheads/mcp-ts-core").ToolDefinition; geography_level: z.ZodString; geography_fips: z.ZodString; parent_fips: z.ZodOptional, z.ZodString]>>; county_fips: z.ZodOptional, z.ZodString]>>; predicates: z.ZodOptional>; dataset: z.ZodOptional; year: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ rows: z.ZodArray; applied_filters: z.ZodOptional>; record: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>, readonly [{ readonly reason: "dataset_not_found"; readonly code: JsonRpcErrorCode.NotFound; readonly when: "Dataset code is not recognized."; readonly recovery: "Call census_list_datasets to discover valid dataset codes like acs/acs5."; }, { readonly reason: "missing_api_key"; readonly code: JsonRpcErrorCode.Unauthorized; readonly when: "CENSUS_API_KEY is not configured or the key is invalid."; readonly thrownBy: "service"; readonly recovery: "Set the CENSUS_API_KEY environment variable and restart the server. Register a free key at api.census.gov/data/key_signup.html."; }, { readonly reason: "year_not_available"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "The dataset does not serve the requested vintage year."; readonly thrownBy: "service"; readonly recovery: "Retry with a year from available_years in census_list_datasets; the error names the years this dataset serves."; }, { readonly reason: "variable_not_found"; readonly code: JsonRpcErrorCode.NotFound; readonly when: "One or more variable codes do not exist in the requested dataset and year."; readonly thrownBy: "service"; readonly recovery: "Call census_search_variables or census_get_variable to confirm codes for this dataset and year."; }, { readonly reason: "variables_unavailable"; readonly code: JsonRpcErrorCode.ServiceUnavailable; readonly when: "The variable metadata endpoint returned an unparseable response for this dataset and year."; readonly retryable: true; readonly thrownBy: "service"; readonly recovery: "Retry the request; if it persists, the Census metadata endpoint is temporarily unavailable."; }, { readonly reason: "geography_not_supported"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "The requested geography level does not exist in this dataset and year."; readonly recovery: "Call census_list_geographies to see supported geography levels for this dataset."; }, { readonly reason: "parent_required"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "The geography level requires a parent FIPS code but parent_fips was not provided, or a tract/block-group level requires county_fips but it was omitted."; readonly recovery: "Add parent_fips (state FIPS) from census_resolve_geography state_fips. For tract or block-group levels also add county_fips from census_resolve_geography county_fips."; }, { readonly reason: "parent_not_accepted"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "parent_fips or county_fips names a parent the geography level does not sit within."; readonly recovery: "Drop the parent this level does not name. Levels such as zip code tabulation area, urban area, and metropolitan statistical area/micropolitan statistical area are queried with no parent at all; census_list_geographies shows the parents each level takes."; }, { readonly reason: "no_data"; readonly code: JsonRpcErrorCode.NotFound; readonly when: "The query returned no rows."; readonly recovery: "Confirm the FIPS codes exist for this dataset and year — census_resolve_geography returns them for a place name, and census_list_geographies confirms the level is supported."; }, { readonly reason: "too_many_variables"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "More than 50 variable codes were requested."; readonly recovery: "Split the request into multiple calls with at most 50 variables each."; }, { readonly reason: "predicate_not_supported"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "A key in predicates is not a variable in this dataset and year."; readonly recovery: "Remove the unrecognized key. Call census_search_variables on this dataset and year for the codes it does define — predicate names are vintage-specific, so NAICS2017 and NAICS2022 belong to different years."; }, { readonly reason: "upstream_error"; readonly code: JsonRpcErrorCode.ServiceUnavailable; readonly when: "Census API returned an error or was unreachable."; readonly retryable: true; readonly thrownBy: "service"; readonly recovery: "Retry the request; if the error persists, the Census API may be temporarily unavailable."; }], { readonly totalRows: z.ZodNumber; readonly dataset: z.ZodString; readonly year: z.ZodNumber; readonly notice: z.ZodOptional; }>; //# sourceMappingURL=census-query-data.tool.d.ts.map