@cyanheads/gbif-biodiversity-mcp-server 0.6.0 → 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 (33) hide show
  1. package/CLAUDE.md +1 -1
  2. package/README.md +21 -14
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/mcp-server/tools/definitions/gbif-count-occurrences.tool.d.ts +4 -2
  6. package/dist/mcp-server/tools/definitions/gbif-count-occurrences.tool.d.ts.map +1 -1
  7. package/dist/mcp-server/tools/definitions/gbif-count-occurrences.tool.js +34 -9
  8. package/dist/mcp-server/tools/definitions/gbif-count-occurrences.tool.js.map +1 -1
  9. package/dist/mcp-server/tools/definitions/gbif-occurrence-facets.tool.d.ts +4 -2
  10. package/dist/mcp-server/tools/definitions/gbif-occurrence-facets.tool.d.ts.map +1 -1
  11. package/dist/mcp-server/tools/definitions/gbif-occurrence-facets.tool.js +26 -9
  12. package/dist/mcp-server/tools/definitions/gbif-occurrence-facets.tool.js.map +1 -1
  13. package/dist/mcp-server/tools/definitions/gbif-search-datasets.tool.d.ts +2 -2
  14. package/dist/mcp-server/tools/definitions/gbif-search-datasets.tool.d.ts.map +1 -1
  15. package/dist/mcp-server/tools/definitions/gbif-search-datasets.tool.js +7 -5
  16. package/dist/mcp-server/tools/definitions/gbif-search-datasets.tool.js.map +1 -1
  17. package/dist/mcp-server/tools/definitions/gbif-search-occurrences.tool.d.ts +5 -3
  18. package/dist/mcp-server/tools/definitions/gbif-search-occurrences.tool.d.ts.map +1 -1
  19. package/dist/mcp-server/tools/definitions/gbif-search-occurrences.tool.js +33 -21
  20. package/dist/mcp-server/tools/definitions/gbif-search-occurrences.tool.js.map +1 -1
  21. package/dist/mcp-server/tools/definitions/gbif-search-publishers.tool.d.ts.map +1 -1
  22. package/dist/mcp-server/tools/definitions/gbif-search-publishers.tool.js +12 -1
  23. package/dist/mcp-server/tools/definitions/gbif-search-publishers.tool.js.map +1 -1
  24. package/dist/mcp-server/tools/utils.d.ts +50 -0
  25. package/dist/mcp-server/tools/utils.d.ts.map +1 -1
  26. package/dist/mcp-server/tools/utils.js +63 -0
  27. package/dist/mcp-server/tools/utils.js.map +1 -1
  28. package/dist/services/gbif/gbif-service.d.ts +6 -0
  29. package/dist/services/gbif/gbif-service.d.ts.map +1 -1
  30. package/dist/services/gbif/gbif-service.js +12 -0
  31. package/dist/services/gbif/gbif-service.js.map +1 -1
  32. package/package.json +1 -1
  33. package/server.json +3 -3
package/CLAUDE.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Developer Protocol
2
2
 
3
3
  **Server:** @cyanheads/gbif-biodiversity-mcp-server
4
- **Version:** 0.6.0
4
+ **Version:** 0.7.0
5
5
  **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.1`
6
6
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
7
7
  **MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  <div align="center">
9
9
 
10
- [![Version](https://img.shields.io/badge/Version-0.6.0-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/gbif-biodiversity-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.30.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/gbif-biodiversity-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/gbif-biodiversity-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.14-blueviolet.svg?style=flat-square)](https://bun.sh/)
10
+ [![Version](https://img.shields.io/badge/Version-0.7.0-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/gbif-biodiversity-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.30.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/gbif-biodiversity-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/gbif-biodiversity-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.14-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
11
 
12
12
  </div>
13
13
 
@@ -35,11 +35,11 @@
35
35
  | `gbif_search_species` | Search or browse the GBIF backbone taxonomy by name fragment, rank, kingdom, family, or genus |
36
36
  | `gbif_get_species_classification` | Return the root-to-parent classification chain for a taxon — root-first ordered array from kingdom to the queried taxon's immediate parent (the taxon itself is not included) |
37
37
  | `gbif_get_species_children` | List direct children of a backbone taxon — genera within a family, species within a genus |
38
- | `gbif_search_occurrences` | Search 2.4B+ GBIF occurrence records with Darwin Core filters — country, bounding box, WKT geometry, year, month, basis of record, presence/absence, IUCN Red List category |
38
+ | `gbif_search_occurrences` | Search 3.9B+ GBIF occurrence records with Darwin Core filters — country, publishing country, state/province, bounding box, WKT geometry, year, month, basis of record, presence/absence, IUCN Red List category |
39
39
  | `gbif_count_occurrences` | Count occurrences matching a filter without fetching records — fast single-number response, filtered to sightings by default |
40
40
  | `gbif_get_occurrence` | Fetch a single occurrence record by key — full Darwin Core record with GADM geography, presence/absence status, conservation status, media, and quality flags |
41
41
  | `gbif_occurrence_facets` | Aggregate occurrence counts by a dimension — country, year, basis of record, dataset, kingdom, presence/absence, IUCN Red List category |
42
- | `gbif_search_datasets` | Search GBIF datasets by keyword, type, country, or publishing organization |
42
+ | `gbif_search_datasets` | Search GBIF datasets by keyword, type, country, or hosting organization |
43
43
  | `gbif_get_dataset` | Fetch full dataset metadata by UUID — title, description, citation, contacts, license, DOI, coverage |
44
44
  | `gbif_search_publishers` | Search GBIF-registered publishing organizations by name fragment or country |
45
45
 
@@ -115,17 +115,20 @@ List direct children of a backbone taxon.
115
115
 
116
116
  ### `gbif_search_occurrences`
117
117
 
118
- Search 2.4B+ GBIF occurrence records with full Darwin Core filtering.
118
+ Search 3.9B+ GBIF occurrence records with full Darwin Core filtering.
119
119
 
120
120
  - Use `taxonKey` from `gbif_match_species` for reliable results — resolves synonyms automatically; `scientificName` filter does not
121
- - Geographic filters: `country` (ISO 3166-1 alpha-2), bounding box (`decimalLatitude`/`decimalLongitude` ranges as "min,max"), or WKT polygon (`geometry`)
121
+ - Geographic filters: `country` (ISO 3166-1 alpha-2, uppercase), `stateProvince`, bounding box (`decimalLatitude`/`decimalLongitude` ranges as "min,max"), or WKT polygon (`geometry`)
122
+ - `publishingCountry` (ISO 3166-1 alpha-2, uppercase) is the country of the *publishing organization*, not of the observation — a different question from `country`, and the two disagree on most records: of 60,290,950 records observed in GB, 1,548,928 were published by US organizations
123
+ - Both country filters take the uppercase two-letter form only. GBIF parses a lowercase or alpha-3 code and then matches the verbatim string, so `gb` and `USA` return zero records instead of an error; the schema pattern turns that silent wrong answer into a validation error naming the accepted form. A two-letter code GBIF does not assign (`XX`) is rejected upstream by name and surfaces as `invalid_filter`
124
+ - `stateProvince` is matched verbatim — exact and case-sensitive, with no controlled vocabulary behind it. Take a value from a `STATE_PROVINCE` facet rather than guessing; an unmatched value returns zero records instead of an error, and the enrichment notice says so when it happens
122
125
  - Temporal filters: `year` as single year or range, `month` (1–12) for seasonal queries
123
126
  - `basisOfRecord` enum: `HUMAN_OBSERVATION`, `PRESERVED_SPECIMEN`, `MACHINE_OBSERVATION`, and more
124
127
  - `hasCoordinate` to require or exclude georeferenced records
125
128
  - `occurrenceStatus` — `PRESENT` (default), `ABSENT`, or `ANY`. GBIF indexes absence records (a survey that looked for the taxon and did not find it) alongside sightings; the default excludes them and the enrichment says so on every call
126
129
  - `iucnRedListCategory` — `CR`, `EN`, `VU`, `NT`, `LC`, `DD`, `EX`, `EW`, `CD`
127
130
  - Output per record adds `taxonomicStatus`, `eventTime` (with UTC offset), `occurrenceStatus`, and `iucnRedListCategory`
128
- - Pagination capped at offset+limit = 100,001, the deepest page GBIF serves — use `gbif_occurrence_facets` for aggregate analysis beyond this
131
+ - Pagination capped at offset+limit = 100,001, the deepest page GBIF serves. The API has no cursor or scroll, so a larger result set is covered by partitioning it — facet by `DATASET_KEY` with `gbif_occurrence_facets`, then search each `datasetKey` on its own. Retrieving a set in one piece is not something this server can do: that needs GBIF's Download API with a GBIF.org account, or GBIF's monthly snapshot on AWS Open Data
129
132
 
130
133
  ---
131
134
 
@@ -134,9 +137,9 @@ Search 2.4B+ GBIF occurrence records with full Darwin Core filtering.
134
137
  Count occurrences matching a filter without fetching any records.
135
138
 
136
139
  - Backed by `/occurrence/search` at `limit=0` — no record payload, and the same endpoint `gbif_search_occurrences` queries, so the two agree on the same question. GBIF's dedicated `/occurrence/count` endpoint takes a closed parameter set that rejects `occurrenceStatus` and `iucnRedListCategory` outright
137
- - Supported filters: `taxonKey`, `country`, `isGeoreferenced`, `datasetKey`, `year`, `occurrenceStatus`, `iucnRedListCategory`
140
+ - Supported filters: `taxonKey`, `country`, `publishingCountry`, `stateProvince`, `isGeoreferenced`, `datasetKey`, `year`, `occurrenceStatus`, `iucnRedListCategory`. `country` and `publishingCountry` take the uppercase alpha-2 form only, for the reason given under `gbif_search_occurrences`
138
141
  - Counts sightings only by default, matching `gbif_search_occurrences`. For absence-heavy taxa the unfiltered figure is a different question entirely — *Radicipes gracilis* has 2,351,582 indexed records of which 79 are presences
139
- - Use to assess result set size before deciding whether to paginate a full search
142
+ - Use to assess result set size before deciding whether to paginate a full search. A count above 100,001 means paging cannot reach the end of it, and the enrichment notice says so and names the partition route
140
143
 
141
144
  ---
142
145
 
@@ -160,9 +163,11 @@ Fetch a single occurrence record by GBIF occurrence key.
160
163
  Aggregate occurrence counts across a dimension.
161
164
 
162
165
  - Facets: `COUNTRY`, `STATE_PROVINCE`, `YEAR`, `BASIS_OF_RECORD`, `DATASET_KEY`, `KINGDOM_KEY`, `PHYLUM_KEY`, `CLASS_KEY`, `ORDER_KEY`, `FAMILY_KEY`, `GENUS_KEY`, `SPECIES_KEY`, `PUBLISHING_COUNTRY`, `MONTH`, `OCCURRENCE_STATUS`, `IUCN_RED_LIST_CATEGORY`
163
- - Scope with `taxonKey`, `country`, `year`, `geometry`, `basisOfRecord`, `datasetKey`, `occurrenceStatus`, or `iucnRedListCategory` filters
166
+ - Scope with `taxonKey`, `country`, `publishingCountry`, `stateProvince`, `year`, `geometry`, `basisOfRecord`, `datasetKey`, `occurrenceStatus`, or `iucnRedListCategory` filters — so a `COUNTRY`, `PUBLISHING_COUNTRY`, or `STATE_PROVINCE` bucket can be passed straight back to drill into it. `country` and `publishingCountry` take the uppercase alpha-2 form only, for the reason given under `gbif_search_occurrences`
164
167
  - Aggregates sightings only by default, matching the search and count tools. To measure the presence/absence split itself, pass `facet: OCCURRENCE_STATUS` with `occurrenceStatus: ANY`
165
168
  - Returns one page of values ranked by count descending — up to `facetLimit` (max 100), the top ones only while `facetOffset` is 0 — with no record payloads
169
+ - `DATASET_KEY` is the basis for splitting a result set too large for `gbif_search_occurrences` to page: every occurrence carries exactly one `datasetKey`, so its buckets sum to the scope's full total, and it has the cardinality to cut a large scope into pageable pieces. `BASIS_OF_RECORD` and `PUBLISHING_COUNTRY` are gap-free too and both have a matching filter on the occurrence tools, so either can drive a further split of a bucket still over the cap — but on that scope they return 9 and 41 buckets against `DATASET_KEY`'s 550, too coarse for the first cut. A dimension a record can lack drops that record: a 60,290,950-record scope faceted by `YEAR` sums to 59,407,400, leaving 883,550 undated records out, and `MONTH`, `STATE_PROVINCE`, and `SPECIES_KEY` behave the same way — `STATE_PROVINCE` included, even though the occurrence tools can filter on it
170
+ - The scope filters here are narrower than `gbif_search_occurrences` accepts — no `scientificName`, `month`, bounding box, `hasCoordinate`, `isInCluster`, or `coordinateUncertaintyInMeters`. Buckets sum to a search's total only when both calls carry the same filters; re-apply the rest on each per-`datasetKey` search
166
171
  - Page past the first `facetLimit` with `facetOffset` (advance by `facetLimit` per page) to walk high-cardinality facets like `DATASET_KEY`; enrichment echoes the applied `facetOffset` and sets `moreValuesLikely` when a full page suggests more values remain
167
172
  - Core tool for distribution analysis ("which countries have the most records?") and trend queries ("how has observation volume changed since 2010?")
168
173
 
@@ -170,12 +175,13 @@ Aggregate occurrence counts across a dimension.
170
175
 
171
176
  ### `gbif_search_datasets`
172
177
 
173
- Search GBIF datasets by keyword, type, country, or publishing organization.
178
+ Search GBIF datasets by keyword, type, country, or hosting organization.
174
179
 
175
- - Filters: free-text query, dataset type (`OCCURRENCE`, `CHECKLIST`, `METADATA`, `SAMPLING_EVENT`), publishing country, hosting organization UUID
180
+ - Filters: free-text query, dataset type (`OCCURRENCE`, `CHECKLIST`, `METADATA`, `SAMPLING_EVENT`), `publishingCountry` (ISO 3166-1 alpha-2, uppercase), hosting organization UUID
181
+ - `publishingCountry` takes the uppercase two-letter form only, for the same reason the occurrence filters do: `/dataset/search` matches the verbatim stored code, so `gb` and `GBR` return zero datasets where `GB` returns 2,416. A two-letter code GBIF does not assign (`XX`) is rejected upstream by name and surfaces as `invalid_filter`
176
182
  - Returns title, type, description, license, DOI, and record count. `recordCount` spans every `occurrenceStatus`, absences included — `gbif_count_occurrences` with the same key counts sightings only by default, so the two figures differ by design
177
183
  - The `description` is a 300-character preview — `descriptionTruncated` flags when it was shortened, and `gbif_get_dataset` returns the full text
178
- - Use `hostingOrg` from `gbif_search_publishers` to scope to datasets from one organization
184
+ - Use `hostingOrg` from `gbif_search_publishers` to scope to the datasets one organization hosts — the hosting organization runs the installation a dataset is served from, which is often not the organization that published it
179
185
  - Paginated — limit up to 1000
180
186
 
181
187
  ---
@@ -198,7 +204,8 @@ Fetch full dataset metadata by UUID.
198
204
  Search organizations registered with GBIF.
199
205
 
200
206
  - Filter by name fragment or country
201
- - Returns organization key, title, and country — sufficient to chain into `gbif_search_datasets` with `hostingOrg`
207
+ - `country` here is unconstrained on purpose: the registry endpoint matches the *parsed* country rather than the verbatim string, so `gb`, `GBR`, and `GB` all return the same 223 organizations. The uppercase-only rule the occurrence tools and `gbif_search_datasets` carry exists to close a silent zero that does not occur on this route
208
+ - Returns organization key, title, and country. The key chains into `gbif_search_datasets` as `hostingOrg`, which matches only datasets the organization *hosts* — an organization that publishes datasets hosted elsewhere returns none
202
209
  - Paginated — limit up to 1000
203
210
 
204
211
  ## Resources
@@ -223,7 +230,7 @@ GBIF-specific:
223
230
 
224
231
  - Full GBIF REST API v1 coverage: species taxonomy, occurrences, datasets, and publishers
225
232
  - `gbif_match_species` as the entry point — resolves synonyms to backbone taxon keys used throughout
226
- - Occurrence pagination guarded at GBIF's own offset+limit = 100,001 boundary — an over-cap request fails locally with a `notice` redirecting to facet aggregation, instead of spending the retry budget on a deterministic upstream rejection
233
+ - Occurrence pagination guarded at GBIF's own offset+limit = 100,001 boundary — an over-cap request fails locally with a recovery hint naming the `DATASET_KEY` partition technique, instead of spending the retry budget on a deterministic upstream rejection, and a match larger than the cap says so on the first page rather than after hundreds of them
227
234
  - WKT polygon geometry support for geographic occurrence queries
228
235
  - Darwin Core field mapping with explicit provenance on sparse upstream fields
229
236
 
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ import { initGbifService } from './services/gbif/gbif-service.js';
28
28
  await createApp({
29
29
  name: 'gbif-biodiversity-mcp-server',
30
30
  title: 'gbif-biodiversity-mcp-server',
31
- instructions: 'Use the gbif_* tools to query species taxonomy, occurrences, datasets, and publishers via the GBIF API. Keyless — these endpoints need no credentials. Resolve any name with gbif_match_species first — it returns the backbone taxonKey the occurrence tools expect, resolving a synonym to its accepted taxon and reporting the matched synonym key alongside as matchedTaxonKey, unlike the raw scientificName filter. Countries use ISO 3166-1 alpha-2; datasets and publishers are keyed by UUID, occurrences by integer key. GBIF indexes absence records — a documented survey that looked for a taxon and did not find it — alongside sightings, so gbif_search_occurrences, gbif_count_occurrences, and gbif_occurrence_facets all default occurrenceStatus to PRESENT and report the applied filter in their enrichment; pass ANY to include absences, or ABSENT for absences alone. For some taxa absences dominate: an unfiltered count can run five orders of magnitude above the sightings it appears to report. The dataset recordCount on gbif_search_datasets, gbif_get_dataset, and the gbif://dataset/{datasetKey} resource is not filtered that way — it spans every occurrenceStatus, so it will exceed a gbif_count_occurrences total for the same datasetKey by design. Occurrence paging caps at offset+limit=100,001 — switch to gbif_occurrence_facets for larger aggregate analysis.',
31
+ instructions: 'Use the gbif_* tools to query species taxonomy, occurrences, datasets, and publishers via the GBIF API. Keyless — these endpoints need no credentials. Resolve any name with gbif_match_species first — it returns the backbone taxonKey the occurrence tools expect, resolving a synonym to its accepted taxon and reporting the matched synonym key alongside as matchedTaxonKey, unlike the raw scientificName filter. Countries use ISO 3166-1 alpha-2; datasets and publishers are keyed by UUID, occurrences by integer key. On the occurrence tools country and publishingCountry, and on gbif_search_datasets publishingCountry, the uppercase two-letter form is the only one accepted — lowercase and alpha-3 forms ("gb", "USA") match nothing on those routes, so those fields reject anything else rather than answering zero, while gbif_search_publishers resolves either form case-insensitively against the registry and needs no such constraint. On the occurrence tools country is where the record was observed and publishingCountry is the country of the organization that published it — different questions that disagree on most records, so pick deliberately; stateProvince is matched verbatim, exactly and case-sensitively, and an unrecognized value returns zero records rather than an error, so take one from a STATE_PROVINCE facet instead of guessing a spelling. GBIF indexes absence records — a documented survey that looked for a taxon and did not find it — alongside sightings, so gbif_search_occurrences, gbif_count_occurrences, and gbif_occurrence_facets all default occurrenceStatus to PRESENT and report the applied filter in their enrichment; pass ANY to include absences, or ABSENT for absences alone. For some taxa absences dominate: an unfiltered count can run five orders of magnitude above the sightings it appears to report. The dataset recordCount on gbif_search_datasets, gbif_get_dataset, and the gbif://dataset/{datasetKey} resource is not filtered that way — it spans every occurrenceStatus, so it will exceed a gbif_count_occurrences total for the same datasetKey by design. Occurrence paging caps at offset+limit=100,001 and GBIF exposes no cursor or scroll, so a larger result set is reached only by partitioning it: gbif_occurrence_facets with facet DATASET_KEY splits a scope into buckets that sum to its full total, since every occurrence carries exactly one datasetKey, and each bucket is then searchable on its own; a facet on a dimension a record can lack — YEAR, MONTH, STATE_PROVINCE — leaves those records in no bucket, stateProvince included even though the occurrence tools can filter on it, while BASIS_OF_RECORD and PUBLISHING_COUNTRY are gap-free and both have a matching search filter, making either a sound second cut on a bucket still over the cap though too coarse for the first. Bucket sums reconcile only against the same occurrenceStatus, and only when the facet call repeats the search filters — gbif_occurrence_facets accepts a narrower set than gbif_search_occurrences and gbif_count_occurrences, so re-apply whatever it cannot take on each per-datasetKey search. This server cannot retrieve a result set in bulk — the GBIF Download API needs a GBIF.org account and returns an archive asynchronously, and the monthly GBIF Parquet snapshot on AWS Open Data is a bulk dataset; both are routes to take outside this server.',
32
32
  tools: [
33
33
  gbifMatchSpecies,
34
34
  gbifBulkMatchSpecies,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,YAAY;AACZ,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAC;AACtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,+DAA+D,CAAC;AAC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Ae,EAAE,MAAM,iCAAiC,CAAC;AAElE,MAAM,SAAS,CAAC;IACd,IAAI,EAAE,8BAA8B;IACpC,KAAK,EAAE,8BAA8B;IACrC,YAAY,EACV,6xGAA6xG;IAC/xG,KAAK,EAAE;QACL,gBAAgB;QAChB,oBAAoB;QACpB,cAAc;QACd,iBAAiB;QACjB,4BAA4B;QAC5B,sBAAsB;QACtB,qBAAqB;QACrB,oBAAoB;QACpB,iBAAiB;QACjB,oBAAoB;QACpB,kBAAkB;QAClB,cAAc;QACd,oBAAoB;KACrB;IACD,SAAS,EAAE,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IACrD,OAAO,EAAE,EAAE;IACX,6EAA6E;IAC7E,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;IAC/B,KAAK,CAAC,IAAI;QACR,MAAM,GAAG,GAAG,eAAe,EAAE,CAAC;QAC9B,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE;YACzC,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,SAAS,EAAE,GAAG,CAAC,gBAAgB;YAC/B,SAAS,EAAE,GAAG,CAAC,SAAS;SACzB,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
@@ -7,6 +7,8 @@ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
7
  export declare const gbifCountOccurrences: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
8
8
  taxonKey: z.ZodOptional<z.ZodNumber>;
9
9
  country: z.ZodOptional<z.ZodString>;
10
+ publishingCountry: z.ZodOptional<z.ZodString>;
11
+ stateProvince: z.ZodOptional<z.ZodString>;
10
12
  isGeoreferenced: z.ZodOptional<z.ZodBoolean>;
11
13
  datasetKey: z.ZodOptional<z.ZodString>;
12
14
  year: z.ZodOptional<z.ZodString>;
@@ -31,8 +33,8 @@ export declare const gbifCountOccurrences: import("@cyanheads/mcp-ts-core").Tool
31
33
  }, z.core.$strip>, readonly [{
32
34
  readonly reason: "invalid_filter";
33
35
  readonly code: JsonRpcErrorCode.InvalidParams;
34
- readonly when: "datasetKey is not a UUID, or GBIF rejected another filter value as malformed.";
35
- readonly recovery: "Supply datasetKey as the 8-4-4-4-12 hex UUID gbif_search_datasets returns; year is a single year or a \"min,max\" range.";
36
+ readonly when: "datasetKey is not a UUID, a two-letter country or publishingCountry code is one GBIF does not know, or GBIF rejected another filter value as malformed.";
37
+ readonly recovery: "Supply datasetKey as the 8-4-4-4-12 hex UUID gbif_search_datasets returns; year is a single year or a \"min,max\" range; country and publishingCountry are codes GBIF assigns, so take one from a COUNTRY or PUBLISHING_COUNTRY facet on gbif_occurrence_facets.";
36
38
  }], {
37
39
  readonly occurrenceStatus: z.ZodString;
38
40
  readonly notice: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"gbif-count-occurrences.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-count-occurrences.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiH/B,CAAC"}
1
+ {"version":3,"file":"gbif-count-occurrences.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-count-occurrences.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAUjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsJ/B,CAAC"}
@@ -6,22 +6,39 @@ import { tool, z } from '@cyanheads/mcp-ts-core';
6
6
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
7
  import { getGbifService } from '../../../services/gbif/gbif-service.js';
8
8
  import { IUCN_RED_LIST_CATEGORY_VALUES, OCCURRENCE_STATUS_VALUES } from '../../../services/gbif/types.js';
9
- import { isGbifUuid, occurrenceStatusNotice } from '../utils.js';
9
+ import { isGbifUuid, occurrenceStatusNotice, overPaginationCapNotice, stateProvinceNoMatchNotice, } from '../utils.js';
10
10
  export const gbifCountOccurrences = tool('gbif_count_occurrences', {
11
11
  title: 'Count Occurrences',
12
12
  description: 'Count occurrences matching a taxon + location filter without fetching records. ' +
13
13
  'Use for quick totals ("how many Aves records in Sweden?") or before deciding whether ' +
14
- 'to paginate a full search. Accepts taxonKey, country, isGeoreferenced, datasetKey, year, ' +
14
+ 'to paginate a full search. Accepts taxonKey, country (uppercase ISO 3166-1 alpha-2), ' +
15
+ 'publishingCountry, stateProvince, ' +
16
+ 'isGeoreferenced, datasetKey, year, ' +
15
17
  'occurrenceStatus, and iucnRedListCategory. Counts sightings only by default, matching ' +
16
18
  'gbif_search_occurrences — GBIF also indexes absence records, and for some taxa they are ' +
17
- 'the overwhelming majority.',
19
+ 'the overwhelming majority. A count above 100,001 is the signal to partition rather than ' +
20
+ 'page: gbif_search_occurrences cannot reach past that offset, so split the query by ' +
21
+ 'DATASET_KEY via gbif_occurrence_facets and search each dataset separately.',
18
22
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
19
23
  input: z.object({
20
24
  taxonKey: z
21
25
  .number()
22
26
  .optional()
23
27
  .describe('GBIF backbone taxon key from gbif_match_species. Matches the given taxon and all descendant taxa (subspecies, varieties, etc.).'),
24
- country: z.string().optional().describe('ISO 3166-1 alpha-2 country code (e.g., "GB", "US").'),
28
+ country: z
29
+ .string()
30
+ .regex(/^[A-Z]{2}$/, 'country must be an uppercase ISO 3166-1 alpha-2 code such as GB, US, or SE. Lowercase ("gb"), alpha-3 ("USA"), and country names ("Britain") match no records upstream.')
31
+ .optional()
32
+ .describe('ISO 3166-1 alpha-2 code, uppercase, of where the occurrence was recorded (e.g., "GB", "US"). Not the publisher\'s country — that is publishingCountry, and the two disagree on most records. Lowercase and alpha-3 forms ("gb", "USA") match nothing upstream, which is why only the uppercase two-letter form is accepted here. Take a value from a COUNTRY facet on gbif_occurrence_facets; an uppercase pair GBIF does not know ("XX") is rejected upstream by name.'),
33
+ publishingCountry: z
34
+ .string()
35
+ .regex(/^[A-Z]{2}$/, 'publishingCountry must be an uppercase ISO 3166-1 alpha-2 code such as GB, US, or SE. Lowercase ("us"), alpha-3 ("USA"), and country names ("Britain") match no records upstream.')
36
+ .optional()
37
+ .describe('ISO 3166-1 alpha-2 code, uppercase, of the organization that published the record — not where the occurrence was observed, which is country. The two differ constantly: of 60,290,950 records observed in GB, 1,548,928 were published by US organizations. Take a value from a PUBLISHING_COUNTRY facet on gbif_occurrence_facets. Lowercase and alpha-3 forms ("us", "USA") match nothing upstream, which is why only the uppercase two-letter form is accepted here.'),
38
+ stateProvince: z
39
+ .string()
40
+ .optional()
41
+ .describe('State, province, or first-level administrative division, matched as a verbatim string — exact and case-sensitive. GBIF stores what each dataset recorded without normalizing it, so there is no vocabulary to guess from: "England", "England - Greater London", and "Greater London" are three distinct values, and "england" is none of them. Take one from a STATE_PROVINCE facet on gbif_occurrence_facets scoped the same way and pass it back unchanged — an unmatched value counts zero rather than erroring.'),
25
42
  isGeoreferenced: z
26
43
  .boolean()
27
44
  .optional()
@@ -54,14 +71,14 @@ export const gbifCountOccurrences = tool('gbif_count_occurrences', {
54
71
  notice: z
55
72
  .string()
56
73
  .optional()
57
- .describe('Guidance when a presence/absence filter narrowed the count. Absent when occurrenceStatus is ANY.'),
74
+ .describe('Guidance when the count is zero under a verbatim stateProvince filter, larger than gbif_search_occurrences can page to, or narrowed by a presence/absence filter. Absent when none applies.'),
58
75
  },
59
76
  errors: [
60
77
  {
61
78
  reason: 'invalid_filter',
62
79
  code: JsonRpcErrorCode.InvalidParams,
63
- when: 'datasetKey is not a UUID, or GBIF rejected another filter value as malformed.',
64
- recovery: 'Supply datasetKey as the 8-4-4-4-12 hex UUID gbif_search_datasets returns; year is a single year or a "min,max" range.',
80
+ when: 'datasetKey is not a UUID, a two-letter country or publishingCountry code is one GBIF does not know, or GBIF rejected another filter value as malformed.',
81
+ recovery: 'Supply datasetKey as the 8-4-4-4-12 hex UUID gbif_search_datasets returns; year is a single year or a "min,max" range; country and publishingCountry are codes GBIF assigns, so take one from a COUNTRY or PUBLISHING_COUNTRY facet on gbif_occurrence_facets.',
65
82
  },
66
83
  ],
67
84
  async handler(input, ctx) {
@@ -76,7 +93,9 @@ export const gbifCountOccurrences = tool('gbif_count_occurrences', {
76
93
  }
77
94
  const count = await getGbifService().countOccurrences({
78
95
  ...(input.taxonKey !== undefined && { taxonKey: input.taxonKey }),
79
- ...(input.country?.trim() && { country: input.country }),
96
+ ...(input.country && { country: input.country }),
97
+ ...(input.publishingCountry && { publishingCountry: input.publishingCountry }),
98
+ ...(input.stateProvince?.trim() && { stateProvince: input.stateProvince }),
80
99
  ...(input.isGeoreferenced !== undefined && { isGeoreferenced: input.isGeoreferenced }),
81
100
  ...(input.datasetKey?.trim() && { datasetKey: input.datasetKey }),
82
101
  ...(input.year?.trim() && { year: input.year }),
@@ -84,7 +103,13 @@ export const gbifCountOccurrences = tool('gbif_count_occurrences', {
84
103
  ...(input.iucnRedListCategory && { iucnRedListCategory: input.iucnRedListCategory }),
85
104
  }, ctx);
86
105
  ctx.enrich({ occurrenceStatus: input.occurrenceStatus });
87
- const notice = occurrenceStatusNotice(input.occurrenceStatus);
106
+ const notice = [
107
+ stateProvinceNoMatchNotice(input.stateProvince, count),
108
+ overPaginationCapNotice(count),
109
+ occurrenceStatusNotice(input.occurrenceStatus),
110
+ ]
111
+ .filter(Boolean)
112
+ .join(' ');
88
113
  if (notice)
89
114
  ctx.enrich.notice(notice);
90
115
  return { count };
@@ -1 +1 @@
1
- {"version":3,"file":"gbif-count-occurrences.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/t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,EAAE,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAAE,CAAC;SACrF,EACD,GAAG,CACJ,CAAC;QAEF,GAAG,CAAC,MAAM,CAAC,EAAE,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG;YACb,0BAA0B,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC;YACtD,uBAAuB,CAAC,KAAK,CAAC;YAC9B,sBAAsB,CAAC,KAAK,CAAC,gBAAgB,CAAC;SAC/C;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,IAAI,MAAM;YAAE,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEtC,OAAO,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;CACtF,CAAC,CAAC"}
@@ -25,6 +25,8 @@ export declare const gbifOccurrenceFacets: import("@cyanheads/mcp-ts-core").Tool
25
25
  }>;
26
26
  taxonKey: z.ZodOptional<z.ZodNumber>;
27
27
  country: z.ZodOptional<z.ZodString>;
28
+ publishingCountry: z.ZodOptional<z.ZodString>;
29
+ stateProvince: z.ZodOptional<z.ZodString>;
28
30
  year: z.ZodOptional<z.ZodString>;
29
31
  basisOfRecord: z.ZodOptional<z.ZodEnum<{
30
32
  HUMAN_OBSERVATION: "HUMAN_OBSERVATION";
@@ -66,8 +68,8 @@ export declare const gbifOccurrenceFacets: import("@cyanheads/mcp-ts-core").Tool
66
68
  }, z.core.$strip>, readonly [{
67
69
  readonly reason: "invalid_filter";
68
70
  readonly code: JsonRpcErrorCode.InvalidParams;
69
- readonly when: "datasetKey is not a UUID, or GBIF rejected the geometry or year scope as malformed.";
70
- readonly recovery: "The message names the rejected value. Correct that one scope filter: geometry is a closed WKT ring in longitude latitude order, year is a single year or \"min,max\", and datasetKey is a UUID from gbif_search_datasets.";
71
+ readonly when: "datasetKey is not a UUID, a two-letter country or publishingCountry code is one GBIF does not know, or GBIF rejected the geometry or year scope as malformed.";
72
+ readonly recovery: "The message names the rejected value. Correct that one scope filter: geometry is a closed WKT ring in longitude latitude order, year is a single year or \"min,max\", datasetKey is a UUID from gbif_search_datasets, and country and publishingCountry are codes GBIF assigns — take one from a COUNTRY or PUBLISHING_COUNTRY facet.";
71
73
  }], {
72
74
  readonly facetLimit: z.ZodNumber;
73
75
  readonly facetOffset: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"gbif-occurrence-facets.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-occurrence-facets.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAmCjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2M/B,CAAC"}
1
+ {"version":3,"file":"gbif-occurrence-facets.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-occurrence-facets.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAmCjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwO/B,CAAC"}
@@ -6,7 +6,7 @@ import { tool, z } from '@cyanheads/mcp-ts-core';
6
6
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
7
  import { getGbifService } from '../../../services/gbif/gbif-service.js';
8
8
  import { IUCN_RED_LIST_CATEGORY_VALUES, OCCURRENCE_STATUS_VALUES } from '../../../services/gbif/types.js';
9
- import { isGbifUuid, occurrenceStatusNotice } from '../utils.js';
9
+ import { isGbifUuid, occurrenceStatusNotice, stateProvinceNoMatchNotice } from '../utils.js';
10
10
  const BASIS_OF_RECORD_VALUES = [
11
11
  'HUMAN_OBSERVATION',
12
12
  'MACHINE_OBSERVATION',
@@ -42,23 +42,37 @@ export const gbifOccurrenceFacets = tool('gbif_occurrence_facets', {
42
42
  'facetLimit at facetOffset 0, a later slice of the same ranking past that. No record payloads returned. ' +
43
43
  'Core tool for distribution analysis and trend queries: "which countries have the most records ' +
44
44
  'for this species?", "how has observation volume changed since 2010?". ' +
45
- 'Scope the aggregation with taxonKey, country, year, geometry, basisOfRecord, datasetKey, ' +
46
- 'occurrenceStatus, or iucnRedListCategory filters. Aggregates sightings only by default, ' +
45
+ 'Scope the aggregation with taxonKey, country (uppercase ISO 3166-1 alpha-2), ' +
46
+ 'publishingCountry, stateProvince, year, ' +
47
+ 'geometry, basisOfRecord, datasetKey, ' +
48
+ 'occurrenceStatus, or iucnRedListCategory filters. Also the way to split a result set too ' +
49
+ 'large for gbif_search_occurrences to page (offset+limit caps at 100,001): facet by ' +
50
+ 'DATASET_KEY, then search each datasetKey on its own. Aggregates sightings only by default, ' +
47
51
  'matching gbif_search_occurrences and gbif_count_occurrences; to measure the presence/absence ' +
48
52
  'split itself, pass facet OCCURRENCE_STATUS with occurrenceStatus ANY.',
49
53
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
50
54
  input: z.object({
51
55
  facet: z
52
56
  .enum(FACET_VALUES)
53
- .describe('Dimension to aggregate by (e.g., COUNTRY, YEAR, BASIS_OF_RECORD, SPECIES_KEY, OCCURRENCE_STATUS, IUCN_RED_LIST_CATEGORY).'),
57
+ .describe("Dimension to aggregate by (e.g., COUNTRY, YEAR, BASIS_OF_RECORD, SPECIES_KEY, OCCURRENCE_STATUS, IUCN_RED_LIST_CATEGORY). DATASET_KEY is the dimension to split on when a result set is too large to page: every occurrence carries exactly one datasetKey, so its buckets sum to totalOccurrences with no gap and no overlap, and it has the cardinality to cut a large scope into pageable pieces. BASIS_OF_RECORD and PUBLISHING_COUNTRY are gap-free too and both have a matching filter on the occurrence tools, so either can drive a further split of a bucket still too large — but on that same scope they return 9 and 41 buckets against DATASET_KEY's 550, so neither replaces it as the first cut. A dimension a record can lack silently drops that record: faceting one 60,290,950-record scope by YEAR returned 224 buckets summing to 59,407,400, leaving 883,550 undated records in no bucket at all, and MONTH, STATE_PROVINCE, and SPECIES_KEY lose records the same way — stateProvince included, even though the occurrence tools can now filter on it. Sums are comparable only across the same occurrenceStatus scope."),
54
58
  taxonKey: z
55
59
  .number()
56
60
  .optional()
57
61
  .describe('Backbone taxon key to scope the aggregation. Matches the given taxon and all descendant taxa (subspecies, varieties, etc.).'),
58
62
  country: z
59
63
  .string()
64
+ .regex(/^[A-Z]{2}$/, 'country must be an uppercase ISO 3166-1 alpha-2 code such as GB, US, or SE. Lowercase ("gb"), alpha-3 ("USA"), and country names ("Britain") match no records upstream.')
60
65
  .optional()
61
- .describe('ISO 3166-1 alpha-2 country code to scope to one country.'),
66
+ .describe('ISO 3166-1 alpha-2 code, uppercase, of where the occurrence was recorded, to scope to one country. Not the publisher\'s country — that is publishingCountry, and the two disagree on most records. Scope to one country, or pass back a value this tool returned under facet COUNTRY to drill into that bucket. Lowercase and alpha-3 forms ("gb", "USA") match nothing upstream, which is why only the uppercase two-letter form is accepted here.'),
67
+ publishingCountry: z
68
+ .string()
69
+ .regex(/^[A-Z]{2}$/, 'publishingCountry must be an uppercase ISO 3166-1 alpha-2 code such as GB, US, or SE. Lowercase ("us"), alpha-3 ("USA"), and country names ("Britain") match no records upstream.')
70
+ .optional()
71
+ .describe('ISO 3166-1 alpha-2 code, uppercase, of the organization that published the record — not where the occurrence was observed, which is country. Scope to one publisher country, or pass back a value this tool returned under facet PUBLISHING_COUNTRY to drill into that bucket. Lowercase and alpha-3 forms ("us", "USA") match nothing upstream, which is why only the uppercase two-letter form is accepted here.'),
72
+ stateProvince: z
73
+ .string()
74
+ .optional()
75
+ .describe('State, province, or first-level administrative division, matched as a verbatim string — exact and case-sensitive. Pass back a value this tool returned under facet STATE_PROVINCE rather than a guessed one: GBIF stores what each dataset recorded without normalizing it, so "England", "England - Greater London", and "Greater London" are three distinct values, "england" is none of them, and an unmatched value aggregates zero records rather than erroring.'),
62
76
  year: z
63
77
  .string()
64
78
  .optional()
@@ -120,14 +134,14 @@ export const gbifOccurrenceFacets = tool('gbif_occurrence_facets', {
120
134
  notice: z
121
135
  .string()
122
136
  .optional()
123
- .describe('Guidance when no facet values were returned or a presence/absence filter narrowed the aggregation. Absent only when neither applies.'),
137
+ .describe('Guidance when no facet values were returned, a verbatim stateProvince filter matched nothing, or a presence/absence filter narrowed the aggregation. Absent only when none applies.'),
124
138
  },
125
139
  errors: [
126
140
  {
127
141
  reason: 'invalid_filter',
128
142
  code: JsonRpcErrorCode.InvalidParams,
129
- when: 'datasetKey is not a UUID, or GBIF rejected the geometry or year scope as malformed.',
130
- recovery: 'The message names the rejected value. Correct that one scope filter: geometry is a closed WKT ring in longitude latitude order, year is a single year or "min,max", and datasetKey is a UUID from gbif_search_datasets.',
143
+ when: 'datasetKey is not a UUID, a two-letter country or publishingCountry code is one GBIF does not know, or GBIF rejected the geometry or year scope as malformed.',
144
+ recovery: 'The message names the rejected value. Correct that one scope filter: geometry is a closed WKT ring in longitude latitude order, year is a single year or "min,max", datasetKey is a UUID from gbif_search_datasets, and country and publishingCountry are codes GBIF assigns — take one from a COUNTRY or PUBLISHING_COUNTRY facet.',
131
145
  },
132
146
  ],
133
147
  async handler(input, ctx) {
@@ -138,7 +152,9 @@ export const gbifOccurrenceFacets = tool('gbif_occurrence_facets', {
138
152
  const raw = await getGbifService().getOccurrenceFacets({
139
153
  facet: input.facet,
140
154
  ...(input.taxonKey !== undefined && { taxonKey: input.taxonKey }),
141
- ...(input.country?.trim() && { country: input.country }),
155
+ ...(input.country && { country: input.country }),
156
+ ...(input.publishingCountry && { publishingCountry: input.publishingCountry }),
157
+ ...(input.stateProvince?.trim() && { stateProvince: input.stateProvince }),
142
158
  ...(input.year?.trim() && { year: input.year }),
143
159
  ...(input.basisOfRecord && { basisOfRecord: input.basisOfRecord }),
144
160
  ...(input.geometry?.trim() && { geometry: input.geometry }),
@@ -163,6 +179,7 @@ export const gbifOccurrenceFacets = tool('gbif_occurrence_facets', {
163
179
  counts.length === 0
164
180
  ? 'No facet values returned. The filter combination may match zero occurrences, or the facet dimension has no data for the given scope.'
165
181
  : undefined,
182
+ stateProvinceNoMatchNotice(input.stateProvince, raw.count ?? 0),
166
183
  occurrenceStatusNotice(input.occurrenceStatus),
167
184
  ]
168
185
  .filter(Boolean)
@@ -1 +1 @@
1
- {"version":3,"file":"gbif-occurrence-facets.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-occurrence-facets.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,sBAAsB,GAAG;IAC7B,mBAAmB;IACnB,qBAAqB;IACrB,oBAAoB;IACpB,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,YAAY;IACZ,YAAY;CACJ,CAAC;AAEX,MAAM,YAAY,GAAG;IACnB,iBAAiB;IACjB,SAAS;IACT,gBAAgB;IAChB,MAAM;IACN,aAA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KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"gbif-occurrence-facets.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-occurrence-facets.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAE7F,MAAM,sBAAsB,GAAG;IAC7B,mBAAmB;IACnB,qBAAqB;IACrB,oBAAoB;IACpB,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,YAAY;IACZ,YAAY;CACJ,CAAC;AAEX,MAAM,YAAY,GAAG;IACnB,iBAAiB;IACjB,SAAS;IACT,gBAAgB;IAChB,MAAM;IACN,aAAa;IACb,aAAa;IACb,YAAY;IACZ,WAAW;IACX,WAAW;IACX,YAAY;IACZ,WAAW;IACX,aAAa;IACb,oBAAoB;IACpB,OAAO;IACP,mBAAmB;IACnB,wBAAwB;CAChB,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,wBAAwB,EAAE;IACjE,KAAK,EAAE,8BAA8B;IACrC,WAAW,EACT,+GAA+G;QAC/G,4FAA4F;QAC5F,yGAAyG;QACzG,gGAAgG;QAChG,wEAAwE;QACxE,+EAA+E;QAC/E,0CAA0C;QAC1C,uCAAuC;QACvC,2FAA2F;QAC3F,qFAAqF;QACrF,6FAA6F;QAC7F,+FAA+F;QAC/F,uEAAuE;IACzE,WAAW,EAAE,EAAE,YAAY,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KAAK,CAAC,cAAc,EAAE,KAAK,GAAG,aAAa,CAAC,CAAC;QACxF,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -31,8 +31,8 @@ export declare const gbifSearchDatasets: import("@cyanheads/mcp-ts-core").ToolDe
31
31
  }, z.core.$strip>, readonly [{
32
32
  readonly reason: "invalid_filter";
33
33
  readonly code: JsonRpcErrorCode.InvalidParams;
34
- readonly when: "hostingOrg is not a UUID, or GBIF rejected another filter value as malformed.";
35
- readonly recovery: "Supply hostingOrg as the 8-4-4-4-12 hex UUID gbif_search_publishers returns in its key field — an organization name is not a key.";
34
+ readonly when: "hostingOrg is not a UUID, publishingCountry is a two-letter code GBIF does not assign, or GBIF rejected another filter value as malformed.";
35
+ readonly recovery: "Supply hostingOrg as the 8-4-4-4-12 hex UUID gbif_search_publishers returns in its key field — an organization name is not a key; publishingCountry is a code GBIF assigns, so take one from a PUBLISHING_COUNTRY facet on gbif_occurrence_facets.";
36
36
  }], {
37
37
  readonly totalCount: z.ZodNumber;
38
38
  readonly offset: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"gbif-search-datasets.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-search-datasets.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAoBjE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyK7B,CAAC"}
1
+ {"version":3,"file":"gbif-search-datasets.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-search-datasets.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAoBjE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgL7B,CAAC"}
@@ -19,7 +19,8 @@ function buildNotice(args) {
19
19
  }
20
20
  export const gbifSearchDatasets = tool('gbif_search_datasets', {
21
21
  title: 'Search Datasets',
22
- description: 'Search GBIF datasets by keyword, type, country, or publishing organization. ' +
22
+ description: 'Search GBIF datasets by keyword, type, publishing country (uppercase ISO 3166-1 alpha-2), ' +
23
+ 'or hosting organization. ' +
23
24
  'Returns dataset title, description, license, record count, and DOI. ' +
24
25
  'Use to find the source dataset behind a set of records, or to explore what data collections ' +
25
26
  'are available for a taxon, country, or organization.',
@@ -32,8 +33,9 @@ export const gbifSearchDatasets = tool('gbif_search_datasets', {
32
33
  .describe('Filter by dataset type. OCCURRENCE for observation records, CHECKLIST for species lists.'),
33
34
  publishingCountry: z
34
35
  .string()
36
+ .regex(/^[A-Z]{2}$/, 'publishingCountry must be an uppercase ISO 3166-1 alpha-2 code such as GB, US, or SE. Lowercase ("gb"), alpha-3 ("GBR"), and country names ("Britain") match no datasets upstream.')
35
37
  .optional()
36
- .describe('ISO 3166-1 alpha-2 country code of the publishing organization.'),
38
+ .describe('ISO 3166-1 alpha-2 code, uppercase, of the organization that published the dataset (e.g., "GB", "US", "DE", "SE"). Lowercase and alpha-3 forms ("gb", "GBR") match nothing upstream, which is why only the uppercase two-letter form is accepted here — unlike the country filter on gbif_search_publishers, which resolves either form. Take a value from a PUBLISHING_COUNTRY facet on gbif_occurrence_facets; an uppercase pair GBIF does not assign ("XX") is rejected upstream by name.'),
37
39
  hostingOrg: z
38
40
  .string()
39
41
  .optional()
@@ -87,8 +89,8 @@ export const gbifSearchDatasets = tool('gbif_search_datasets', {
87
89
  {
88
90
  reason: 'invalid_filter',
89
91
  code: JsonRpcErrorCode.InvalidParams,
90
- when: 'hostingOrg is not a UUID, or GBIF rejected another filter value as malformed.',
91
- recovery: 'Supply hostingOrg as the 8-4-4-4-12 hex UUID gbif_search_publishers returns in its key field — an organization name is not a key.',
92
+ when: 'hostingOrg is not a UUID, publishingCountry is a two-letter code GBIF does not assign, or GBIF rejected another filter value as malformed.',
93
+ recovery: 'Supply hostingOrg as the 8-4-4-4-12 hex UUID gbif_search_publishers returns in its key field — an organization name is not a key; publishingCountry is a code GBIF assigns, so take one from a PUBLISHING_COUNTRY facet on gbif_occurrence_facets.',
92
94
  },
93
95
  ],
94
96
  async handler(input, ctx) {
@@ -99,7 +101,7 @@ export const gbifSearchDatasets = tool('gbif_search_datasets', {
99
101
  const raw = await getGbifService().searchDatasets({
100
102
  ...(input.q?.trim() && { q: input.q }),
101
103
  ...(input.type && { type: input.type }),
102
- ...(input.publishingCountry?.trim() && { publishingCountry: input.publishingCountry }),
104
+ ...(input.publishingCountry && { publishingCountry: input.publishingCountry }),
103
105
  ...(input.hostingOrg?.trim() && { hostingOrg: input.hostingOrg }),
104
106
  limit: input.limit,
105
107
  offset: input.offset,
@@ -1 +1 @@
1
- {"version":3,"file":"gbif-search-datasets.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-search-datasets.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEpD,sDAAsD;AACtD,SAAS,WAAW,CAAC,IAIpB;IACC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAClD,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,oGAAo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IAAI,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;YAC7C,IAAI,EAAE,CAAC,iBAAiB;gBAAE,KAAK,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,iBAAiB,EAAE,CAAC,CAAC;YACxF,IAAI,EAAE,CAAC,WAAW,IAAI,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,WAAW,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;YAC1F,IAAI,EAAE,CAAC,WAAW;gBAChB,KAAK,CAAC,IAAI,CACR,EAAE,CAAC,oBAAoB;oBACrB,CAAC,CAAC,GAAG,EAAE,CAAC,WAAW,gEAAgE;oBACnF,CAAC,CAAC,EAAE,CAAC,WAAW,CACnB,CAAC;QACN,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"gbif-search-datasets.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-search-datasets.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEpD,sDAAsD;AACtD,SAAS,WAAW,CAAC,IAIpB;IACC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAClD,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,oGAAoG,CAAC;IAC9G,CAAC;IACD,IAAI,YAAY,KAAK,CAAC,IAAI,MAAM,GAA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AAC,GAAG,EAAE,CAAC,CAAC;YAC7C,IAAI,EAAE,CAAC,iBAAiB;gBAAE,KAAK,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,iBAAiB,EAAE,CAAC,CAAC;YACxF,IAAI,EAAE,CAAC,WAAW,IAAI,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,WAAW,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;YAC1F,IAAI,EAAE,CAAC,WAAW;gBAChB,KAAK,CAAC,IAAI,CACR,EAAE,CAAC,oBAAoB;oBACrB,CAAC,CAAC,GAAG,EAAE,CAAC,WAAW,gEAAgE;oBACnF,CAAC,CAAC,EAAE,CAAC,WAAW,CACnB,CAAC;QACN,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -8,6 +8,8 @@ export declare const gbifSearchOccurrences: import("@cyanheads/mcp-ts-core").Too
8
8
  taxonKey: z.ZodOptional<z.ZodNumber>;
9
9
  scientificName: z.ZodOptional<z.ZodString>;
10
10
  country: z.ZodOptional<z.ZodString>;
11
+ publishingCountry: z.ZodOptional<z.ZodString>;
12
+ stateProvince: z.ZodOptional<z.ZodString>;
11
13
  decimalLatitude: z.ZodOptional<z.ZodString>;
12
14
  decimalLongitude: z.ZodOptional<z.ZodString>;
13
15
  geometry: z.ZodOptional<z.ZodString>;
@@ -79,12 +81,12 @@ export declare const gbifSearchOccurrences: import("@cyanheads/mcp-ts-core").Too
79
81
  readonly reason: "pagination_cap_exceeded";
80
82
  readonly code: JsonRpcErrorCode.ValidationError;
81
83
  readonly when: "offset + limit exceeds 100,001, the deepest page GBIF serves.";
82
- readonly recovery: "Reduce offset or limit so their sum is at most 100,001. Use gbif_occurrence_facets for aggregate analysis across large result sets.";
84
+ readonly recovery: "Reduce offset or limit so their sum is at most 100,001; GBIF exposes no cursor or scroll, so no parameter continues past it. To cover a result set larger than the cap, partition it instead of paging deeper: call gbif_occurrence_facets with facet DATASET_KEY, repeating this search's filters (every occurrence carries exactly one datasetKey, so the buckets cover the scope with no gaps or overlap, and facetOffset pages through them), then re-run this search once per datasetKey. A bucket still over the cap cuts further on BASIS_OF_RECORD or PUBLISHING_COUNTRY — the only other dimensions whose buckets leave no record out, and both have a matching filter here (basisOfRecord, publishingCountry). Do not take YEAR as the first cut — records without a year fall outside every year bucket, and MONTH, STATE_PROVINCE, and SPECIES_KEY lose records the same way, stateProvince included even though this tool can filter on it. Either second cut can also return a single bucket inside one dataset, so compare any sub-split's sum against the bucket total before relying on it. gbif_occurrence_facets takes no scientificName, month, latitude/longitude range, coordinate, cluster, or coordinate-uncertainty filter, so re-apply any of those on each per-datasetKey search rather than expecting the buckets to reflect them. Bucket counts reconcile against the occurrenceStatus in force, PRESENT by default here. Retrieving the set in one piece is not possible through this server: the GBIF Download API requires a GBIF.org account, runs asynchronously, and returns a ZIP archive, and the monthly GBIF Parquet snapshot on AWS Open Data is a bulk dataset — both are routes for the caller to take directly.";
83
85
  }, {
84
86
  readonly reason: "invalid_filter";
85
87
  readonly code: JsonRpcErrorCode.InvalidParams;
86
- readonly when: "A filter value is unusable — a datasetKey that is not a UUID, or a WKT geometry or range GBIF rejects.";
87
- readonly recovery: "The message names the rejected value. Correct that one filter: geometry is a closed WKT ring in longitude latitude order, ranges are \"min,max\", and datasetKey is a UUID from gbif_search_datasets.";
88
+ readonly when: "A filter value is unusable — a datasetKey that is not a UUID, a two-letter country or publishingCountry code GBIF does not know, or a WKT geometry or range GBIF rejects.";
89
+ readonly recovery: "The message names the rejected value. Correct that one filter: geometry is a closed WKT ring in longitude latitude order, ranges are \"min,max\", datasetKey is a UUID from gbif_search_datasets, and country and publishingCountry are codes GBIF assigns — take one from a COUNTRY or PUBLISHING_COUNTRY facet on gbif_occurrence_facets.";
88
90
  }], {
89
91
  readonly totalCount: z.ZodNumber;
90
92
  readonly offset: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"gbif-search-occurrences.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-search-occurrences.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA6BjE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwZhC,CAAC"}
1
+ {"version":3,"file":"gbif-search-occurrences.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-search-occurrences.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA2BjE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAubhC,CAAC"}