@ignfab/geocontext 0.9.5 → 0.9.7
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 +349 -259
- package/dist/gpf/adminexpress.d.ts +17 -8
- package/dist/gpf/adminexpress.js +40 -17
- package/dist/gpf/adminexpress.js.map +1 -1
- package/dist/gpf/altitude.d.ts +21 -9
- package/dist/gpf/altitude.js +5 -5
- package/dist/gpf/altitude.js.map +1 -1
- package/dist/gpf/geocode.d.ts +25 -4
- package/dist/gpf/geocode.js +5 -5
- package/dist/gpf/geocode.js.map +1 -1
- package/dist/gpf/parcellaire-express.d.ts +19 -9
- package/dist/gpf/parcellaire-express.js +59 -26
- package/dist/gpf/parcellaire-express.js.map +1 -1
- package/dist/gpf/urbanisme.d.ts +24 -16
- package/dist/gpf/urbanisme.js +81 -33
- package/dist/gpf/urbanisme.js.map +1 -1
- package/dist/gpf/{wfs.js → wfs-schema-catalog.js} +1 -1
- package/dist/gpf/wfs-schema-catalog.js.map +1 -0
- package/dist/helpers/RateLimiter.d.ts +44 -0
- package/dist/helpers/RateLimiter.js +52 -0
- package/dist/helpers/RateLimiter.js.map +1 -0
- package/dist/helpers/distance.d.ts +2 -1
- package/dist/helpers/distance.js +2 -1
- package/dist/helpers/distance.js.map +1 -1
- package/dist/helpers/errors/toolError.d.ts +30 -0
- package/dist/helpers/errors/toolError.js +193 -0
- package/dist/helpers/errors/toolError.js.map +1 -0
- package/dist/helpers/errors/zodErrorMapFr.d.ts +20 -0
- package/dist/helpers/errors/zodErrorMapFr.js +191 -0
- package/dist/helpers/errors/zodErrorMapFr.js.map +1 -0
- package/dist/helpers/http.d.ts +67 -7
- package/dist/helpers/http.js +458 -84
- package/dist/helpers/http.js.map +1 -1
- package/dist/helpers/jsonSchema.d.ts +20 -2
- package/dist/helpers/jsonSchema.js +12 -0
- package/dist/helpers/jsonSchema.js.map +1 -1
- package/dist/helpers/schemas.d.ts +4 -4
- package/dist/helpers/wfs_engine/attributeFilter.d.ts +51 -0
- package/dist/helpers/wfs_engine/attributeFilter.js +258 -0
- package/dist/helpers/wfs_engine/attributeFilter.js.map +1 -0
- package/dist/helpers/wfs_engine/byId.d.ts +76 -0
- package/dist/helpers/wfs_engine/byId.js +106 -0
- package/dist/helpers/wfs_engine/byId.js.map +1 -0
- package/dist/helpers/wfs_engine/execution.d.ts +72 -0
- package/dist/helpers/wfs_engine/execution.js +95 -0
- package/dist/helpers/wfs_engine/execution.js.map +1 -0
- package/dist/helpers/wfs_engine/features.d.ts +64 -0
- package/dist/helpers/wfs_engine/features.js +138 -0
- package/dist/helpers/wfs_engine/features.js.map +1 -0
- package/dist/helpers/wfs_engine/geometry.d.ts +16 -0
- package/dist/helpers/wfs_engine/geometry.js +44 -0
- package/dist/helpers/wfs_engine/geometry.js.map +1 -0
- package/dist/helpers/wfs_engine/properties.d.ts +51 -0
- package/dist/helpers/wfs_engine/properties.js +128 -0
- package/dist/helpers/wfs_engine/properties.js.map +1 -0
- package/dist/helpers/wfs_engine/queryPreparation.d.ts +32 -0
- package/dist/helpers/wfs_engine/queryPreparation.js +149 -0
- package/dist/helpers/wfs_engine/queryPreparation.js.map +1 -0
- package/dist/helpers/wfs_engine/request.d.ts +94 -0
- package/dist/helpers/wfs_engine/request.js +197 -0
- package/dist/helpers/wfs_engine/request.js.map +1 -0
- package/dist/helpers/wfs_engine/response.d.ts +80 -0
- package/dist/helpers/wfs_engine/response.js +135 -0
- package/dist/helpers/wfs_engine/response.js.map +1 -0
- package/dist/helpers/wfs_engine/schema.d.ts +209 -0
- package/dist/helpers/{wfs_internal → wfs_engine}/schema.js +50 -10
- package/dist/helpers/wfs_engine/schema.js.map +1 -0
- package/dist/helpers/wfs_engine/spatialCql.d.ts +46 -0
- package/dist/helpers/wfs_engine/spatialCql.js +54 -0
- package/dist/helpers/wfs_engine/spatialCql.js.map +1 -0
- package/dist/helpers/wfs_engine/spatialFilter.d.ts +14 -0
- package/dist/helpers/wfs_engine/spatialFilter.js +131 -0
- package/dist/helpers/wfs_engine/spatialFilter.js.map +1 -0
- package/dist/index.js +65 -23
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +1 -1
- package/dist/logger.js +4 -1
- package/dist/logger.js.map +1 -1
- package/dist/tools/AdminexpressTool.d.ts +42 -33
- package/dist/tools/AdminexpressTool.js +19 -3
- package/dist/tools/AdminexpressTool.js.map +1 -1
- package/dist/tools/AltitudeTool.d.ts +35 -44
- package/dist/tools/AltitudeTool.js +19 -8
- package/dist/tools/AltitudeTool.js.map +1 -1
- package/dist/tools/AssietteSupTool.d.ts +51 -34
- package/dist/tools/AssietteSupTool.js +18 -2
- package/dist/tools/AssietteSupTool.js.map +1 -1
- package/dist/tools/BaseTool.d.ts +17 -0
- package/dist/tools/BaseTool.js +41 -0
- package/dist/tools/BaseTool.js.map +1 -0
- package/dist/tools/CadastreTool.d.ts +53 -33
- package/dist/tools/CadastreTool.js +18 -2
- package/dist/tools/CadastreTool.js.map +1 -1
- package/dist/tools/GeocodeTool.d.ts +53 -37
- package/dist/tools/GeocodeTool.js +17 -2
- package/dist/tools/GeocodeTool.js.map +1 -1
- package/dist/tools/GpfWfsDescribeTypeTool.d.ts +66 -94
- package/dist/tools/GpfWfsDescribeTypeTool.js +26 -15
- package/dist/tools/GpfWfsDescribeTypeTool.js.map +1 -1
- package/dist/tools/GpfWfsGetFeatureByIdTool.d.ts +89 -0
- package/dist/tools/GpfWfsGetFeatureByIdTool.js +99 -0
- package/dist/tools/GpfWfsGetFeatureByIdTool.js.map +1 -0
- package/dist/tools/GpfWfsGetFeaturesTool.d.ts +89 -123
- package/dist/tools/GpfWfsGetFeaturesTool.js +31 -144
- package/dist/tools/GpfWfsGetFeaturesTool.js.map +1 -1
- package/dist/tools/GpfWfsSearchTypesTool.d.ts +41 -32
- package/dist/tools/GpfWfsSearchTypesTool.js +18 -3
- package/dist/tools/GpfWfsSearchTypesTool.js.map +1 -1
- package/dist/tools/UrbanismeTool.d.ts +42 -33
- package/dist/tools/UrbanismeTool.js +18 -2
- package/dist/tools/UrbanismeTool.js.map +1 -1
- package/package.json +51 -24
- package/dist/gpf/wfs.js.map +0 -1
- package/dist/helpers/wfs.d.ts +0 -27
- package/dist/helpers/wfs.js +0 -55
- package/dist/helpers/wfs.js.map +0 -1
- package/dist/helpers/wfs_internal/compile.d.ts +0 -46
- package/dist/helpers/wfs_internal/compile.js +0 -595
- package/dist/helpers/wfs_internal/compile.js.map +0 -1
- package/dist/helpers/wfs_internal/request.d.ts +0 -38
- package/dist/helpers/wfs_internal/request.js +0 -92
- package/dist/helpers/wfs_internal/request.js.map +0 -1
- package/dist/helpers/wfs_internal/response.d.ts +0 -21
- package/dist/helpers/wfs_internal/response.js +0 -29
- package/dist/helpers/wfs_internal/response.js.map +0 -1
- package/dist/helpers/wfs_internal/schema.d.ts +0 -167
- package/dist/helpers/wfs_internal/schema.js.map +0 -1
- /package/dist/gpf/{wfs.d.ts → wfs-schema-catalog.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeocodeTool.js","sourceRoot":"","sources":["../../src/tools/GeocodeTool.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"GeocodeTool.js","sourceRoot":"","sources":["../../src/tools/GeocodeTool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,iBAAiB;AAEjB,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,EAAE,gCAAg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AAI,CAAC,CAAC;IACH,iBAAiB,GAAG,mBAAmB,CAAC;IAElD,MAAM,GAAG,kBAAkB,CAAC;IAE5B;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,KAAmB;QAC/B,MAAM,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,IAAI,MAAM,EAAE;YAC7C,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,gBAAgB,CAAC;SAC3D,CAAC;IACJ,CAAC;CACF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool exposing detailed schema inspection for a single WFS type.
|
|
3
|
+
*/
|
|
4
|
+
import BaseTool from "./BaseTool.js";
|
|
2
5
|
import { z } from "zod";
|
|
3
|
-
import type { Collection } from "@ignfab/gpf-schema-store";
|
|
4
6
|
declare const gpfWfsDescribeTypeInputSchema: z.ZodObject<{
|
|
5
7
|
typename: z.ZodString;
|
|
6
8
|
}, "strict", z.ZodTypeAny, {
|
|
7
|
-
typename
|
|
9
|
+
typename: string;
|
|
8
10
|
}, {
|
|
9
|
-
typename
|
|
11
|
+
typename: string;
|
|
10
12
|
}>;
|
|
11
13
|
type GpfWfsDescribeTypeInput = z.infer<typeof gpfWfsDescribeTypeInputSchema>;
|
|
12
|
-
declare class GpfWfsDescribeTypeTool extends
|
|
14
|
+
declare class GpfWfsDescribeTypeTool extends BaseTool<GpfWfsDescribeTypeInput> {
|
|
13
15
|
name: string;
|
|
14
16
|
title: string;
|
|
15
17
|
annotations: {
|
|
@@ -20,105 +22,75 @@ declare class GpfWfsDescribeTypeTool extends MCPTool<GpfWfsDescribeTypeInput> {
|
|
|
20
22
|
};
|
|
21
23
|
description: string;
|
|
22
24
|
protected outputSchemaShape: z.ZodObject<{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
namespace: z.ZodString;
|
|
27
|
+
name: z.ZodString;
|
|
28
|
+
title: z.ZodString;
|
|
29
|
+
description: z.ZodString;
|
|
30
|
+
properties: z.ZodArray<z.ZodObject<{
|
|
26
31
|
name: z.ZodString;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
title: z.ZodOptional<z.ZodString>;
|
|
33
|
-
description: z.ZodOptional<z.ZodString>;
|
|
34
|
-
enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
35
|
-
defaultCrs: z.ZodOptional<z.ZodString>;
|
|
36
|
-
}, "strip", z.ZodTypeAny, {
|
|
37
|
-
type?: string;
|
|
38
|
-
name?: string;
|
|
39
|
-
title?: string;
|
|
40
|
-
description?: string;
|
|
41
|
-
enum?: string[];
|
|
42
|
-
defaultCrs?: string;
|
|
43
|
-
}, {
|
|
44
|
-
type?: string;
|
|
45
|
-
name?: string;
|
|
46
|
-
title?: string;
|
|
47
|
-
description?: string;
|
|
48
|
-
enum?: string[];
|
|
49
|
-
defaultCrs?: string;
|
|
50
|
-
}>, "many">;
|
|
32
|
+
type: z.ZodString;
|
|
33
|
+
title: z.ZodOptional<z.ZodString>;
|
|
34
|
+
description: z.ZodOptional<z.ZodString>;
|
|
35
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
36
|
+
defaultCrs: z.ZodOptional<z.ZodString>;
|
|
51
37
|
}, "strip", z.ZodTypeAny, {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
enum?: string[];
|
|
59
|
-
defaultCrs?: string;
|
|
60
|
-
}[];
|
|
61
|
-
namespace?: string;
|
|
62
|
-
name?: string;
|
|
63
|
-
title?: string;
|
|
64
|
-
description?: string;
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
title?: string | undefined;
|
|
41
|
+
description?: string | undefined;
|
|
42
|
+
enum?: string[] | undefined;
|
|
43
|
+
defaultCrs?: string | undefined;
|
|
65
44
|
}, {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
defaultCrs?: string;
|
|
74
|
-
}[];
|
|
75
|
-
namespace?: string;
|
|
76
|
-
name?: string;
|
|
77
|
-
title?: string;
|
|
78
|
-
description?: string;
|
|
79
|
-
}>;
|
|
45
|
+
name: string;
|
|
46
|
+
type: string;
|
|
47
|
+
title?: string | undefined;
|
|
48
|
+
description?: string | undefined;
|
|
49
|
+
enum?: string[] | undefined;
|
|
50
|
+
defaultCrs?: string | undefined;
|
|
51
|
+
}>, "many">;
|
|
80
52
|
}, "strip", z.ZodTypeAny, {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
description?: string;
|
|
95
|
-
};
|
|
53
|
+
name: string;
|
|
54
|
+
namespace: string;
|
|
55
|
+
title: string;
|
|
56
|
+
description: string;
|
|
57
|
+
properties: {
|
|
58
|
+
name: string;
|
|
59
|
+
type: string;
|
|
60
|
+
title?: string | undefined;
|
|
61
|
+
description?: string | undefined;
|
|
62
|
+
enum?: string[] | undefined;
|
|
63
|
+
defaultCrs?: string | undefined;
|
|
64
|
+
}[];
|
|
65
|
+
id: string;
|
|
96
66
|
}, {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
description?: string;
|
|
111
|
-
};
|
|
67
|
+
name: string;
|
|
68
|
+
namespace: string;
|
|
69
|
+
title: string;
|
|
70
|
+
description: string;
|
|
71
|
+
properties: {
|
|
72
|
+
name: string;
|
|
73
|
+
type: string;
|
|
74
|
+
title?: string | undefined;
|
|
75
|
+
description?: string | undefined;
|
|
76
|
+
enum?: string[] | undefined;
|
|
77
|
+
defaultCrs?: string | undefined;
|
|
78
|
+
}[];
|
|
79
|
+
id: string;
|
|
112
80
|
}>;
|
|
113
81
|
schema: z.ZodObject<{
|
|
114
82
|
typename: z.ZodString;
|
|
115
83
|
}, "strict", z.ZodTypeAny, {
|
|
116
|
-
typename
|
|
84
|
+
typename: string;
|
|
117
85
|
}, {
|
|
118
|
-
typename
|
|
119
|
-
}>;
|
|
120
|
-
execute(input: GpfWfsDescribeTypeInput): Promise<{
|
|
121
|
-
result: Collection;
|
|
86
|
+
typename: string;
|
|
122
87
|
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Loads the detailed schema description for one WFS typename.
|
|
90
|
+
*
|
|
91
|
+
* @param input Normalized tool input.
|
|
92
|
+
* @returns The detailed feature type description from the embedded catalog.
|
|
93
|
+
*/
|
|
94
|
+
execute(input: GpfWfsDescribeTypeInput): Promise<Collection>;
|
|
123
95
|
}
|
|
124
96
|
export default GpfWfsDescribeTypeTool;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool exposing detailed schema inspection for a single WFS type.
|
|
3
|
+
*/
|
|
4
|
+
import BaseTool from "./BaseTool.js";
|
|
2
5
|
import { z } from "zod";
|
|
3
|
-
import { wfsClient } from "../gpf/wfs.js";
|
|
6
|
+
import { wfsClient } from "../gpf/wfs-schema-catalog.js";
|
|
4
7
|
import { READ_ONLY_OPEN_WORLD_TOOL_ANNOTATIONS } from "../helpers/toolAnnotations.js";
|
|
8
|
+
import logger from "../logger.js";
|
|
9
|
+
// --- Schema ---
|
|
5
10
|
const gpfWfsDescribeTypeInputSchema = z.object({
|
|
6
11
|
typename: z
|
|
7
12
|
.string()
|
|
@@ -18,16 +23,15 @@ const gpfWfsPropertySchema = z.object({
|
|
|
18
23
|
defaultCrs: z.string().describe("Le système de coordonnées par défaut si la propriété est géométrique.").optional(),
|
|
19
24
|
});
|
|
20
25
|
const gpfWfsDescribeTypeOutputSchema = z.object({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
properties: z.array(gpfWfsPropertySchema).describe("La liste des propriétés du type WFS."),
|
|
28
|
-
}).describe("La description détaillée du type WFS."),
|
|
26
|
+
id: z.string().describe("L'identifiant complet du type WFS."),
|
|
27
|
+
namespace: z.string().describe("L'espace de nommage du type WFS."),
|
|
28
|
+
name: z.string().describe("Le nom court du type WFS."),
|
|
29
|
+
title: z.string().describe("Le titre lisible du type WFS."),
|
|
30
|
+
description: z.string().describe("La description du type WFS."),
|
|
31
|
+
properties: z.array(gpfWfsPropertySchema).describe("La liste des propriétés du type WFS."),
|
|
29
32
|
});
|
|
30
|
-
|
|
33
|
+
// --- Tool ---
|
|
34
|
+
class GpfWfsDescribeTypeTool extends BaseTool {
|
|
31
35
|
name = "gpf_wfs_describe_type";
|
|
32
36
|
title = "Description d’un type WFS";
|
|
33
37
|
annotations = READ_ONLY_OPEN_WORLD_TOOL_ANNOTATIONS;
|
|
@@ -35,16 +39,23 @@ class GpfWfsDescribeTypeTool extends MCPTool {
|
|
|
35
39
|
"Renvoie le schéma détaillé d'un type WFS à partir de son identifiant (`typename`) : identifiants, description et liste des propriétés.",
|
|
36
40
|
"Utiliser ce tool après `gpf_wfs_search_types` pour inspecter les propriétés disponibles avant d'appeler `gpf_wfs_get_features`.",
|
|
37
41
|
"La sortie inclut notamment le type des propriétés, leur description, leurs valeurs possibles (`enum`) lorsqu'elles existent",
|
|
38
|
-
"**Appel fortement recommandé si les noms exacts des propriétés ne sont pas connus : un nom de propriété incorrect provoque une erreur**."
|
|
42
|
+
"**IMPORTANT: Appel fortement recommandé si les noms exacts des propriétés ne sont pas connus : un nom de propriété incorrect provoque une erreur**."
|
|
39
43
|
].join("\n");
|
|
40
44
|
outputSchemaShape = gpfWfsDescribeTypeOutputSchema;
|
|
41
45
|
schema = gpfWfsDescribeTypeInputSchema;
|
|
46
|
+
/**
|
|
47
|
+
* Loads the detailed schema description for one WFS typename.
|
|
48
|
+
*
|
|
49
|
+
* @param input Normalized tool input.
|
|
50
|
+
* @returns The detailed feature type description from the embedded catalog.
|
|
51
|
+
*/
|
|
42
52
|
async execute(input) {
|
|
53
|
+
logger.info(`[tool] execute ${this.name} ...`, {
|
|
54
|
+
input: input
|
|
55
|
+
});
|
|
43
56
|
try {
|
|
44
57
|
const featureType = await wfsClient.getFeatureType(input.typename);
|
|
45
|
-
return
|
|
46
|
-
result: featureType,
|
|
47
|
-
};
|
|
58
|
+
return featureType;
|
|
48
59
|
}
|
|
49
60
|
catch (e) {
|
|
50
61
|
const message = e instanceof Error ? e.message : String(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GpfWfsDescribeTypeTool.js","sourceRoot":"","sources":["../../src/tools/GpfWfsDescribeTypeTool.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"GpfWfsDescribeTypeTool.js","sourceRoot":"","sources":["../../src/tools/GpfWfsDescribeTypeTool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,iBAAiB;AAEjB,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,EAAE,sCAAsC,CAA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CAC3F,CAAC,CAAC;AAEH,eAAe;AAEf,MAAM,sBAAuB,SAAQ,QAAiC;IACpE,IAAI,GAAG,uBAAuB,CAAC;IAC/B,KAAK,GAAG,2BAA2B,CAAC;IACpC,WAAW,GAAG,qCAAqC,CAAC;IACpD,WAAW,GAAG;QACZ,wIAAwI;QACxI,iIAAiI;QACjI,6HAA6H;QAC7H,qJAAqJ;KACtJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACH,iBAAiB,GAAG,8BAA8B,CAAC;IAE7D,MAAM,GAAG,6BAA6B,CAAC;IAEvC;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,KAA8B;QAC1C,MAAM,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,IAAI,MAAM,EAAE;YAC7C,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,WAAW,GAAe,MAAM,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC/E,OAAO,WAAW,CAAC;QACrB,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACpB,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3D,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,8DAA8D,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;CACF;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool exposing exact WFS feature lookup by `feature_id`.
|
|
3
|
+
*
|
|
4
|
+
* The tool keeps MCP-facing concerns such as schema exposure, compact response
|
|
5
|
+
* formatting, and request-preview output. The `results` execution flow itself
|
|
6
|
+
* is delegated to the structured WFS engine.
|
|
7
|
+
*/
|
|
8
|
+
import BaseTool from "./BaseTool.js";
|
|
9
|
+
import { type GpfWfsGetFeatureByIdInput } from "../helpers/wfs_engine/schema.js";
|
|
10
|
+
declare class GpfWfsGetFeatureByIdTool extends BaseTool<GpfWfsGetFeatureByIdInput> {
|
|
11
|
+
name: string;
|
|
12
|
+
title: string;
|
|
13
|
+
annotations: {
|
|
14
|
+
readOnlyHint: boolean;
|
|
15
|
+
destructiveHint: boolean;
|
|
16
|
+
idempotentHint: boolean;
|
|
17
|
+
openWorldHint: boolean;
|
|
18
|
+
};
|
|
19
|
+
description: string;
|
|
20
|
+
schema: import("zod").ZodObject<{
|
|
21
|
+
typename: import("zod").ZodString;
|
|
22
|
+
feature_id: import("zod").ZodString;
|
|
23
|
+
result_type: import("zod").ZodDefault<import("zod").ZodEnum<["results", "request"]>>;
|
|
24
|
+
select: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
25
|
+
}, "strict", import("zod").ZodTypeAny, {
|
|
26
|
+
typename: string;
|
|
27
|
+
feature_id: string;
|
|
28
|
+
result_type: "request" | "results";
|
|
29
|
+
select?: string[] | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
typename: string;
|
|
32
|
+
feature_id: string;
|
|
33
|
+
result_type?: "request" | "results" | undefined;
|
|
34
|
+
select?: string[] | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Exposes an input schema variant that stays compatible with most MCP integrations.
|
|
38
|
+
*
|
|
39
|
+
* @returns The published input schema exposed through the MCP tool definition.
|
|
40
|
+
*/
|
|
41
|
+
get inputSchema(): import("../helpers/jsonSchema.js").PublishedInputSchema;
|
|
42
|
+
/**
|
|
43
|
+
* Formats compact responses (`request`, `results`) into `structuredContent`.
|
|
44
|
+
*
|
|
45
|
+
* We intentionally do not expose a single `outputSchemaShape` for the tool as
|
|
46
|
+
* a whole: the `results` path returns a generic FeatureCollection whose
|
|
47
|
+
* feature properties depend on the queried WFS layer, while `request` has a
|
|
48
|
+
* compact, closed shape that is worth validating explicitly.
|
|
49
|
+
*
|
|
50
|
+
* @param data Raw execution result returned by the tool implementation.
|
|
51
|
+
* @returns An MCP success response, optionally enriched with structured content.
|
|
52
|
+
*/
|
|
53
|
+
protected createSuccessResponse(data: unknown): {
|
|
54
|
+
content: {
|
|
55
|
+
type: "text";
|
|
56
|
+
text: string;
|
|
57
|
+
}[];
|
|
58
|
+
structuredContent: {
|
|
59
|
+
url: string;
|
|
60
|
+
result_type: "request";
|
|
61
|
+
method: "POST";
|
|
62
|
+
query: Record<string, string>;
|
|
63
|
+
body: string;
|
|
64
|
+
get_url?: string | null | undefined;
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
content: {
|
|
68
|
+
type: "text";
|
|
69
|
+
text: string;
|
|
70
|
+
}[];
|
|
71
|
+
structuredContent: Record<string, unknown>;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Orchestrates the by-id execution flow:
|
|
75
|
+
* schema lookup -> request compilation -> optional request output -> WFS execution -> cardinality validation.
|
|
76
|
+
*
|
|
77
|
+
* @param input Normalized tool input.
|
|
78
|
+
* @returns Either a compiled request or a transformed FeatureCollection containing one feature.
|
|
79
|
+
*/
|
|
80
|
+
execute(input: GpfWfsGetFeatureByIdInput): Promise<import("../helpers/wfs_engine/request.js").WfsRequestPayload | (Record<string, unknown> & {
|
|
81
|
+
features?: (Record<string, unknown> & {
|
|
82
|
+
feature_ref?: {
|
|
83
|
+
typename: string | null;
|
|
84
|
+
feature_id: string;
|
|
85
|
+
};
|
|
86
|
+
})[];
|
|
87
|
+
})>;
|
|
88
|
+
}
|
|
89
|
+
export default GpfWfsGetFeatureByIdTool;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool exposing exact WFS feature lookup by `feature_id`.
|
|
3
|
+
*
|
|
4
|
+
* The tool keeps MCP-facing concerns such as schema exposure, compact response
|
|
5
|
+
* formatting, and request-preview output. The `results` execution flow itself
|
|
6
|
+
* is delegated to the structured WFS engine.
|
|
7
|
+
*/
|
|
8
|
+
import BaseTool from "./BaseTool.js";
|
|
9
|
+
import { READ_ONLY_OPEN_WORLD_TOOL_ANNOTATIONS } from "../helpers/toolAnnotations.js";
|
|
10
|
+
import { buildPropertyName, executeGetFeatureById } from "../helpers/wfs_engine/byId.js";
|
|
11
|
+
import { getFeatureType } from "../helpers/wfs_engine/execution.js";
|
|
12
|
+
import { buildGetFeatureByIdRequest, toWfsRequestPayload, } from "../helpers/wfs_engine/request.js";
|
|
13
|
+
import { gpfWfsGetFeatureByIdInputSchema, gpfWfsGetFeatureByIdPublishedInputSchema, gpfWfsGetFeatureByIdRequestOutputSchema, } from "../helpers/wfs_engine/schema.js";
|
|
14
|
+
import logger from "../logger.js";
|
|
15
|
+
// --- Tool ---
|
|
16
|
+
class GpfWfsGetFeatureByIdTool extends BaseTool {
|
|
17
|
+
name = "gpf_wfs_get_feature_by_id";
|
|
18
|
+
title = "Lecture d’un objet WFS par identifiant";
|
|
19
|
+
annotations = READ_ONLY_OPEN_WORLD_TOOL_ANNOTATIONS;
|
|
20
|
+
description = [
|
|
21
|
+
"Récupère exactement un objet WFS à partir de `typename` et `feature_id`, sans filtre attributaire ni spatial.",
|
|
22
|
+
"Ce tool est le chemin robuste quand vous disposez déjà d'une `feature_ref { typename, feature_id }` issue d'un autre tool (`adminexpress`, `cadastre`, `urbanisme`, `assiette_sup`, `gpf_wfs_get_features`).",
|
|
23
|
+
"Le contrat garantit une cardinalité stricte : 0 résultat ou plusieurs résultats provoquent une erreur explicite.",
|
|
24
|
+
"Utiliser `result_type=\"request\"` pour récupérer la requête WFS compilée (avec `get_url`) et l'utiliser ou la visualiser ailleurs."
|
|
25
|
+
].join("\n");
|
|
26
|
+
// `schema` remains the runtime validation source, while `inputSchema`
|
|
27
|
+
// publishes the MCP-facing variant expected by clients.
|
|
28
|
+
schema = gpfWfsGetFeatureByIdInputSchema;
|
|
29
|
+
/**
|
|
30
|
+
* Exposes an input schema variant that stays compatible with most MCP integrations.
|
|
31
|
+
*
|
|
32
|
+
* @returns The published input schema exposed through the MCP tool definition.
|
|
33
|
+
*/
|
|
34
|
+
get inputSchema() {
|
|
35
|
+
return gpfWfsGetFeatureByIdPublishedInputSchema;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Formats compact responses (`request`, `results`) into `structuredContent`.
|
|
39
|
+
*
|
|
40
|
+
* We intentionally do not expose a single `outputSchemaShape` for the tool as
|
|
41
|
+
* a whole: the `results` path returns a generic FeatureCollection whose
|
|
42
|
+
* feature properties depend on the queried WFS layer, while `request` has a
|
|
43
|
+
* compact, closed shape that is worth validating explicitly.
|
|
44
|
+
*
|
|
45
|
+
* @param data Raw execution result returned by the tool implementation.
|
|
46
|
+
* @returns An MCP success response, optionally enriched with structured content.
|
|
47
|
+
*/
|
|
48
|
+
createSuccessResponse(data) {
|
|
49
|
+
if (typeof data === "object" &&
|
|
50
|
+
data !== null &&
|
|
51
|
+
"result_type" in data &&
|
|
52
|
+
data.result_type === "request") {
|
|
53
|
+
return {
|
|
54
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
55
|
+
structuredContent: gpfWfsGetFeatureByIdRequestOutputSchema.parse(data),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (typeof data === "object" &&
|
|
59
|
+
data !== null &&
|
|
60
|
+
"type" in data &&
|
|
61
|
+
data.type === "FeatureCollection") {
|
|
62
|
+
return {
|
|
63
|
+
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
64
|
+
structuredContent: data,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
throw new Error("Réponse interne inattendue pour gpf_wfs_get_feature_by_id : le résultat devrait être une requête WFS ou une FeatureCollection.");
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Orchestrates the by-id execution flow:
|
|
71
|
+
* schema lookup -> request compilation -> optional request output -> WFS execution -> cardinality validation.
|
|
72
|
+
*
|
|
73
|
+
* @param input Normalized tool input.
|
|
74
|
+
* @returns Either a compiled request or a transformed FeatureCollection containing one feature.
|
|
75
|
+
*/
|
|
76
|
+
async execute(input) {
|
|
77
|
+
logger.info(`[tool] execute ${this.name} ...`, {
|
|
78
|
+
input: input
|
|
79
|
+
});
|
|
80
|
+
if (input.result_type === "request") {
|
|
81
|
+
// The `request` mode is handled here because it returns a preview payload,
|
|
82
|
+
// not the actual by-id WFS result.
|
|
83
|
+
const featureType = await getFeatureType(input.typename);
|
|
84
|
+
const propertyName = buildPropertyName(featureType, {
|
|
85
|
+
includeGeometry: true,
|
|
86
|
+
select: input.select,
|
|
87
|
+
});
|
|
88
|
+
const request = buildGetFeatureByIdRequest(input.typename, input.feature_id, propertyName);
|
|
89
|
+
return toWfsRequestPayload(request);
|
|
90
|
+
}
|
|
91
|
+
return executeGetFeatureById({
|
|
92
|
+
typename: input.typename,
|
|
93
|
+
feature_id: input.feature_id,
|
|
94
|
+
select: input.select,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export default GpfWfsGetFeatureByIdTool;
|
|
99
|
+
//# sourceMappingURL=GpfWfsGetFeatureByIdTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GpfWfsGetFeatureByIdTool.js","sourceRoot":"","sources":["../../src/tools/GpfWfsGetFeatureByIdTool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,qCAAqC,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,+BAA+B,EAE/B,wCAAwC,EACxC,uCAAuC,GACxC,MAAM,iCAAiC,CAAC;AACzC,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,eAAe;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