@cyanheads/gbif-biodiversity-mcp-server 0.5.5 → 0.6.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.
- package/CLAUDE.md +1 -1
- package/README.md +20 -12
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/resources/definitions/gbif-dataset.resource.js +1 -1
- package/dist/mcp-server/resources/definitions/gbif-dataset.resource.js.map +1 -1
- package/dist/mcp-server/tools/definitions/gbif-count-occurrences.tool.d.ts +20 -1
- package/dist/mcp-server/tools/definitions/gbif-count-occurrences.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/gbif-count-occurrences.tool.js +33 -5
- package/dist/mcp-server/tools/definitions/gbif-count-occurrences.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/gbif-get-dataset.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/gbif-get-dataset.tool.js +8 -2
- package/dist/mcp-server/tools/definitions/gbif-get-dataset.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/gbif-get-occurrence.tool.d.ts +8 -0
- package/dist/mcp-server/tools/definitions/gbif-get-occurrence.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/gbif-get-occurrence.tool.js +56 -8
- package/dist/mcp-server/tools/definitions/gbif-get-occurrence.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/gbif-occurrence-facets.tool.d.ts +19 -0
- package/dist/mcp-server/tools/definitions/gbif-occurrence-facets.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/gbif-occurrence-facets.tool.js +34 -7
- package/dist/mcp-server/tools/definitions/gbif-occurrence-facets.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/gbif-search-datasets.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/gbif-search-datasets.tool.js +12 -1
- package/dist/mcp-server/tools/definitions/gbif-search-datasets.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/gbif-search-occurrences.tool.d.ts +21 -0
- package/dist/mcp-server/tools/definitions/gbif-search-occurrences.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/gbif-search-occurrences.tool.js +66 -6
- package/dist/mcp-server/tools/definitions/gbif-search-occurrences.tool.js.map +1 -1
- package/dist/mcp-server/tools/utils.d.ts +28 -10
- package/dist/mcp-server/tools/utils.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils.js +34 -10
- package/dist/mcp-server/tools/utils.js.map +1 -1
- package/dist/services/gbif/gbif-service.d.ts +34 -1
- package/dist/services/gbif/gbif-service.d.ts.map +1 -1
- package/dist/services/gbif/gbif-service.js +45 -5
- package/dist/services/gbif/gbif-service.js.map +1 -1
- package/dist/services/gbif/types.d.ts +24 -1
- package/dist/services/gbif/types.d.ts.map +1 -1
- package/dist/services/gbif/types.js +27 -1
- package/dist/services/gbif/types.js.map +1 -1
- package/package.json +1 -1
- 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.
|
|
4
|
+
**Version:** 0.6.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
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://github.com/users/cyanheads/packages/container/package/gbif-biodiversity-mcp-server) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/gbif-biodiversity-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -35,10 +35,10 @@
|
|
|
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 |
|
|
39
|
-
| `gbif_count_occurrences` | Count occurrences matching a filter without fetching records — fast single-number response |
|
|
40
|
-
| `gbif_get_occurrence` | Fetch a single occurrence record by key — full Darwin Core record with GADM geography, media, and quality flags |
|
|
41
|
-
| `gbif_occurrence_facets` | Aggregate occurrence counts by a dimension — country, year, basis of record, dataset, kingdom,
|
|
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 |
|
|
39
|
+
| `gbif_count_occurrences` | Count occurrences matching a filter without fetching records — fast single-number response, filtered to sightings by default |
|
|
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
|
+
| `gbif_occurrence_facets` | Aggregate occurrence counts by a dimension — country, year, basis of record, dataset, kingdom, presence/absence, IUCN Red List category |
|
|
42
42
|
| `gbif_search_datasets` | Search GBIF datasets by keyword, type, country, or publishing 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 |
|
|
@@ -122,6 +122,9 @@ Search 2.4B+ GBIF occurrence records with full Darwin Core filtering.
|
|
|
122
122
|
- Temporal filters: `year` as single year or range, `month` (1–12) for seasonal queries
|
|
123
123
|
- `basisOfRecord` enum: `HUMAN_OBSERVATION`, `PRESERVED_SPECIMEN`, `MACHINE_OBSERVATION`, and more
|
|
124
124
|
- `hasCoordinate` to require or exclude georeferenced records
|
|
125
|
+
- `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
|
+
- `iucnRedListCategory` — `CR`, `EN`, `VU`, `NT`, `LC`, `DD`, `EX`, `EW`, `CD`
|
|
127
|
+
- Output per record adds `taxonomicStatus`, `eventTime` (with UTC offset), `occurrenceStatus`, and `iucnRedListCategory`
|
|
125
128
|
- Pagination capped at offset+limit = 100,001, the deepest page GBIF serves — use `gbif_occurrence_facets` for aggregate analysis beyond this
|
|
126
129
|
|
|
127
130
|
---
|
|
@@ -130,8 +133,9 @@ Search 2.4B+ GBIF occurrence records with full Darwin Core filtering.
|
|
|
130
133
|
|
|
131
134
|
Count occurrences matching a filter without fetching any records.
|
|
132
135
|
|
|
133
|
-
- Backed by the
|
|
134
|
-
- Supported filters: `taxonKey`, `country`, `isGeoreferenced`, `datasetKey`, `year`
|
|
136
|
+
- 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`
|
|
138
|
+
- 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
|
|
135
139
|
- Use to assess result set size before deciding whether to paginate a full search
|
|
136
140
|
|
|
137
141
|
---
|
|
@@ -141,7 +145,9 @@ Count occurrences matching a filter without fetching any records.
|
|
|
141
145
|
Fetch a single occurrence record by GBIF occurrence key.
|
|
142
146
|
|
|
143
147
|
- Complete Darwin Core record — all coordinate fields, administrative geography (continent, country, state/province, locality), dates
|
|
144
|
-
- `occurrenceID`, full classification (`class`/`classKey`), GADM administrative units (levels 0–
|
|
148
|
+
- `occurrenceID`, full classification (`class`/`classKey`), GADM administrative units (levels 0–3, each with a stable GID and name), and source `identifiers`
|
|
149
|
+
- `occurrenceStatus` — check it before reading the record as a sighting; `ABSENT` means a survey looked and found nothing, and the record still carries coordinates, a date, and a recorder
|
|
150
|
+
- `taxonomicStatus`, `eventTime` (with UTC offset), and `iucnRedListCategory`
|
|
145
151
|
- Collections metadata: institution code, collection code, catalog number
|
|
146
152
|
- Collector and identifier names, individual count, sex, life stage
|
|
147
153
|
- Associated media (images, audio, video) with URLs and license
|
|
@@ -153,8 +159,9 @@ Fetch a single occurrence record by GBIF occurrence key.
|
|
|
153
159
|
|
|
154
160
|
Aggregate occurrence counts across a dimension.
|
|
155
161
|
|
|
156
|
-
- Facets: `COUNTRY`, `YEAR`, `BASIS_OF_RECORD`, `DATASET_KEY`, `KINGDOM_KEY`, `PHYLUM_KEY`, `CLASS_KEY`, `ORDER_KEY`, `FAMILY_KEY`, `GENUS_KEY`, `SPECIES_KEY`, `PUBLISHING_COUNTRY`, `MONTH`
|
|
157
|
-
- Scope with `taxonKey`, `country`, `year`, `geometry`, or `
|
|
162
|
+
- 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
|
|
164
|
+
- 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`
|
|
158
165
|
- 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
|
|
159
166
|
- 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
|
|
160
167
|
- Core tool for distribution analysis ("which countries have the most records?") and trend queries ("how has observation volume changed since 2010?")
|
|
@@ -166,7 +173,8 @@ Aggregate occurrence counts across a dimension.
|
|
|
166
173
|
Search GBIF datasets by keyword, type, country, or publishing organization.
|
|
167
174
|
|
|
168
175
|
- Filters: free-text query, dataset type (`OCCURRENCE`, `CHECKLIST`, `METADATA`, `SAMPLING_EVENT`), publishing country, hosting organization UUID
|
|
169
|
-
- Returns title, type, description, license, DOI, and record count.
|
|
176
|
+
- 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
|
+
- The `description` is a 300-character preview — `descriptionTruncated` flags when it was shortened, and `gbif_get_dataset` returns the full text
|
|
170
178
|
- Use `hostingOrg` from `gbif_search_publishers` to scope to datasets from one organization
|
|
171
179
|
- Paginated — limit up to 1000
|
|
172
180
|
|
|
@@ -179,7 +187,7 @@ Fetch full dataset metadata by UUID.
|
|
|
179
187
|
- Full description, citation text (for academic reference), license, DOI
|
|
180
188
|
- Contacts with role, name, organization, and email
|
|
181
189
|
- Temporal and geographic coverage ranges when the publisher declares them
|
|
182
|
-
- `recordCount`
|
|
190
|
+
- `recordCount` — the indexed occurrence total, matching what `gbif_search_datasets` reports, for every dataset type (a `CHECKLIST` reports 0). It spans every `occurrenceStatus`, absences included; `gbif_count_occurrences` with the same key counts sightings only by default, so the two figures differ by design
|
|
183
191
|
- `numConstituents` for aggregate datasets (e.g. iNaturalist, eBird)
|
|
184
192
|
- Use after `gbif_search_datasets` or when an occurrence record's `datasetKey` needs provenance detail
|
|
185
193
|
|
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. 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. 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.',
|
|
32
32
|
tools: [
|
|
33
33
|
gbifMatchSpecies,
|
|
34
34
|
gbifB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AAoB;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"}
|
|
@@ -33,7 +33,7 @@ export const gbifDatasetResource = resource('gbif://dataset/{datasetKey}', {
|
|
|
33
33
|
recordCount: z
|
|
34
34
|
.number()
|
|
35
35
|
.optional()
|
|
36
|
-
.describe('Occurrence records GBIF has indexed for this dataset, matching the figure gbif_search_datasets reports.
|
|
36
|
+
.describe('Occurrence records GBIF has indexed for this dataset, matching the figure gbif_search_datasets reports. Spans every occurrenceStatus: absence records — surveys that looked for a taxon and did not find it — are counted alongside sightings, and on some datasets they are the overwhelming majority. gbif_count_occurrences with this datasetKey answers the other question, defaulting to occurrenceStatus PRESENT, so the two figures are expected to differ rather than one being wrong. Fetched separately because the detail endpoint omits it; absent when that lookup does not return in time.'),
|
|
37
37
|
numConstituents: z.number().optional().describe('Number of sub-datasets. May be absent.'),
|
|
38
38
|
contacts: z
|
|
39
39
|
.array(z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gbif-dataset.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/gbif-dataset.res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,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;QACvE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;QAClF,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;QACrF,WAAW,EAAE,CAAC;aACX,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,
|
|
1
|
+
{"version":3,"file":"gbif-dataset.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/gbif-dataset.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,UAAU,EACV,eAAe,EACf,yBAAyB,EACzB,SAAS,GACV,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGjE;;;GAGG;AACH,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,6BAA6B,EAAE;IACzE,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,cAAc;IACrB,WAAW,EACT,gFAAgF;QAChF,uFAAuF;QACvF,0CAA0C;IAC5C,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;KAClE,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,GAAG,EAAE,CAAC,CAAC,MAAM,EAA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,CAAC,UAAU,qBAAqB,EAAE;gBAC7E,GAAG,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC;aAChC,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;YACrE,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,YAAY,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI;YAChC,iBAAiB,EAAE,GAAG,CAAC,iBAAiB;YACxC,WAAW,EAAE,MAAM,yBAAyB,CAAC,GAAG,EAAE,GAAG,CAAC;YACtD,eAAe,EAAE,GAAG,CAAC,eAAe;YACpC,GAAG,eAAe,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC;YAC7C,iBAAiB,EAAE,wBAAwB,CAAC,GAAG,CAAC,iBAAiB,CAAC;YAClE,mBAAmB,EAAE,0BAA0B,CAAC,GAAG,CAAC,mBAAmB,CAAC;SACzE,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -10,6 +10,22 @@ export declare const gbifCountOccurrences: import("@cyanheads/mcp-ts-core").Tool
|
|
|
10
10
|
isGeoreferenced: z.ZodOptional<z.ZodBoolean>;
|
|
11
11
|
datasetKey: z.ZodOptional<z.ZodString>;
|
|
12
12
|
year: z.ZodOptional<z.ZodString>;
|
|
13
|
+
occurrenceStatus: z.ZodDefault<z.ZodEnum<{
|
|
14
|
+
ABSENT: "ABSENT";
|
|
15
|
+
ANY: "ANY";
|
|
16
|
+
PRESENT: "PRESENT";
|
|
17
|
+
}>>;
|
|
18
|
+
iucnRedListCategory: z.ZodOptional<z.ZodEnum<{
|
|
19
|
+
CD: "CD";
|
|
20
|
+
CR: "CR";
|
|
21
|
+
DD: "DD";
|
|
22
|
+
EN: "EN";
|
|
23
|
+
EW: "EW";
|
|
24
|
+
EX: "EX";
|
|
25
|
+
LC: "LC";
|
|
26
|
+
NT: "NT";
|
|
27
|
+
VU: "VU";
|
|
28
|
+
}>>;
|
|
13
29
|
}, z.core.$strip>, z.ZodObject<{
|
|
14
30
|
count: z.ZodNumber;
|
|
15
31
|
}, z.core.$strip>, readonly [{
|
|
@@ -17,5 +33,8 @@ export declare const gbifCountOccurrences: import("@cyanheads/mcp-ts-core").Tool
|
|
|
17
33
|
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
18
34
|
readonly when: "datasetKey is not a UUID, or GBIF rejected another filter value as malformed.";
|
|
19
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.";
|
|
20
|
-
}],
|
|
36
|
+
}], {
|
|
37
|
+
readonly occurrenceStatus: z.ZodString;
|
|
38
|
+
readonly notice: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}>;
|
|
21
40
|
//# sourceMappingURL=gbif-count-occurrences.tool.d.ts.map
|
|
@@ -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;
|
|
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"}
|
|
@@ -5,12 +5,16 @@
|
|
|
5
5
|
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
|
-
import {
|
|
8
|
+
import { IUCN_RED_LIST_CATEGORY_VALUES, OCCURRENCE_STATUS_VALUES } from '../../../services/gbif/types.js';
|
|
9
|
+
import { isGbifUuid, occurrenceStatusNotice } from '../utils.js';
|
|
9
10
|
export const gbifCountOccurrences = tool('gbif_count_occurrences', {
|
|
10
11
|
title: 'Count Occurrences',
|
|
11
12
|
description: 'Count occurrences matching a taxon + location filter without fetching records. ' +
|
|
12
13
|
'Use for quick totals ("how many Aves records in Sweden?") or before deciding whether ' +
|
|
13
|
-
'to paginate a full search. Accepts taxonKey, country, isGeoreferenced, datasetKey,
|
|
14
|
+
'to paginate a full search. Accepts taxonKey, country, isGeoreferenced, datasetKey, year, ' +
|
|
15
|
+
'occurrenceStatus, and iucnRedListCategory. Counts sightings only by default, matching ' +
|
|
16
|
+
'gbif_search_occurrences — GBIF also indexes absence records, and for some taxa they are ' +
|
|
17
|
+
'the overwhelming majority.',
|
|
14
18
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
15
19
|
input: z.object({
|
|
16
20
|
taxonKey: z
|
|
@@ -25,15 +29,33 @@ export const gbifCountOccurrences = tool('gbif_count_occurrences', {
|
|
|
25
29
|
datasetKey: z
|
|
26
30
|
.string()
|
|
27
31
|
.optional()
|
|
28
|
-
.describe('Filter to a specific dataset UUID (8-4-4-4-12 hex) from gbif_search_datasets.'),
|
|
32
|
+
.describe('Filter to a specific dataset UUID (8-4-4-4-12 hex) from gbif_search_datasets. The result is not the recordCount the dataset tools and the gbif://dataset/{datasetKey} resource report for the same key: that figure spans every occurrenceStatus, while this count applies occurrenceStatus below, PRESENT by default.'),
|
|
29
33
|
year: z
|
|
30
34
|
.string()
|
|
31
35
|
.optional()
|
|
32
36
|
.describe('Year or year range (e.g., "2024" or "2020,2024"). Both endpoints inclusive.'),
|
|
37
|
+
occurrenceStatus: z
|
|
38
|
+
.enum(OCCURRENCE_STATUS_VALUES)
|
|
39
|
+
.default('PRESENT')
|
|
40
|
+
.describe("Presence/absence filter. Defaults to PRESENT: an ABSENT record documents a survey that looked for the taxon and did not find it, so counting one inflates the total with the opposite of a sighting. Use ANY for both (GBIF's own default), or ABSENT for non-observations alone. Matches the gbif_search_occurrences default, so the two tools agree."),
|
|
41
|
+
iucnRedListCategory: z
|
|
42
|
+
.enum(IUCN_RED_LIST_CATEGORY_VALUES)
|
|
43
|
+
.optional()
|
|
44
|
+
.describe('Count only records whose taxon carries this IUCN Red List category: CR Critically Endangered, EN Endangered, VU Vulnerable, NT Near Threatened, LC Least Concern, DD Data Deficient, EX Extinct, EW Extinct in the Wild, CD Conservation Dependent. Records with no category are excluded when this is set.'),
|
|
33
45
|
}),
|
|
34
46
|
output: z.object({
|
|
35
47
|
count: z.number().describe('Total occurrences matching the supplied filters.'),
|
|
36
48
|
}),
|
|
49
|
+
// States which presence/absence filter produced the count — reaches both surfaces.
|
|
50
|
+
enrichment: {
|
|
51
|
+
occurrenceStatus: z
|
|
52
|
+
.string()
|
|
53
|
+
.describe('The presence/absence filter applied upstream — PRESENT, ABSENT, or ANY when no filter was sent. Says what the count covers.'),
|
|
54
|
+
notice: z
|
|
55
|
+
.string()
|
|
56
|
+
.optional()
|
|
57
|
+
.describe('Guidance when a presence/absence filter narrowed the count. Absent when occurrenceStatus is ANY.'),
|
|
58
|
+
},
|
|
37
59
|
errors: [
|
|
38
60
|
{
|
|
39
61
|
reason: 'invalid_filter',
|
|
@@ -47,8 +69,8 @@ export const gbifCountOccurrences = tool('gbif_count_occurrences', {
|
|
|
47
69
|
taxonKey: input.taxonKey,
|
|
48
70
|
country: input.country,
|
|
49
71
|
});
|
|
50
|
-
//
|
|
51
|
-
//
|
|
72
|
+
// Rejected locally so a typo fails with this tool's recovery hint instead of a
|
|
73
|
+
// bare upstream 400 that costs a round trip and the retry budget.
|
|
52
74
|
if (input.datasetKey?.trim() && !isGbifUuid(input.datasetKey)) {
|
|
53
75
|
throw ctx.fail('invalid_filter', `datasetKey "${input.datasetKey}" is not a GBIF dataset UUID.`, { ...ctx.recoveryFor('invalid_filter') });
|
|
54
76
|
}
|
|
@@ -58,7 +80,13 @@ export const gbifCountOccurrences = tool('gbif_count_occurrences', {
|
|
|
58
80
|
...(input.isGeoreferenced !== undefined && { isGeoreferenced: input.isGeoreferenced }),
|
|
59
81
|
...(input.datasetKey?.trim() && { datasetKey: input.datasetKey }),
|
|
60
82
|
...(input.year?.trim() && { year: input.year }),
|
|
83
|
+
...(input.occurrenceStatus !== 'ANY' && { occurrenceStatus: input.occurrenceStatus }),
|
|
84
|
+
...(input.iucnRedListCategory && { iucnRedListCategory: input.iucnRedListCategory }),
|
|
61
85
|
}, ctx);
|
|
86
|
+
ctx.enrich({ occurrenceStatus: input.occurrenceStatus });
|
|
87
|
+
const notice = occurrenceStatusNotice(input.occurrenceStatus);
|
|
88
|
+
if (notice)
|
|
89
|
+
ctx.enrich.notice(notice);
|
|
62
90
|
return { count };
|
|
63
91
|
},
|
|
64
92
|
format: (result) => [{ type: 'text', text: `**Occurrence count:** ${result.count}` }],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gbif-count-occurrences.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-count-occurrences.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,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"gbif-count-occurrences.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-count-occurrences.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,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,wBAAwB,EAAE;IACjE,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EACT,iFAAiF;QACjF,uFAAuF;QACvF,2FAA2F;QAC3F,wFAAwF;QACxF,0FAA0F;QAC1F,4BAA4B;IAC9B,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAC9E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,iIAAiI,CAClI;QACH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;QAC9F,eAAe,EAAE,CAAC;aACf,OAAO,EAAE;aACT,QAAQ,EAAE;aACV,QAAQ,CACP,gGAAgG,CACjG;QACH,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,wTAAwT,CACzT;QACH,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CA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E,yBAAyB,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;CACtF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gbif-get-dataset.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-get-dataset.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;AAY3E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"gbif-get-dataset.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-get-dataset.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;AAY3E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA2NzB,CAAC"}
|
|
@@ -43,7 +43,7 @@ export const gbifGetDataset = tool('gbif_get_dataset', {
|
|
|
43
43
|
recordCount: z
|
|
44
44
|
.number()
|
|
45
45
|
.optional()
|
|
46
|
-
.describe('Occurrence records GBIF has indexed for this dataset, matching the figure gbif_search_datasets reports.
|
|
46
|
+
.describe('Occurrence records GBIF has indexed for this dataset, matching the figure gbif_search_datasets reports. Spans every occurrenceStatus: absence records — surveys that looked for a taxon and did not find it — are counted alongside sightings, and on some datasets they are the overwhelming majority. gbif_count_occurrences with this datasetKey answers the other question, defaulting to occurrenceStatus PRESENT, so the two figures are expected to differ rather than one being wrong. Fetched separately because the detail endpoint omits it; absent when that lookup does not return in time.'),
|
|
47
47
|
numConstituents: z
|
|
48
48
|
.number()
|
|
49
49
|
.optional()
|
|
@@ -168,8 +168,14 @@ export const gbifGetDataset = tool('gbif_get_dataset', {
|
|
|
168
168
|
lines.push(`**DOI:** ${result.doi}`);
|
|
169
169
|
if (result.publishingCountry)
|
|
170
170
|
lines.push(`**Publishing country:** ${result.publishingCountry}`);
|
|
171
|
+
/**
|
|
172
|
+
* The scope qualifier is rendered inline rather than left to the output
|
|
173
|
+
* schema: a `content[]`-only client never reads the field's description, and
|
|
174
|
+
* a bare figure five orders of magnitude above the sightings for the same key
|
|
175
|
+
* is exactly what reads as a data error.
|
|
176
|
+
*/
|
|
171
177
|
if (result.recordCount != null)
|
|
172
|
-
lines.push(`**Records:** ${result.recordCount.toLocaleString()}
|
|
178
|
+
lines.push(`**Records:** ${result.recordCount.toLocaleString()} — every indexed occurrence record, absences included. gbif_count_occurrences with this key counts sightings only by default.`);
|
|
173
179
|
if (result.numConstituents != null)
|
|
174
180
|
lines.push(`**Constituent datasets:** ${result.numConstituents}`);
|
|
175
181
|
if (result.temporalCoverages?.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gbif-get-dataset.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-get-dataset.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,UAAU,EACV,eAAe,EACf,yBAAyB,EACzB,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,kBAAkB,EAAE;IACrD,KAAK,EAAE,aAAa;IACpB,WAAW,EACT,kGAAkG;QAClG,sHAAsH;QACtH,qEAAqE;QACrE,6GAA6G;IAC/G,WAAW,EAAE,EAAE,YAAY,EAA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AAQ,CACP,
|
|
1
|
+
{"version":3,"file":"gbif-get-dataset.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-get-dataset.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,UAAU,EACV,eAAe,EACf,yBAAyB,EACzB,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,kBAAkB,EAAE;IACrD,KAAK,EAAE,aAAa;IACpB,WAAW,EACT,kGAAkG;QAClG,sHAAsH;QACtH,qEAAqE;QACrE,6GAA6G;IAC/G,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAC9E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,QAAQ,CAAC,kFAAkF,CAAC;QAC/F,YAAY,EAAE,CAAC;aACZ,MAAM,EAAE;aACR,GAAG,EAAE;aACL,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,GAAG,CAAC;aACR,OAAO,CAAC,EAAE,CAAC;aACX,QAAQ,CACP,6OAA6O,CAC9O;KACJ,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;QACpD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QACvD,IAAI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z.ZodOptional<z.ZodString>;
|
|
25
|
+
taxonomicStatus: z.ZodOptional<z.ZodString>;
|
|
25
26
|
decimalLatitude: z.ZodOptional<z.ZodNumber>;
|
|
26
27
|
decimalLongitude: z.ZodOptional<z.ZodNumber>;
|
|
27
28
|
coordinateUncertaintyInMeters: z.ZodOptional<z.ZodNumber>;
|
|
@@ -43,13 +44,20 @@ export declare const gbifGetOccurrence: import("@cyanheads/mcp-ts-core").ToolDef
|
|
|
43
44
|
gid: z.ZodOptional<z.ZodString>;
|
|
44
45
|
name: z.ZodOptional<z.ZodString>;
|
|
45
46
|
}, z.core.$strip>>;
|
|
47
|
+
level3: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
gid: z.ZodOptional<z.ZodString>;
|
|
49
|
+
name: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strip>>;
|
|
46
51
|
}, z.core.$strip>>;
|
|
47
52
|
publishingCountry: z.ZodOptional<z.ZodString>;
|
|
48
53
|
eventDate: z.ZodOptional<z.ZodString>;
|
|
54
|
+
eventTime: z.ZodOptional<z.ZodString>;
|
|
49
55
|
year: z.ZodOptional<z.ZodNumber>;
|
|
50
56
|
month: z.ZodOptional<z.ZodNumber>;
|
|
51
57
|
day: z.ZodOptional<z.ZodNumber>;
|
|
52
58
|
basisOfRecord: z.ZodOptional<z.ZodString>;
|
|
59
|
+
occurrenceStatus: z.ZodOptional<z.ZodString>;
|
|
60
|
+
iucnRedListCategory: z.ZodOptional<z.ZodString>;
|
|
53
61
|
institutionCode: z.ZodOptional<z.ZodString>;
|
|
54
62
|
collectionCode: z.ZodOptional<z.ZodString>;
|
|
55
63
|
catalogNumber: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gbif-get-occurrence.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-get-occurrence.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"gbif-get-occurrence.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/gbif-get-occurrence.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;AAoC3E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmW5B,CAAC"}
|
|
@@ -15,23 +15,30 @@ const gadmLevel = () => z.object({
|
|
|
15
15
|
});
|
|
16
16
|
/** Keep a GADM level only when it carries a gid or name; drop empty placeholders. */
|
|
17
17
|
const compactLevel = (l) => l && (l.gid || l.name) ? { gid: l.gid, name: l.name } : undefined;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Project the raw GADM object to gid/name at levels 0–3; undefined when no level
|
|
20
|
+
* carries data. Level 3 is the finest GBIF's occurrence index carries, and only
|
|
21
|
+
* where a country subdivides that far — Sweden stops at level 2, South Africa
|
|
22
|
+
* reaches the municipality.
|
|
23
|
+
*/
|
|
19
24
|
const compactGadm = (g) => {
|
|
20
25
|
if (!g)
|
|
21
26
|
return;
|
|
22
27
|
const level0 = compactLevel(g.level0);
|
|
23
28
|
const level1 = compactLevel(g.level1);
|
|
24
29
|
const level2 = compactLevel(g.level2);
|
|
25
|
-
|
|
30
|
+
const level3 = compactLevel(g.level3);
|
|
31
|
+
if (!level0 && !level1 && !level2 && !level3)
|
|
26
32
|
return;
|
|
27
|
-
return { level0, level1, level2 };
|
|
33
|
+
return { level0, level1, level2, level3 };
|
|
28
34
|
};
|
|
29
35
|
export const gbifGetOccurrence = tool('gbif_get_occurrence', {
|
|
30
36
|
title: 'Get Occurrence Record',
|
|
31
37
|
description: 'Fetch a single occurrence record by its GBIF occurrence key. Returns the complete Darwin Core ' +
|
|
32
|
-
'record — all coordinates, administrative geography (GADM), dates, collections metadata, ' +
|
|
33
|
-
'collector identifiers, media links, and quality issue flags.
|
|
34
|
-
'
|
|
38
|
+
'record — all coordinates, administrative geography (GADM levels 0–3), dates, collections metadata, ' +
|
|
39
|
+
'collector identifiers, conservation status, media links, and quality issue flags. Check ' +
|
|
40
|
+
'occurrenceStatus before reading the record as a sighting: ABSENT means a survey looked for the ' +
|
|
41
|
+
'taxon and did not find it. Use the occurrence key from gbif_search_occurrences results.',
|
|
35
42
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
36
43
|
input: z.object({
|
|
37
44
|
occurrenceKey: z.number().describe('GBIF occurrence key from gbif_search_occurrences results.'),
|
|
@@ -55,6 +62,10 @@ export const gbifGetOccurrence = tool('gbif_get_occurrence', {
|
|
|
55
62
|
genus: z.string().optional().describe('Genus classification.'),
|
|
56
63
|
species: z.string().optional().describe('Species canonical name.'),
|
|
57
64
|
taxonRank: z.string().optional().describe('Taxonomic rank of the identified taxon.'),
|
|
65
|
+
taxonomicStatus: z
|
|
66
|
+
.string()
|
|
67
|
+
.optional()
|
|
68
|
+
.describe('Status of the identification carried on this record — ACCEPTED, PROVISIONALLY_ACCEPTED, SYNONYM, DOUBTFUL, and so on. Says whether the occurrence was filed under an accepted name or a synonym. May be absent.'),
|
|
58
69
|
decimalLatitude: z
|
|
59
70
|
.number()
|
|
60
71
|
.optional()
|
|
@@ -77,9 +88,12 @@ export const gbifGetOccurrence = tool('gbif_get_occurrence', {
|
|
|
77
88
|
level0: gadmLevel().optional().describe('GADM level 0 — country. May be absent.'),
|
|
78
89
|
level1: gadmLevel().optional().describe('GADM level 1 — state/province. May be absent.'),
|
|
79
90
|
level2: gadmLevel().optional().describe('GADM level 2 — county/district. May be absent.'),
|
|
91
|
+
level3: gadmLevel()
|
|
92
|
+
.optional()
|
|
93
|
+
.describe('GADM level 3 — municipality/ward, the finest level GBIF indexes. Absent where the country does not subdivide that far.'),
|
|
80
94
|
})
|
|
81
95
|
.optional()
|
|
82
|
-
.describe('GADM administrative geography — stable GIDs and names at levels 0–
|
|
96
|
+
.describe('GADM administrative geography — stable GIDs and names at levels 0–3. May be absent.'),
|
|
83
97
|
publishingCountry: z
|
|
84
98
|
.string()
|
|
85
99
|
.optional()
|
|
@@ -88,10 +102,22 @@ export const gbifGetOccurrence = tool('gbif_get_occurrence', {
|
|
|
88
102
|
.string()
|
|
89
103
|
.optional()
|
|
90
104
|
.describe('Observation date as ISO 8601 string. May be absent.'),
|
|
105
|
+
eventTime: z
|
|
106
|
+
.string()
|
|
107
|
+
.optional()
|
|
108
|
+
.describe('Time of day of the observation, with seconds and UTC offset (e.g. 20:15:00+01:00) — the offset eventDate omits when it carries a local time. May be absent.'),
|
|
91
109
|
year: z.number().optional().describe('Observation year. May be absent.'),
|
|
92
110
|
month: z.number().optional().describe('Observation month (1–12). May be absent.'),
|
|
93
111
|
day: z.number().optional().describe('Observation day. May be absent.'),
|
|
94
112
|
basisOfRecord: z.string().optional().describe('How the occurrence was recorded.'),
|
|
113
|
+
occurrenceStatus: z
|
|
114
|
+
.string()
|
|
115
|
+
.optional()
|
|
116
|
+
.describe('PRESENT when the record asserts the taxon was there, ABSENT when it documents a survey that looked and did not find it. An ABSENT record is not a sighting — it carries coordinates, a date, and a recorder all the same. May be absent.'),
|
|
117
|
+
iucnRedListCategory: z
|
|
118
|
+
.string()
|
|
119
|
+
.optional()
|
|
120
|
+
.describe('IUCN Red List category of the taxon — CR Critically Endangered, EN Endangered, VU Vulnerable, NT Near Threatened, LC Least Concern, DD Data Deficient, EX Extinct, EW Extinct in the Wild, CD Conservation Dependent. May be absent.'),
|
|
95
121
|
institutionCode: z
|
|
96
122
|
.string()
|
|
97
123
|
.optional()
|
|
@@ -184,6 +210,7 @@ export const gbifGetOccurrence = tool('gbif_get_occurrence', {
|
|
|
184
210
|
genus: raw.genus,
|
|
185
211
|
species: raw.species,
|
|
186
212
|
taxonRank: raw.taxonRank,
|
|
213
|
+
taxonomicStatus: raw.taxonomicStatus,
|
|
187
214
|
decimalLatitude: raw.decimalLatitude,
|
|
188
215
|
decimalLongitude: raw.decimalLongitude,
|
|
189
216
|
coordinateUncertaintyInMeters: raw.coordinateUncertaintyInMeters,
|
|
@@ -195,10 +222,13 @@ export const gbifGetOccurrence = tool('gbif_get_occurrence', {
|
|
|
195
222
|
gadm: compactGadm(raw.gadm),
|
|
196
223
|
publishingCountry: raw.publishingCountry,
|
|
197
224
|
eventDate: raw.eventDate,
|
|
225
|
+
eventTime: raw.eventTime,
|
|
198
226
|
year: raw.year,
|
|
199
227
|
month: raw.month,
|
|
200
228
|
day: raw.day,
|
|
201
229
|
basisOfRecord: raw.basisOfRecord,
|
|
230
|
+
occurrenceStatus: raw.occurrenceStatus,
|
|
231
|
+
iucnRedListCategory: raw.iucnRedListCategory,
|
|
202
232
|
institutionCode: raw.institutionCode,
|
|
203
233
|
collectionCode: raw.collectionCode,
|
|
204
234
|
catalogNumber: raw.catalogNumber,
|
|
@@ -235,8 +265,19 @@ export const gbifGetOccurrence = tool('gbif_get_occurrence', {
|
|
|
235
265
|
lines.push(`**Taxon key:** ${result.taxonKey}`);
|
|
236
266
|
if (result.taxonRank)
|
|
237
267
|
lines.push(`**Rank:** ${result.taxonRank}`);
|
|
268
|
+
if (result.taxonomicStatus)
|
|
269
|
+
lines.push(`**Taxonomic status:** ${result.taxonomicStatus}`);
|
|
238
270
|
if (result.basisOfRecord)
|
|
239
271
|
lines.push(`**Basis of record:** ${result.basisOfRecord}`);
|
|
272
|
+
/**
|
|
273
|
+
* Rendered whenever GBIF supplies it, PRESENT included. An absence record is
|
|
274
|
+
* otherwise indistinguishable from a sighting for a `content[]`-only client,
|
|
275
|
+
* which has no `structuredContent` to fall back on.
|
|
276
|
+
*/
|
|
277
|
+
if (result.occurrenceStatus)
|
|
278
|
+
lines.push(`**Occurrence status:** ${result.occurrenceStatus}`);
|
|
279
|
+
if (result.iucnRedListCategory)
|
|
280
|
+
lines.push(`**IUCN Red List category:** ${result.iucnRedListCategory}`);
|
|
240
281
|
// Taxonomy
|
|
241
282
|
const taxParts = [];
|
|
242
283
|
if (result.kingdom)
|
|
@@ -264,6 +305,8 @@ export const gbifGetOccurrence = tool('gbif_get_occurrence', {
|
|
|
264
305
|
else if (result.year == null) {
|
|
265
306
|
lines.push('**Date:** Not available');
|
|
266
307
|
}
|
|
308
|
+
if (result.eventTime)
|
|
309
|
+
lines.push(`**Time:** ${result.eventTime}`);
|
|
267
310
|
if (result.year != null)
|
|
268
311
|
lines.push(`**Year:** ${result.year}`);
|
|
269
312
|
if (result.month != null)
|
|
@@ -291,7 +334,12 @@ export const gbifGetOccurrence = tool('gbif_get_occurrence', {
|
|
|
291
334
|
lines.push(`**Country code:** ${result.countryCode}`);
|
|
292
335
|
if (result.gadm) {
|
|
293
336
|
const gadmParts = [];
|
|
294
|
-
for (const lvl of [
|
|
337
|
+
for (const lvl of [
|
|
338
|
+
result.gadm.level0,
|
|
339
|
+
result.gadm.level1,
|
|
340
|
+
result.gadm.level2,
|
|
341
|
+
result.gadm.level3,
|
|
342
|
+
]) {
|
|
295
343
|
if (lvl?.name || lvl?.gid) {
|
|
296
344
|
gadmParts.push(`${lvl.name ?? ''}${lvl.gid ? ` (${lvl.gid})` : ''}`.trim());
|
|
297
345
|
}
|