@ignfab/geocontext 0.8.2 → 0.9.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/README.md +22 -6
- package/dist/gpf/wfs.d.ts +9 -14
- package/dist/gpf/wfs.js +97 -42
- package/dist/gpf/wfs.js.map +1 -1
- package/dist/tools/GpfWfsDescribeTypeTool.d.ts +1 -12
- package/dist/tools/GpfWfsDescribeTypeTool.js +1 -4
- package/dist/tools/GpfWfsDescribeTypeTool.js.map +1 -1
- package/dist/tools/GpfWfsListTypesTool.js +1 -1
- package/dist/tools/GpfWfsListTypesTool.js.map +1 -1
- package/dist/tools/GpfWfsSearchTypesTool.js +1 -1
- package/dist/tools/GpfWfsSearchTypesTool.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ npm run build
|
|
|
77
77
|
```json
|
|
78
78
|
{
|
|
79
79
|
"mcpServers": {
|
|
80
|
-
"
|
|
80
|
+
"geocontext": {
|
|
81
81
|
"command": "node",
|
|
82
82
|
"args":["/chemin/absolu/vers/geocontext/dist/index.js"]
|
|
83
83
|
}
|
|
@@ -98,6 +98,21 @@ Pour une utilisation avancée :
|
|
|
98
98
|
| Nom | Description | Valeur par défaut |
|
|
99
99
|
| ---------------- | -------------------------------------------------------------------------------------------------------------------- | ----------------- |
|
|
100
100
|
| `TRANSPORT_TYPE` | [Transport](https://mcp-framework.com/docs/Transports/transports-overview) permet de choisir entre "stdio" et "http" | "stdio" |
|
|
101
|
+
| `GPF_WFS_SEARCH_OPTIONS` | Chaîne JSON optionnelle pour ajuster la recherche `gpf_wfs_search_types` (`fuzzy`, `boost.namespace`, `boost.name`, `boost.title`, `boost.description`, `boost.properties`). | options par défaut de `@ignfab/gpf-schema-store` |
|
|
102
|
+
|
|
103
|
+
Exemple :
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
export GPF_WFS_SEARCH_OPTIONS='{"fuzzy":0.05,"boost":{"title":4,"name":5}}'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Si `GPF_WFS_SEARCH_OPTIONS` est absent ou vide, les options par défaut restent celles de `@ignfab/gpf-schema-store`.
|
|
110
|
+
|
|
111
|
+
Remarque :
|
|
112
|
+
|
|
113
|
+
- Les outils `gpf_wfs_list_types`, `gpf_wfs_search_types` et `gpf_wfs_describe_type` s'appuient sur un catalogue de schémas embarqué fourni par `@ignfab/gpf-schema-store`.
|
|
114
|
+
- L'outil `gpf_wfs_get_features` interroge toujours le service WFS de la Géoplateforme en direct.
|
|
115
|
+
- Le catalogue embarqué améliore la description des featureTypes mais il peut être légèrement décalé par rapport à l'état courant du WFS.
|
|
101
116
|
|
|
102
117
|
## Fonctionnalités
|
|
103
118
|
|
|
@@ -135,8 +150,8 @@ L'idée est ici de répondre à des précises en traitant côté serveur les app
|
|
|
135
150
|
|
|
136
151
|
#### Explorer les tables
|
|
137
152
|
|
|
138
|
-
* [gpf_wfs_list_types()](src/tools/GpfWfsListTypesTool.ts) pour **lister les tables
|
|
139
|
-
* [gpf_wfs_search_types(keywords,max_results=10)](src/tools/
|
|
153
|
+
* [gpf_wfs_list_types()](src/tools/GpfWfsListTypesTool.ts) pour **lister les tables connues du catalogue de schémas embarqué** - **déprécié (trop de résultats)**
|
|
154
|
+
* [gpf_wfs_search_types(keywords,max_results=10)](src/tools/GpfWfsSearchTypesTool.ts) pour **rechercher des tables dans le catalogue de schémas embarqué**. La recherche est textuelle et configurable via `GPF_WFS_SEARCH_OPTIONS`.
|
|
140
155
|
|
|
141
156
|
> - Quels sont les millésimes ADMINEXPRESS disponibles sur la Géoplateforme?
|
|
142
157
|
> - Quelle est la table de la BDTOPO correspondant aux bâtiments?
|
|
@@ -144,14 +159,14 @@ L'idée est ici de répondre à des précises en traitant côté serveur les app
|
|
|
144
159
|
|
|
145
160
|
#### Explorer la structure des tables
|
|
146
161
|
|
|
147
|
-
* [gpf_wfs_describe_type(typename)](src/tools/GpfWfsDescribeTypeTool.ts) pour récupérer le **schéma d'une table** (
|
|
162
|
+
* [gpf_wfs_describe_type(typename)](src/tools/GpfWfsDescribeTypeTool.ts) pour récupérer le **schéma détaillé d'une table** depuis le catalogue embarqué (`id`, `namespace`, `name`, `title`, `description`, `properties`)
|
|
148
163
|
|
|
149
164
|
> - Quelles sont les informations disponibles pour les communes avec ADMINEXPRESS-COG.LATEST?
|
|
150
165
|
> - Compare le modèle des communes entre ADMINEXPRESS-COG:2024 et ADMINEXPRESS-COG.LATEST
|
|
151
166
|
|
|
152
167
|
#### Explorer les données des tables
|
|
153
168
|
|
|
154
|
-
* [gpf_wfs_get_features(typename,...)](src/tools/GpfWfsGetFeaturesTool.ts) pour **récupérer les données d'une table** ([GetFeature](https://data.geopf.fr/wfs/ows?service=WFS&version=2.0.0&request=GetFeature&typename=ADMINEXPRESS-COG.LATEST:commune&outputFormat=application/json&count=1))
|
|
169
|
+
* [gpf_wfs_get_features(typename,...)](src/tools/GpfWfsGetFeaturesTool.ts) pour **récupérer les données d'une table** depuis le service WFS de la Géoplateforme ([GetFeature](https://data.geopf.fr/wfs/ows?service=WFS&version=2.0.0&request=GetFeature&typename=ADMINEXPRESS-COG.LATEST:commune&outputFormat=application/json&count=1))
|
|
155
170
|
|
|
156
171
|
> - Quelles sont les 5 communes les plus peuplées du Doubs (25)?
|
|
157
172
|
> - Combien y-a-t'il de bâtiments à moins de 5 km de la tour Eiffel?
|
|
@@ -186,7 +201,8 @@ mcp add tool gpf_wmts_layers
|
|
|
186
201
|
```
|
|
187
202
|
|
|
188
203
|
* [@camptocamp/ogc-client](https://camptocamp.github.io/ogc-client/#/) pour la **lecture des réponses XML des services WFS, WMTS,...**
|
|
189
|
-
* [
|
|
204
|
+
* [@ignfab/gpf-schema-store](https://www.npmjs.com/package/@ignfab/gpf-schema-store) pour le **catalogue de schémas embarqué** utilisé par les outils d'exploration WFS.
|
|
205
|
+
* [MiniSearch](https://github.com/lucaong/minisearch) pour la **recherche par mot clé** utilisée dans `@ignfab/gpf-schema-store`.
|
|
190
206
|
* [jsts](https://bjornharrtell.github.io/jsts/) pour les **traitements géométriques** (ex : tri des réponses par distance au point recherché).
|
|
191
207
|
|
|
192
208
|
## Licence
|
package/dist/gpf/wfs.d.ts
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
+
import { Collection, MiniSearchCollectionSearchEngineOptions } from '@ignfab/gpf-schema-store';
|
|
1
2
|
export declare const GPF_WFS_URL = "https://data.geopf.fr/wfs";
|
|
2
|
-
import { WfsFeatureTypeBrief, WfsFeatureTypeFull } from "@camptocamp/ogc-client";
|
|
3
3
|
export declare class FeatureTypeNotFoundError extends Error {
|
|
4
4
|
constructor(name: string);
|
|
5
5
|
}
|
|
6
|
-
export declare
|
|
7
|
-
private featureTypes;
|
|
8
|
-
private miniSearch;
|
|
9
|
-
constructor(featureTypes: WfsFeatureTypeBrief[]);
|
|
10
|
-
search(query: string): import("minisearch").SearchResult[];
|
|
11
|
-
}
|
|
6
|
+
export declare function loadSearchOptionsFromEnv(): MiniSearchCollectionSearchEngineOptions | undefined;
|
|
12
7
|
export declare class WfsClient {
|
|
13
8
|
baseUrl: string;
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
getFeatureTypes(): Promise<
|
|
19
|
-
searchFeatureTypes(query: string, maxResults?: number): Promise<
|
|
20
|
-
getFeatureType(name: string): Promise<
|
|
9
|
+
private readonly catalog;
|
|
10
|
+
constructor(baseUrl?: string, options?: {
|
|
11
|
+
search?: MiniSearchCollectionSearchEngineOptions;
|
|
12
|
+
});
|
|
13
|
+
getFeatureTypes(): Promise<Collection[]>;
|
|
14
|
+
searchFeatureTypes(query: string, maxResults?: number): Promise<Collection[]>;
|
|
15
|
+
getFeatureType(name: string): Promise<Collection>;
|
|
21
16
|
}
|
|
22
17
|
export declare const wfsClient: WfsClient;
|
package/dist/gpf/wfs.js
CHANGED
|
@@ -1,65 +1,120 @@
|
|
|
1
|
+
// --- Imports ---
|
|
2
|
+
import { getCollectionCatalog, MiniSearchCollectionSearchEngine, } from '@ignfab/gpf-schema-store';
|
|
3
|
+
// --- Constants ---
|
|
1
4
|
export const GPF_WFS_URL = "https://data.geopf.fr/wfs";
|
|
2
|
-
|
|
3
|
-
|
|
5
|
+
// Environment variable used to inject search engine options at runtime (JSON string).
|
|
6
|
+
const GPF_WFS_SEARCH_OPTIONS_ENV = "GPF_WFS_SEARCH_OPTIONS";
|
|
7
|
+
// Keys accepted at the top level of the search options object.
|
|
8
|
+
const TOP_LEVEL_SEARCH_OPTION_KEYS = ["fuzzy", "boost"];
|
|
9
|
+
// Keys accepted inside the nested `boost` object.
|
|
10
|
+
const BOOST_SEARCH_OPTION_KEYS = [
|
|
11
|
+
"namespace",
|
|
12
|
+
"name",
|
|
13
|
+
"title",
|
|
14
|
+
"description",
|
|
15
|
+
"properties",
|
|
16
|
+
];
|
|
17
|
+
// --- Errors ---
|
|
4
18
|
export class FeatureTypeNotFoundError extends Error {
|
|
5
19
|
constructor(name) {
|
|
6
20
|
super(`Type '${name}' not found`);
|
|
7
21
|
}
|
|
8
22
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
// --- Helpers ---
|
|
24
|
+
function isPlainObject(value) {
|
|
25
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
function isFiniteNumber(value) {
|
|
28
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
29
|
+
}
|
|
30
|
+
function invalidSearchOptionsError(reason) {
|
|
31
|
+
return new Error(`Invalid ${GPF_WFS_SEARCH_OPTIONS_ENV}: ${reason}`);
|
|
32
|
+
}
|
|
33
|
+
// --- Search options parsing ---
|
|
34
|
+
// Parses and validates a plain-object value into MiniSearchCollectionSearchEngineOptions.
|
|
35
|
+
// Throws a descriptive error if the value has unexpected keys or wrong value types.
|
|
36
|
+
function parseSearchOptions(value) {
|
|
37
|
+
if (!isPlainObject(value)) {
|
|
38
|
+
throw invalidSearchOptionsError("expected a JSON object");
|
|
19
39
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
40
|
+
for (const key of Object.keys(value)) {
|
|
41
|
+
if (!TOP_LEVEL_SEARCH_OPTION_KEYS.includes(key)) {
|
|
42
|
+
throw invalidSearchOptionsError(`unexpected key '${key}'`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const options = {};
|
|
46
|
+
if (value.fuzzy !== undefined) {
|
|
47
|
+
if (!isFiniteNumber(value.fuzzy)) {
|
|
48
|
+
throw invalidSearchOptionsError("expected 'fuzzy' to be a finite number");
|
|
49
|
+
}
|
|
50
|
+
options.fuzzy = value.fuzzy;
|
|
51
|
+
}
|
|
52
|
+
if (value.boost !== undefined) {
|
|
53
|
+
if (!isPlainObject(value.boost)) {
|
|
54
|
+
throw invalidSearchOptionsError("expected 'boost' to be an object");
|
|
55
|
+
}
|
|
56
|
+
const boost = {};
|
|
57
|
+
for (const key of Object.keys(value.boost)) {
|
|
58
|
+
if (!BOOST_SEARCH_OPTION_KEYS.includes(key)) {
|
|
59
|
+
throw invalidSearchOptionsError(`unexpected key 'boost.${key}'`);
|
|
60
|
+
}
|
|
61
|
+
const rawScore = value.boost[key];
|
|
62
|
+
if (!isFiniteNumber(rawScore)) {
|
|
63
|
+
throw invalidSearchOptionsError(`expected 'boost.${key}' to be a finite number`);
|
|
64
|
+
}
|
|
65
|
+
boost[key] = rawScore;
|
|
66
|
+
}
|
|
67
|
+
options.boost = boost;
|
|
25
68
|
}
|
|
69
|
+
return options;
|
|
26
70
|
}
|
|
71
|
+
// Reads search options from the GPF_WFS_SEARCH_OPTIONS environment variable.
|
|
72
|
+
// Returns undefined when the variable is absent or empty.
|
|
73
|
+
export function loadSearchOptionsFromEnv() {
|
|
74
|
+
const rawValue = process.env[GPF_WFS_SEARCH_OPTIONS_ENV];
|
|
75
|
+
if (!rawValue || rawValue.trim() === "") {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
let parsedValue;
|
|
79
|
+
try {
|
|
80
|
+
parsedValue = JSON.parse(rawValue);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
const reason = error instanceof Error ? error.message : "unknown JSON parse error";
|
|
84
|
+
throw invalidSearchOptionsError(`expected valid JSON (${reason})`);
|
|
85
|
+
}
|
|
86
|
+
return parseSearchOptions(parsedValue);
|
|
87
|
+
}
|
|
88
|
+
// --- WFS client ---
|
|
27
89
|
export class WfsClient {
|
|
28
90
|
baseUrl;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
featureTypeSearch;
|
|
32
|
-
constructor(baseUrl = GPF_WFS_URL) {
|
|
91
|
+
catalog;
|
|
92
|
+
constructor(baseUrl = GPF_WFS_URL, options = {}) {
|
|
33
93
|
this.baseUrl = baseUrl;
|
|
34
|
-
this.
|
|
94
|
+
this.catalog = getCollectionCatalog({
|
|
95
|
+
engineFactory: (items) => new MiniSearchCollectionSearchEngine(items, options.search),
|
|
96
|
+
});
|
|
35
97
|
}
|
|
36
98
|
async getFeatureTypes() {
|
|
37
|
-
|
|
38
|
-
return this.endpoint.getFeatureTypes();
|
|
99
|
+
return this.catalog.list();
|
|
39
100
|
}
|
|
40
101
|
async searchFeatureTypes(query, maxResults = 20) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.featureTypeSearch = new FeatureTypeSearch(featureTypes);
|
|
45
|
-
}
|
|
46
|
-
const searchResults = this.featureTypeSearch.search(query).slice(0, maxResults);
|
|
47
|
-
return searchResults.map((result) => {
|
|
48
|
-
return featureTypes.find((featureType) => featureType.name === result.id);
|
|
102
|
+
return this.catalog.search(query, {
|
|
103
|
+
limit: maxResults,
|
|
104
|
+
combineWith: 'AND',
|
|
49
105
|
});
|
|
50
106
|
}
|
|
51
107
|
async getFeatureType(name) {
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
return
|
|
55
|
-
}
|
|
56
|
-
const featureType = await this.endpoint.getFeatureTypeFull(name);
|
|
57
|
-
if (!featureType) {
|
|
58
|
-
throw new FeatureTypeNotFoundError(name);
|
|
108
|
+
const featureType = this.catalog.getById(name);
|
|
109
|
+
if (featureType) {
|
|
110
|
+
return featureType;
|
|
59
111
|
}
|
|
60
|
-
|
|
61
|
-
return featureType;
|
|
112
|
+
throw new FeatureTypeNotFoundError(name);
|
|
62
113
|
}
|
|
63
114
|
}
|
|
64
|
-
|
|
115
|
+
// --- Default singleton ---
|
|
116
|
+
// Pre-configured client using the default GPF endpoint and optional env-based search options.
|
|
117
|
+
export const wfsClient = new WfsClient(undefined, {
|
|
118
|
+
search: loadSearchOptionsFromEnv(),
|
|
119
|
+
});
|
|
65
120
|
//# sourceMappingURL=wfs.js.map
|
package/dist/gpf/wfs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wfs.js","sourceRoot":"","sources":["../../src/gpf/wfs.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAEvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"wfs.js","sourceRoot":"","sources":["../../src/gpf/wfs.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAEH,oBAAoB,EACpB,gCAAgC,GAEnC,MAAM,0BAA0B,CAAC;AAElC,oBAAoB;AAEpB,MAAM,CAAC,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAEvD,sFAAsF;AACtF,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AAE5D,+DAA+D;AAC/D,MAAM,4BAA4B,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU,CAAC;AAEjE,kDAAkD;AAClD,MAAM,wBAAwB,GAAG;IAC7B,WAAW;IACX,MAAM;IACN,OAAO;IACP,aAAa;IACb,YAAY;CACN,CA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"}
|
|
@@ -12,18 +12,7 @@ declare class GpfWfsDescribeTypeTool extends MCPTool<GpfWfsDescribeTypeInput> {
|
|
|
12
12
|
description: string;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
execute(input: GpfWfsDescribeTypeInput): Promise<{
|
|
16
|
-
name: string;
|
|
17
|
-
title?: string;
|
|
18
|
-
abstract?: string;
|
|
19
|
-
boundingBox?: import("@camptocamp/ogc-client").BoundingBox;
|
|
20
|
-
defaultCrs: import("@camptocamp/ogc-client").CrsCode;
|
|
21
|
-
properties: Record<string, import("@camptocamp/ogc-client").FeaturePropertyType>;
|
|
22
|
-
geometryName?: string;
|
|
23
|
-
geometryType?: import("@camptocamp/ogc-client").FeatureGeometryType;
|
|
24
|
-
objectCount?: number;
|
|
25
|
-
keywords?: string[];
|
|
26
|
-
} | {
|
|
15
|
+
execute(input: GpfWfsDescribeTypeInput): Promise<import("@ignfab/gpf-schema-store/dist/types.js").Collection | {
|
|
27
16
|
type: string;
|
|
28
17
|
message: any;
|
|
29
18
|
help: string;
|
|
@@ -14,10 +14,7 @@ class GpfWfsDescribeTypeTool extends MCPTool {
|
|
|
14
14
|
};
|
|
15
15
|
async execute(input) {
|
|
16
16
|
try {
|
|
17
|
-
|
|
18
|
-
// remove useless fields outputFormats and otherCrs
|
|
19
|
-
const { outputFormats, otherCrs, ...result } = featureType;
|
|
20
|
-
return result;
|
|
17
|
+
return await wfsClient.getFeatureType(input.typename);
|
|
21
18
|
}
|
|
22
19
|
catch (e) {
|
|
23
20
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GpfWfsDescribeTypeTool.js","sourceRoot":"","sources":["../../src/tools/GpfWfsDescribeTypeTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAM1C,MAAM,sBAAuB,SAAQ,OAAgC;IACnE,IAAI,GAAG,uBAAuB,CAAC;IAC/B,WAAW,GAAG;QACZ,mGAAmG;KACpG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEf,MAAM,GAAG;QACP,QAAQ,EAAE;YACR,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,0CAA0C;SACxD;KACF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,KAA8B;QAC1C,IAAI,CAAC;YACH,
|
|
1
|
+
{"version":3,"file":"GpfWfsDescribeTypeTool.js","sourceRoot":"","sources":["../../src/tools/GpfWfsDescribeTypeTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAM1C,MAAM,sBAAuB,SAAQ,OAAgC;IACnE,IAAI,GAAG,uBAAuB,CAAC;IAC/B,WAAW,GAAG;QACZ,mGAAmG;KACpG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEf,MAAM,GAAG;QACP,QAAQ,EAAE;YACR,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,0CAA0C;SACxD;KACF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,KAA8B;QAC1C,IAAI,CAAC;YACH,OAAO,MAAM,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACxD,CAAC;QAAA,OAAM,CAAC,EAAC,CAAC;YACR,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,IAAI,EAAE,mEAAmE;aAC1E,CAAA;QACH,CAAC;IACH,CAAC;CACF;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -10,7 +10,7 @@ class GpfWfsListTypesTools extends MCPTool {
|
|
|
10
10
|
schema = {};
|
|
11
11
|
async execute(input) {
|
|
12
12
|
const featureTypes = await wfsClient.getFeatureTypes();
|
|
13
|
-
const featureTypeNames = featureTypes.map((featureType) => featureType.
|
|
13
|
+
const featureTypeNames = featureTypes.map((featureType) => featureType.id);
|
|
14
14
|
return featureTypeNames;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GpfWfsListTypesTool.js","sourceRoot":"","sources":["../../src/tools/GpfWfsListTypesTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK1C,MAAM,oBAAqB,SAAQ,OAAsB;IACvD,IAAI,GAAG,oBAAoB,CAAC;IAC5B,WAAW,GAAG;QACZ,uEAAuE;QACvE,0CAA0C;QAC1C,8FAA8F;KAC/F,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEf,MAAM,GAAG,EAER,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,KAAoB;QAChC,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,eAAe,EAAE,CAAC;QACvD,MAAM,gBAAgB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"GpfWfsListTypesTool.js","sourceRoot":"","sources":["../../src/tools/GpfWfsListTypesTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK1C,MAAM,oBAAqB,SAAQ,OAAsB;IACvD,IAAI,GAAG,oBAAoB,CAAC;IAC5B,WAAW,GAAG;QACZ,uEAAuE;QACvE,0CAA0C;QAC1C,8FAA8F;KAC/F,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEf,MAAM,GAAG,EAER,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,KAAoB;QAChC,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,eAAe,EAAE,CAAC;QACvD,MAAM,gBAAgB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC3E,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -23,7 +23,7 @@ class GpfWfsSearchTypesTool extends MCPTool {
|
|
|
23
23
|
async execute(input) {
|
|
24
24
|
const maxResults = input.max_results || 10;
|
|
25
25
|
const featureTypes = await wfsClient.searchFeatureTypes(input.query, maxResults);
|
|
26
|
-
const featureTypeNames = featureTypes.map((featureType) => featureType.
|
|
26
|
+
const featureTypeNames = featureTypes.map((featureType) => featureType.id);
|
|
27
27
|
return featureTypeNames;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GpfWfsSearchTypesTool.js","sourceRoot":"","sources":["../../src/tools/GpfWfsSearchTypesTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAO1C,MAAM,qBAAsB,SAAQ,OAA+B;IACjE,IAAI,GAAG,sBAAsB,CAAC;IAC9B,WAAW,GAAG;QACZ,0FAA0F;QAC1F,kEAAkE;QAClE,yEAAyE;QACzE,sDAAsD;QACtD,uJAAuJ;KACxJ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEf,MAAM,GAAG;QACP,KAAK,EAAE;YACL,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,yBAAyB;SACvC;QACD,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,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AAC;QACjF,MAAM,gBAAgB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC3E,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAED,eAAe,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ignfab/geocontext",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "An experimental MCP server providing spatial context for LLM.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@camptocamp/ogc-client": "^1.3.0",
|
|
38
|
+
"@ignfab/gpf-schema-store": "^0.1.0",
|
|
38
39
|
"https-proxy-agent": "^7.0.6",
|
|
39
40
|
"jsts": "^2.12.1",
|
|
40
41
|
"lodash": "^4.17.21",
|
|
41
42
|
"mcp-framework": "^0.2.17",
|
|
42
|
-
"minisearch": "^7.2.0",
|
|
43
43
|
"node-fetch": "^3.3.2",
|
|
44
44
|
"winston": "^3.18.3",
|
|
45
45
|
"zod": "^3.25.76"
|