@cyanheads/gbif-biodiversity-mcp-server 0.2.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 +393 -0
- package/Dockerfile +99 -0
- package/LICENSE +201 -0
- package/README.md +367 -0
- package/dist/config/server-config.d.ts +14 -0
- package/dist/config/server-config.d.ts.map +1 -0
- package/dist/config/server-config.js +27 -0
- package/dist/config/server-config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/resources/definitions/gbif-dataset.resource.d.ts +20 -0
- package/dist/mcp-server/resources/definitions/gbif-dataset.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/gbif-dataset.resource.js +50 -0
- package/dist/mcp-server/resources/definitions/gbif-dataset.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/gbif-species.resource.d.ts +27 -0
- package/dist/mcp-server/resources/definitions/gbif-species.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/gbif-species.resource.js +67 -0
- package/dist/mcp-server/resources/definitions/gbif-species.resource.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-count-occurrences.tool.d.ts +15 -0
- package/dist/mcp-server/tools/definitions/gbif-count-occurrences.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-count-occurrences.tool.js +42 -0
- package/dist/mcp-server/tools/definitions/gbif-count-occurrences.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-get-dataset.tool.d.ts +33 -0
- package/dist/mcp-server/tools/definitions/gbif-get-dataset.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-get-dataset.tool.js +143 -0
- package/dist/mcp-server/tools/definitions/gbif-get-dataset.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-get-occurrence.tool.d.ts +58 -0
- package/dist/mcp-server/tools/definitions/gbif-get-occurrence.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-get-occurrence.tool.js +264 -0
- package/dist/mcp-server/tools/definitions/gbif-get-occurrence.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-get-species-children.tool.d.ts +25 -0
- package/dist/mcp-server/tools/definitions/gbif-get-species-children.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-get-species-children.tool.js +91 -0
- package/dist/mcp-server/tools/definitions/gbif-get-species-children.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-get-species-classification.tool.d.ts +22 -0
- package/dist/mcp-server/tools/definitions/gbif-get-species-classification.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-get-species-classification.tool.js +82 -0
- package/dist/mcp-server/tools/definitions/gbif-get-species-classification.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-get-species.tool.d.ts +45 -0
- package/dist/mcp-server/tools/definitions/gbif-get-species.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-get-species.tool.js +182 -0
- package/dist/mcp-server/tools/definitions/gbif-get-species.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-match-species.tool.d.ts +49 -0
- package/dist/mcp-server/tools/definitions/gbif-match-species.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-match-species.tool.js +148 -0
- package/dist/mcp-server/tools/definitions/gbif-match-species.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-occurrence-facets.tool.d.ts +45 -0
- package/dist/mcp-server/tools/definitions/gbif-occurrence-facets.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-occurrence-facets.tool.js +116 -0
- package/dist/mcp-server/tools/definitions/gbif-occurrence-facets.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-search-datasets.tool.d.ts +34 -0
- package/dist/mcp-server/tools/definitions/gbif-search-datasets.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-search-datasets.tool.js +112 -0
- package/dist/mcp-server/tools/definitions/gbif-search-datasets.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-search-occurrences.tool.d.ts +66 -0
- package/dist/mcp-server/tools/definitions/gbif-search-occurrences.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-search-occurrences.tool.js +278 -0
- package/dist/mcp-server/tools/definitions/gbif-search-occurrences.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-search-publishers.tool.d.ts +23 -0
- package/dist/mcp-server/tools/definitions/gbif-search-publishers.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-search-publishers.tool.js +90 -0
- package/dist/mcp-server/tools/definitions/gbif-search-publishers.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-search-species.tool.d.ts +48 -0
- package/dist/mcp-server/tools/definitions/gbif-search-species.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gbif-search-species.tool.js +151 -0
- package/dist/mcp-server/tools/definitions/gbif-search-species.tool.js.map +1 -0
- package/dist/mcp-server/tools/utils.d.ts +7 -0
- package/dist/mcp-server/tools/utils.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils.js +20 -0
- package/dist/mcp-server/tools/utils.js.map +1 -0
- package/dist/services/gbif/gbif-service.d.ts +99 -0
- package/dist/services/gbif/gbif-service.d.ts.map +1 -0
- package/dist/services/gbif/gbif-service.js +255 -0
- package/dist/services/gbif/gbif-service.js.map +1 -0
- package/dist/services/gbif/types.d.ts +254 -0
- package/dist/services/gbif/types.d.ts.map +1 -0
- package/dist/services/gbif/types.js +6 -0
- package/dist/services/gbif/types.js.map +1 -0
- package/package.json +91 -0
- package/server.json +117 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview gbif-biodiversity-mcp-server MCP server entry point.
|
|
4
|
+
* @module index
|
|
5
|
+
*/
|
|
6
|
+
import { createApp } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
import { getServerConfig } from './config/server-config.js';
|
|
8
|
+
// Resources
|
|
9
|
+
import { gbifDatasetResource } from './mcp-server/resources/definitions/gbif-dataset.resource.js';
|
|
10
|
+
import { gbifSpeciesResource } from './mcp-server/resources/definitions/gbif-species.resource.js';
|
|
11
|
+
import { gbifCountOccurrences } from './mcp-server/tools/definitions/gbif-count-occurrences.tool.js';
|
|
12
|
+
import { gbifGetDataset } from './mcp-server/tools/definitions/gbif-get-dataset.tool.js';
|
|
13
|
+
import { gbifGetOccurrence } from './mcp-server/tools/definitions/gbif-get-occurrence.tool.js';
|
|
14
|
+
import { gbifGetSpecies } from './mcp-server/tools/definitions/gbif-get-species.tool.js';
|
|
15
|
+
import { gbifGetSpeciesChildren } from './mcp-server/tools/definitions/gbif-get-species-children.tool.js';
|
|
16
|
+
import { gbifGetSpeciesClassification } from './mcp-server/tools/definitions/gbif-get-species-classification.tool.js';
|
|
17
|
+
// Taxonomy tools
|
|
18
|
+
import { gbifMatchSpecies } from './mcp-server/tools/definitions/gbif-match-species.tool.js';
|
|
19
|
+
import { gbifOccurrenceFacets } from './mcp-server/tools/definitions/gbif-occurrence-facets.tool.js';
|
|
20
|
+
// Dataset and publisher tools
|
|
21
|
+
import { gbifSearchDatasets } from './mcp-server/tools/definitions/gbif-search-datasets.tool.js';
|
|
22
|
+
// Occurrence tools
|
|
23
|
+
import { gbifSearchOccurrences } from './mcp-server/tools/definitions/gbif-search-occurrences.tool.js';
|
|
24
|
+
import { gbifSearchPublishers } from './mcp-server/tools/definitions/gbif-search-publishers.tool.js';
|
|
25
|
+
import { gbifSearchSpecies } from './mcp-server/tools/definitions/gbif-search-species.tool.js';
|
|
26
|
+
import { initGbifService } from './services/gbif/gbif-service.js';
|
|
27
|
+
await createApp({
|
|
28
|
+
tools: [
|
|
29
|
+
gbifMatchSpecies,
|
|
30
|
+
gbifGetSpecies,
|
|
31
|
+
gbifSearchSpecies,
|
|
32
|
+
gbifGetSpeciesClassification,
|
|
33
|
+
gbifGetSpeciesChildren,
|
|
34
|
+
gbifSearchOccurrences,
|
|
35
|
+
gbifCountOccurrences,
|
|
36
|
+
gbifGetOccurrence,
|
|
37
|
+
gbifOccurrenceFacets,
|
|
38
|
+
gbifSearchDatasets,
|
|
39
|
+
gbifGetDataset,
|
|
40
|
+
gbifSearchPublishers,
|
|
41
|
+
],
|
|
42
|
+
resources: [gbifSpeciesResource, gbifDatasetResource],
|
|
43
|
+
prompts: [],
|
|
44
|
+
setup(core) {
|
|
45
|
+
const cfg = getServerConfig();
|
|
46
|
+
initGbifService(core.config, core.storage, {
|
|
47
|
+
baseUrl: cfg.baseUrl,
|
|
48
|
+
timeoutMs: cfg.requestTimeoutMs,
|
|
49
|
+
...(cfg.apiKey ? { apiKey: cfg.apiKey } : {}),
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,+DAA+D,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,MAAM,yDAAyD,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,yDAAyD,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kEAAkE,CAAC;AAC1G,OAAO,EAAE,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server/resources/definitions/gbif-dataset
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
export declare const gbifDatasetResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
|
|
7
|
+
datasetKey: z.ZodString;
|
|
8
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
9
|
+
key: z.ZodOptional<z.ZodString>;
|
|
10
|
+
title: z.ZodOptional<z.ZodString>;
|
|
11
|
+
type: z.ZodOptional<z.ZodString>;
|
|
12
|
+
description: z.ZodOptional<z.ZodString>;
|
|
13
|
+
license: z.ZodOptional<z.ZodString>;
|
|
14
|
+
doi: z.ZodOptional<z.ZodString>;
|
|
15
|
+
citationText: z.ZodOptional<z.ZodString>;
|
|
16
|
+
publishingCountry: z.ZodOptional<z.ZodString>;
|
|
17
|
+
recordCount: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
numConstituents: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
}, z.core.$strip>, undefined>;
|
|
20
|
+
//# sourceMappingURL=gbif-dataset.resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gbif-dataset.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/gbif-dataset.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAIrD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;6BA6C9B,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview GBIF dataset resource — stable URI for dataset metadata.
|
|
3
|
+
* @module mcp-server/resources/definitions/gbif-dataset
|
|
4
|
+
*/
|
|
5
|
+
import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { notFound } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getGbifService } from '../../../services/gbif/gbif-service.js';
|
|
8
|
+
export const gbifDatasetResource = resource('gbif://dataset/{datasetKey}', {
|
|
9
|
+
name: 'gbif-dataset',
|
|
10
|
+
title: 'GBIF Dataset',
|
|
11
|
+
description: 'Dataset metadata — title, description, citation, license, contacts, coverage. ' +
|
|
12
|
+
'Stable URI for provenance context. Use the dataset UUID from gbif_search_datasets or ' +
|
|
13
|
+
"an occurrence record's datasetKey field.",
|
|
14
|
+
mimeType: 'application/json',
|
|
15
|
+
params: z.object({
|
|
16
|
+
datasetKey: z.string().describe('Dataset UUID.'),
|
|
17
|
+
}),
|
|
18
|
+
output: z.object({
|
|
19
|
+
key: z.string().optional().describe('Dataset UUID.'),
|
|
20
|
+
title: z.string().optional().describe('Dataset title.'),
|
|
21
|
+
type: z.string().optional().describe('Dataset type.'),
|
|
22
|
+
description: z.string().optional().describe('Dataset description. May be absent.'),
|
|
23
|
+
license: z.string().optional().describe('License identifier. May be absent.'),
|
|
24
|
+
doi: z.string().optional().describe('DOI for citation. May be absent.'),
|
|
25
|
+
citationText: z.string().optional().describe('Full citation text. May be absent.'),
|
|
26
|
+
publishingCountry: z.string().optional().describe('Publishing organization country.'),
|
|
27
|
+
recordCount: z.number().optional().describe('Number of records. May be absent.'),
|
|
28
|
+
numConstituents: z.number().optional().describe('Number of sub-datasets. May be absent.'),
|
|
29
|
+
}),
|
|
30
|
+
async handler(params, ctx) {
|
|
31
|
+
ctx.log.debug('Fetching dataset resource', { datasetKey: params.datasetKey });
|
|
32
|
+
const raw = await getGbifService().getDataset(params.datasetKey, ctx);
|
|
33
|
+
if (!raw.key) {
|
|
34
|
+
throw notFound(`Dataset ${params.datasetKey} not found in GBIF.`);
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
key: raw.key,
|
|
38
|
+
title: raw.title,
|
|
39
|
+
type: raw.type,
|
|
40
|
+
description: raw.description,
|
|
41
|
+
license: raw.license,
|
|
42
|
+
doi: raw.doi,
|
|
43
|
+
citationText: raw.citation?.text,
|
|
44
|
+
publishingCountry: raw.publishingCountry,
|
|
45
|
+
recordCount: raw.numRecords ?? raw.recordCount,
|
|
46
|
+
numConstituents: raw.numConstituents,
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=gbif-dataset.resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,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,eAAe,CAAC;KACjD,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,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;QACrD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;QAClF,OAA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,EAAE,IAAI;YAChC,iBAAiB,EAAE,GAAG,CAAC,iBAAiB;YACxC,WAAW,EAAE,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,WAAW;YAC9C,eAAe,EAAE,GAAG,CAAC,eAAe;SACrC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview GBIF species resource — stable URI for taxon records from the backbone.
|
|
3
|
+
* @module mcp-server/resources/definitions/gbif-species
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
export declare const gbifSpeciesResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
|
|
7
|
+
taxonKey: z.ZodString;
|
|
8
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
9
|
+
key: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
scientificName: z.ZodOptional<z.ZodString>;
|
|
11
|
+
canonicalName: z.ZodOptional<z.ZodString>;
|
|
12
|
+
authorship: z.ZodOptional<z.ZodString>;
|
|
13
|
+
vernacularName: z.ZodOptional<z.ZodString>;
|
|
14
|
+
rank: z.ZodOptional<z.ZodString>;
|
|
15
|
+
taxonomicStatus: z.ZodOptional<z.ZodString>;
|
|
16
|
+
kingdom: z.ZodOptional<z.ZodString>;
|
|
17
|
+
phylum: z.ZodOptional<z.ZodString>;
|
|
18
|
+
class: z.ZodOptional<z.ZodString>;
|
|
19
|
+
order: z.ZodOptional<z.ZodString>;
|
|
20
|
+
family: z.ZodOptional<z.ZodString>;
|
|
21
|
+
genus: z.ZodOptional<z.ZodString>;
|
|
22
|
+
numDescendants: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
extinct: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
acceptedKey: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
accepted: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>, undefined>;
|
|
27
|
+
//# sourceMappingURL=gbif-species.resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gbif-species.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/gbif-species.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAIrD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;6BA8D9B,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview GBIF species resource — stable URI for taxon records from the backbone.
|
|
3
|
+
* @module mcp-server/resources/definitions/gbif-species
|
|
4
|
+
*/
|
|
5
|
+
import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { notFound } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getGbifService } from '../../../services/gbif/gbif-service.js';
|
|
8
|
+
export const gbifSpeciesResource = resource('gbif://species/{taxonKey}', {
|
|
9
|
+
name: 'gbif-species',
|
|
10
|
+
title: 'GBIF Species Record',
|
|
11
|
+
description: 'Taxon record from the GBIF backbone — classification, authorship, synonymy status, ' +
|
|
12
|
+
'vernacular name. Stable URI for caching and injection as context.',
|
|
13
|
+
mimeType: 'application/json',
|
|
14
|
+
params: z.object({
|
|
15
|
+
taxonKey: z.string().describe('GBIF backbone taxon key as a string.'),
|
|
16
|
+
}),
|
|
17
|
+
output: z.object({
|
|
18
|
+
key: z.number().optional().describe('GBIF backbone taxon key.'),
|
|
19
|
+
scientificName: z.string().optional().describe('Full scientific name with authorship.'),
|
|
20
|
+
canonicalName: z.string().optional().describe('Scientific name without authorship.'),
|
|
21
|
+
authorship: z.string().optional().describe('Taxonomic authorship.'),
|
|
22
|
+
vernacularName: z.string().optional().describe('English common name when available.'),
|
|
23
|
+
rank: z.string().optional().describe('Taxonomic rank.'),
|
|
24
|
+
taxonomicStatus: z.string().optional().describe('ACCEPTED, SYNONYM, DOUBTFUL, etc.'),
|
|
25
|
+
kingdom: z.string().optional().describe('Kingdom classification.'),
|
|
26
|
+
phylum: z.string().optional().describe('Phylum classification.'),
|
|
27
|
+
class: z.string().optional().describe('Class classification.'),
|
|
28
|
+
order: z.string().optional().describe('Order classification.'),
|
|
29
|
+
family: z.string().optional().describe('Family classification.'),
|
|
30
|
+
genus: z.string().optional().describe('Genus classification.'),
|
|
31
|
+
numDescendants: z.number().optional().describe('Count of child taxa in backbone.'),
|
|
32
|
+
extinct: z.boolean().optional().describe('True when explicitly flagged as extinct.'),
|
|
33
|
+
acceptedKey: z.number().optional().describe('Accepted taxon key when synonym.'),
|
|
34
|
+
accepted: z.string().optional().describe('Accepted name when synonym.'),
|
|
35
|
+
}),
|
|
36
|
+
async handler(params, ctx) {
|
|
37
|
+
const taxonKey = parseInt(params.taxonKey, 10);
|
|
38
|
+
if (Number.isNaN(taxonKey)) {
|
|
39
|
+
throw notFound(`Invalid taxon key: "${params.taxonKey}". Must be a numeric backbone key.`);
|
|
40
|
+
}
|
|
41
|
+
ctx.log.debug('Fetching species resource', { taxonKey });
|
|
42
|
+
const raw = await getGbifService().getSpecies(taxonKey, ctx);
|
|
43
|
+
if (!raw.key) {
|
|
44
|
+
throw notFound(`Taxon key ${taxonKey} not found in the GBIF backbone.`);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
key: raw.key,
|
|
48
|
+
scientificName: raw.scientificName,
|
|
49
|
+
canonicalName: raw.canonicalName,
|
|
50
|
+
authorship: raw.authorship,
|
|
51
|
+
vernacularName: raw.vernacularName,
|
|
52
|
+
rank: raw.rank,
|
|
53
|
+
taxonomicStatus: raw.taxonomicStatus,
|
|
54
|
+
kingdom: raw.kingdom,
|
|
55
|
+
phylum: raw.phylum,
|
|
56
|
+
class: raw.clazz,
|
|
57
|
+
order: raw.order,
|
|
58
|
+
family: raw.family,
|
|
59
|
+
genus: raw.genus,
|
|
60
|
+
numDescendants: raw.numDescendants,
|
|
61
|
+
acceptedKey: raw.acceptedKey,
|
|
62
|
+
accepted: raw.accepted,
|
|
63
|
+
...(typeof raw.extinct === 'boolean' && { extinct: raw.extinct }),
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=gbif-species.resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gbif-species.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/gbif-species.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,2BAA2B,EAAE;IACvE,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EACT,qFAAqF;QACrF,mEAAmE;IACrE,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;KACtE,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QAC/D,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;QACvF,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;QACpF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAA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AO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;SAClE,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Count GBIF occurrences matching a filter without fetching records.
|
|
3
|
+
* @module mcp-server/tools/definitions/gbif-count-occurrences
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
export declare const gbifCountOccurrences: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
7
|
+
taxonKey: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
country: z.ZodOptional<z.ZodString>;
|
|
9
|
+
isGeoreferenced: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
datasetKey: z.ZodOptional<z.ZodString>;
|
|
11
|
+
year: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
count: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip>, undefined>;
|
|
15
|
+
//# sourceMappingURL=gbif-count-occurrences.tool.d.ts.map
|
|
@@ -0,0 +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;AAGjD,eAAO,MAAM,oBAAoB;;;;;;;;6BA0C/B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Count GBIF occurrences matching a filter without fetching records.
|
|
3
|
+
* @module mcp-server/tools/definitions/gbif-count-occurrences
|
|
4
|
+
*/
|
|
5
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { getGbifService } from '../../../services/gbif/gbif-service.js';
|
|
7
|
+
export const gbifCountOccurrences = tool('gbif_count_occurrences', {
|
|
8
|
+
title: 'Count Occurrences',
|
|
9
|
+
description: 'Count occurrences matching a taxon + location filter without fetching records. ' +
|
|
10
|
+
'Use for quick totals ("how many Aves records in Sweden?") or before deciding whether ' +
|
|
11
|
+
'to paginate a full search. Accepts taxonKey, country, isGeoreferenced, datasetKey, and year.',
|
|
12
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
13
|
+
input: z.object({
|
|
14
|
+
taxonKey: z.number().optional().describe('GBIF backbone taxon key from gbif_match_species.'),
|
|
15
|
+
country: z.string().optional().describe('ISO 3166-1 alpha-2 country code (e.g., "GB", "US").'),
|
|
16
|
+
isGeoreferenced: z
|
|
17
|
+
.boolean()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('When true, count only georeferenced records. When false, count only non-georeferenced records.'),
|
|
20
|
+
datasetKey: z.string().optional().describe('Filter to a specific dataset UUID.'),
|
|
21
|
+
year: z.string().optional().describe('Year or year range (e.g., "2024" or "2020,2024").'),
|
|
22
|
+
}),
|
|
23
|
+
output: z.object({
|
|
24
|
+
count: z.number().describe('Total occurrences matching the supplied filters.'),
|
|
25
|
+
}),
|
|
26
|
+
async handler(input, ctx) {
|
|
27
|
+
ctx.log.info('Counting occurrences', {
|
|
28
|
+
taxonKey: input.taxonKey,
|
|
29
|
+
country: input.country,
|
|
30
|
+
});
|
|
31
|
+
const count = await getGbifService().countOccurrences({
|
|
32
|
+
...(input.taxonKey !== undefined && { taxonKey: input.taxonKey }),
|
|
33
|
+
...(input.country?.trim() && { country: input.country }),
|
|
34
|
+
...(input.isGeoreferenced !== undefined && { isGeoreferenced: input.isGeoreferenced }),
|
|
35
|
+
...(input.datasetKey?.trim() && { datasetKey: input.datasetKey }),
|
|
36
|
+
...(input.year?.trim() && { year: input.year }),
|
|
37
|
+
}, ctx);
|
|
38
|
+
return { count };
|
|
39
|
+
},
|
|
40
|
+
format: (result) => [{ type: 'text', text: `**Occurrence count:** ${result.count}` }],
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=gbif-count-occurrences.tool.js.map
|
|
@@ -0,0 +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,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,wBAAwB,EAAE;IACjE,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EACT,iFAAiF;QACjF,uFAAuF;QACvF,8FAA8F;IAChG,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE;IAC/E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;QAC5F,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,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;QAChF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;KAC1F,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kDAAkD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
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
export declare const gbifGetDataset: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
8
|
+
datasetKey: z.ZodString;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
key: z.ZodOptional<z.ZodString>;
|
|
11
|
+
title: z.ZodOptional<z.ZodString>;
|
|
12
|
+
type: z.ZodOptional<z.ZodString>;
|
|
13
|
+
description: z.ZodOptional<z.ZodString>;
|
|
14
|
+
license: z.ZodOptional<z.ZodString>;
|
|
15
|
+
doi: z.ZodOptional<z.ZodString>;
|
|
16
|
+
citationText: z.ZodOptional<z.ZodString>;
|
|
17
|
+
publishingCountry: z.ZodOptional<z.ZodString>;
|
|
18
|
+
recordCount: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
numConstituents: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
contacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
+
type: z.ZodOptional<z.ZodString>;
|
|
22
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
23
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
24
|
+
organization: z.ZodOptional<z.ZodString>;
|
|
25
|
+
email: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
}, z.core.$strip>>>;
|
|
27
|
+
}, z.core.$strip>, readonly [{
|
|
28
|
+
readonly reason: "not_found";
|
|
29
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
30
|
+
readonly when: "The datasetKey UUID does not match any dataset in GBIF.";
|
|
31
|
+
readonly recovery: "Use gbif_search_datasets to find valid dataset keys, or check the UUID from an occurrence record's datasetKey field.";
|
|
32
|
+
}]>;
|
|
33
|
+
//# sourceMappingURL=gbif-get-dataset.tool.d.ts.map
|
|
@@ -0,0 +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;AAK3E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;GAqIzB,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Fetch full metadata for a GBIF dataset by key.
|
|
3
|
+
* @module mcp-server/tools/definitions/gbif-get-dataset
|
|
4
|
+
*/
|
|
5
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode, McpError } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getGbifService } from '../../../services/gbif/gbif-service.js';
|
|
8
|
+
import { stripHtml } from '../utils.js';
|
|
9
|
+
export const gbifGetDataset = tool('gbif_get_dataset', {
|
|
10
|
+
title: 'Get Dataset',
|
|
11
|
+
description: 'Fetch full dataset metadata by UUID key — title, description, citation text, contacts, license, ' +
|
|
12
|
+
'DOI, numConstituents (sub-datasets), and temporal/geographic coverage. Use after gbif_search_datasets ' +
|
|
13
|
+
"or when an occurrence record's datasetKey needs provenance detail.",
|
|
14
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
15
|
+
input: z.object({
|
|
16
|
+
datasetKey: z
|
|
17
|
+
.string()
|
|
18
|
+
.describe('Dataset UUID from gbif_search_datasets or an occurrence record.'),
|
|
19
|
+
}),
|
|
20
|
+
output: z.object({
|
|
21
|
+
key: z.string().optional().describe('Dataset UUID.'),
|
|
22
|
+
title: z.string().optional().describe('Dataset title.'),
|
|
23
|
+
type: z.string().optional().describe('Dataset type (OCCURRENCE, CHECKLIST, etc.).'),
|
|
24
|
+
description: z.string().optional().describe('Full dataset description. May be absent.'),
|
|
25
|
+
license: z.string().optional().describe('License identifier. May be absent.'),
|
|
26
|
+
doi: z.string().optional().describe('DOI for citation. May be absent.'),
|
|
27
|
+
citationText: z
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('Full citation text for academic reference. May be absent.'),
|
|
31
|
+
publishingCountry: z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('Country code of the publishing organization.'),
|
|
35
|
+
recordCount: z.number().optional().describe('Number of records in the dataset. May be absent.'),
|
|
36
|
+
numConstituents: z
|
|
37
|
+
.number()
|
|
38
|
+
.optional()
|
|
39
|
+
.describe('Number of constituent sub-datasets. May be absent.'),
|
|
40
|
+
contacts: z
|
|
41
|
+
.array(z
|
|
42
|
+
.object({
|
|
43
|
+
type: z
|
|
44
|
+
.string()
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('Contact type (e.g., ADMINISTRATIVE_POINT_OF_CONTACT).'),
|
|
47
|
+
firstName: z.string().optional().describe('First name. May be absent.'),
|
|
48
|
+
lastName: z.string().optional().describe('Last name. May be absent.'),
|
|
49
|
+
organization: z.string().optional().describe('Organization name. May be absent.'),
|
|
50
|
+
email: z
|
|
51
|
+
.array(z.string())
|
|
52
|
+
.optional()
|
|
53
|
+
.describe('Contact email addresses. May be absent.'),
|
|
54
|
+
})
|
|
55
|
+
.describe('A dataset contact with role, name, organization, and email.'))
|
|
56
|
+
.optional()
|
|
57
|
+
.describe('Dataset contacts. May be absent.'),
|
|
58
|
+
}),
|
|
59
|
+
errors: [
|
|
60
|
+
{
|
|
61
|
+
reason: 'not_found',
|
|
62
|
+
code: JsonRpcErrorCode.NotFound,
|
|
63
|
+
when: 'The datasetKey UUID does not match any dataset in GBIF.',
|
|
64
|
+
recovery: "Use gbif_search_datasets to find valid dataset keys, or check the UUID from an occurrence record's datasetKey field.",
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
async handler(input, ctx) {
|
|
68
|
+
ctx.log.info('Fetching dataset record', { datasetKey: input.datasetKey });
|
|
69
|
+
let raw;
|
|
70
|
+
try {
|
|
71
|
+
raw = await getGbifService().getDataset(input.datasetKey, ctx);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
if (err instanceof McpError && err.code === -32001) {
|
|
75
|
+
throw ctx.fail('not_found', `Dataset ${input.datasetKey} not found in GBIF.`, {
|
|
76
|
+
...ctx.recoveryFor('not_found'),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
throw err;
|
|
80
|
+
}
|
|
81
|
+
if (!raw.key) {
|
|
82
|
+
throw ctx.fail('not_found', `Dataset ${input.datasetKey} not found in GBIF.`, {
|
|
83
|
+
...ctx.recoveryFor('not_found'),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const contacts = raw.contacts?.map((c) => ({
|
|
87
|
+
type: c.type,
|
|
88
|
+
firstName: c.firstName,
|
|
89
|
+
lastName: c.lastName,
|
|
90
|
+
organization: c.organization,
|
|
91
|
+
email: c.email?.length ? c.email : undefined,
|
|
92
|
+
}));
|
|
93
|
+
return {
|
|
94
|
+
key: raw.key,
|
|
95
|
+
title: raw.title,
|
|
96
|
+
type: raw.type,
|
|
97
|
+
description: raw.description ? stripHtml(raw.description) : undefined,
|
|
98
|
+
license: raw.license,
|
|
99
|
+
doi: raw.doi,
|
|
100
|
+
citationText: raw.citation?.text,
|
|
101
|
+
publishingCountry: raw.publishingCountry,
|
|
102
|
+
recordCount: raw.numRecords ?? raw.recordCount,
|
|
103
|
+
numConstituents: raw.numConstituents,
|
|
104
|
+
contacts: contacts?.length ? contacts : undefined,
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
format: (result) => {
|
|
108
|
+
const lines = [];
|
|
109
|
+
lines.push(`## ${result.title ?? 'Dataset'}`);
|
|
110
|
+
if (result.key)
|
|
111
|
+
lines.push(`**Key:** ${result.key}`);
|
|
112
|
+
if (result.type)
|
|
113
|
+
lines.push(`**Type:** ${result.type}`);
|
|
114
|
+
if (result.license)
|
|
115
|
+
lines.push(`**License:** ${result.license}`);
|
|
116
|
+
if (result.doi)
|
|
117
|
+
lines.push(`**DOI:** ${result.doi}`);
|
|
118
|
+
if (result.publishingCountry)
|
|
119
|
+
lines.push(`**Publishing country:** ${result.publishingCountry}`);
|
|
120
|
+
if (result.recordCount != null)
|
|
121
|
+
lines.push(`**Records:** ${result.recordCount.toLocaleString()}`);
|
|
122
|
+
if (result.numConstituents != null)
|
|
123
|
+
lines.push(`**Constituent datasets:** ${result.numConstituents}`);
|
|
124
|
+
if (result.citationText)
|
|
125
|
+
lines.push(`\n**Citation:**\n> ${result.citationText}`);
|
|
126
|
+
if (result.description)
|
|
127
|
+
lines.push(`\n${result.description}`);
|
|
128
|
+
if (result.contacts?.length) {
|
|
129
|
+
lines.push('\n**Contacts:**');
|
|
130
|
+
for (const c of result.contacts) {
|
|
131
|
+
const name = [c.firstName, c.lastName].filter(Boolean).join(' ');
|
|
132
|
+
const typeLabel = c.type ? ` [${c.type}]` : '';
|
|
133
|
+
lines.push(`- ${name || '(unnamed)'}${typeLabel}`);
|
|
134
|
+
if (c.organization)
|
|
135
|
+
lines.push(` Organization: ${c.organization}`);
|
|
136
|
+
if (c.email?.length)
|
|
137
|
+
lines.push(` ${c.email.join(', ')}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
//# sourceMappingURL=gbif-get-dataset.tool.js.map
|
|
@@ -0,0 +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;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@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Fetch a single GBIF occurrence record by key.
|
|
3
|
+
* @module mcp-server/tools/definitions/gbif-get-occurrence
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
export declare const gbifGetOccurrence: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
8
|
+
occurrenceKey: z.ZodNumber;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
key: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
datasetKey: z.ZodOptional<z.ZodString>;
|
|
12
|
+
taxonKey: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
scientificName: z.ZodOptional<z.ZodString>;
|
|
14
|
+
canonicalName: z.ZodOptional<z.ZodString>;
|
|
15
|
+
kingdom: z.ZodOptional<z.ZodString>;
|
|
16
|
+
phylum: z.ZodOptional<z.ZodString>;
|
|
17
|
+
order: z.ZodOptional<z.ZodString>;
|
|
18
|
+
family: z.ZodOptional<z.ZodString>;
|
|
19
|
+
genus: z.ZodOptional<z.ZodString>;
|
|
20
|
+
species: z.ZodOptional<z.ZodString>;
|
|
21
|
+
taxonRank: z.ZodOptional<z.ZodString>;
|
|
22
|
+
decimalLatitude: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
decimalLongitude: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
coordinateUncertaintyInMeters: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
continent: z.ZodOptional<z.ZodString>;
|
|
26
|
+
country: z.ZodOptional<z.ZodString>;
|
|
27
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
28
|
+
stateProvince: z.ZodOptional<z.ZodString>;
|
|
29
|
+
locality: z.ZodOptional<z.ZodString>;
|
|
30
|
+
publishingCountry: z.ZodOptional<z.ZodString>;
|
|
31
|
+
eventDate: z.ZodOptional<z.ZodString>;
|
|
32
|
+
year: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
month: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
day: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
basisOfRecord: z.ZodOptional<z.ZodString>;
|
|
36
|
+
institutionCode: z.ZodOptional<z.ZodString>;
|
|
37
|
+
collectionCode: z.ZodOptional<z.ZodString>;
|
|
38
|
+
catalogNumber: z.ZodOptional<z.ZodString>;
|
|
39
|
+
recordedBy: z.ZodOptional<z.ZodString>;
|
|
40
|
+
identifiedBy: z.ZodOptional<z.ZodString>;
|
|
41
|
+
individualCount: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
sex: z.ZodOptional<z.ZodString>;
|
|
43
|
+
lifeStage: z.ZodOptional<z.ZodString>;
|
|
44
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
+
media: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
46
|
+
type: z.ZodOptional<z.ZodString>;
|
|
47
|
+
format: z.ZodOptional<z.ZodString>;
|
|
48
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
49
|
+
title: z.ZodOptional<z.ZodString>;
|
|
50
|
+
license: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>>>;
|
|
52
|
+
}, z.core.$strip>, readonly [{
|
|
53
|
+
readonly reason: "not_found";
|
|
54
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
55
|
+
readonly when: "The occurrenceKey does not exist in GBIF.";
|
|
56
|
+
readonly recovery: "Use gbif_search_occurrences to find valid occurrence keys.";
|
|
57
|
+
}]>;
|
|
58
|
+
//# sourceMappingURL=gbif-get-occurrence.tool.d.ts.map
|
|
@@ -0,0 +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;AAI3E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8O5B,CAAC"}
|