@ignfab/geocontext 0.9.3 → 0.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +62 -31
  2. package/dist/gpf/adminexpress.js +7 -27
  3. package/dist/gpf/adminexpress.js.map +1 -1
  4. package/dist/gpf/parcellaire-express.js +13 -33
  5. package/dist/gpf/parcellaire-express.js.map +1 -1
  6. package/dist/gpf/urbanisme.d.ts +4 -2
  7. package/dist/gpf/urbanisme.js +20 -61
  8. package/dist/gpf/urbanisme.js.map +1 -1
  9. package/dist/gpf/wfs.d.ts +2 -2
  10. package/dist/gpf/wfs.js +17 -71
  11. package/dist/gpf/wfs.js.map +1 -1
  12. package/dist/helpers/distance.d.ts +4 -2
  13. package/dist/helpers/distance.js +20 -5
  14. package/dist/helpers/distance.js.map +1 -1
  15. package/dist/helpers/http.d.ts +4 -0
  16. package/dist/helpers/http.js +103 -1
  17. package/dist/helpers/http.js.map +1 -1
  18. package/dist/helpers/jsonSchema.d.ts +9 -0
  19. package/dist/helpers/jsonSchema.js +14 -0
  20. package/dist/helpers/jsonSchema.js.map +1 -0
  21. package/dist/helpers/schemas.d.ts +13 -0
  22. package/dist/helpers/schemas.js +18 -0
  23. package/dist/helpers/schemas.js.map +1 -0
  24. package/dist/helpers/wfs.d.ts +27 -0
  25. package/dist/helpers/wfs.js +55 -0
  26. package/dist/helpers/wfs.js.map +1 -0
  27. package/dist/helpers/wfs_internal/compile.d.ts +55 -0
  28. package/dist/helpers/wfs_internal/compile.js +596 -0
  29. package/dist/helpers/wfs_internal/compile.js.map +1 -0
  30. package/dist/helpers/wfs_internal/request.d.ts +47 -0
  31. package/dist/helpers/wfs_internal/request.js +121 -0
  32. package/dist/helpers/wfs_internal/request.js.map +1 -0
  33. package/dist/helpers/wfs_internal/response.d.ts +29 -0
  34. package/dist/helpers/wfs_internal/response.js +59 -0
  35. package/dist/helpers/wfs_internal/response.js.map +1 -0
  36. package/dist/helpers/wfs_internal/schema.d.ts +167 -0
  37. package/dist/helpers/wfs_internal/schema.js +81 -0
  38. package/dist/helpers/wfs_internal/schema.js.map +1 -0
  39. package/dist/index.js +47 -25
  40. package/dist/index.js.map +1 -1
  41. package/dist/tools/AdminexpressTool.d.ts +52 -2
  42. package/dist/tools/AdminexpressTool.js +12 -14
  43. package/dist/tools/AdminexpressTool.js.map +1 -1
  44. package/dist/tools/AltitudeTool.d.ts +2 -2
  45. package/dist/tools/AltitudeTool.js +4 -13
  46. package/dist/tools/AltitudeTool.js.map +1 -1
  47. package/dist/tools/AssietteSupTool.d.ts +55 -3
  48. package/dist/tools/AssietteSupTool.js +13 -15
  49. package/dist/tools/AssietteSupTool.js.map +1 -1
  50. package/dist/tools/CadastreTool.d.ts +52 -2
  51. package/dist/tools/CadastreTool.js +14 -15
  52. package/dist/tools/CadastreTool.js.map +1 -1
  53. package/dist/tools/GeocodeTool.d.ts +2 -2
  54. package/dist/tools/GeocodeTool.js +6 -4
  55. package/dist/tools/GeocodeTool.js.map +1 -1
  56. package/dist/tools/GpfWfsDescribeTypeTool.d.ts +16 -16
  57. package/dist/tools/GpfWfsDescribeTypeTool.js +4 -3
  58. package/dist/tools/GpfWfsDescribeTypeTool.js.map +1 -1
  59. package/dist/tools/GpfWfsGetFeatureByIdTool.d.ts +110 -0
  60. package/dist/tools/GpfWfsGetFeatureByIdTool.js +156 -0
  61. package/dist/tools/GpfWfsGetFeatureByIdTool.js.map +1 -0
  62. package/dist/tools/GpfWfsGetFeaturesTool.d.ts +161 -44
  63. package/dist/tools/GpfWfsGetFeaturesTool.js +139 -114
  64. package/dist/tools/GpfWfsGetFeaturesTool.js.map +1 -1
  65. package/dist/tools/GpfWfsSearchTypesTool.d.ts +8 -2
  66. package/dist/tools/GpfWfsSearchTypesTool.js +12 -9
  67. package/dist/tools/GpfWfsSearchTypesTool.js.map +1 -1
  68. package/dist/tools/UrbanismeTool.d.ts +53 -3
  69. package/dist/tools/UrbanismeTool.js +10 -15
  70. package/dist/tools/UrbanismeTool.js.map +1 -1
  71. package/package.json +8 -7
  72. package/dist/resources/WfsCqlFilterResource.d.ts +0 -10
  73. package/dist/resources/WfsCqlFilterResource.js +0 -23
  74. package/dist/resources/WfsCqlFilterResource.js.map +0 -1
  75. package/dist/resources/content/wfs-cql-filter.md +0 -215
  76. package/dist/tools/GpfWfsListTypesTool.d.ts +0 -22
  77. package/dist/tools/GpfWfsListTypesTool.js +0 -26
  78. package/dist/tools/GpfWfsListTypesTool.js.map +0 -1
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
  import type { Collection } from "@ignfab/gpf-schema-store";
4
4
  declare const gpfWfsDescribeTypeInputSchema: z.ZodObject<{
5
5
  typename: z.ZodString;
6
- }, "strip", z.ZodTypeAny, {
6
+ }, "strict", z.ZodTypeAny, {
7
7
  typename?: string;
8
8
  }, {
9
9
  typename?: string;
@@ -50,10 +50,6 @@ declare class GpfWfsDescribeTypeTool extends MCPTool<GpfWfsDescribeTypeInput> {
50
50
  }>, "many">;
51
51
  }, "strip", z.ZodTypeAny, {
52
52
  id?: string;
53
- namespace?: string;
54
- name?: string;
55
- title?: string;
56
- description?: string;
57
53
  properties?: {
58
54
  type?: string;
59
55
  name?: string;
@@ -62,12 +58,12 @@ declare class GpfWfsDescribeTypeTool extends MCPTool<GpfWfsDescribeTypeInput> {
62
58
  enum?: string[];
63
59
  defaultCrs?: string;
64
60
  }[];
65
- }, {
66
- id?: string;
67
61
  namespace?: string;
68
62
  name?: string;
69
63
  title?: string;
70
64
  description?: string;
65
+ }, {
66
+ id?: string;
71
67
  properties?: {
72
68
  type?: string;
73
69
  name?: string;
@@ -76,14 +72,14 @@ declare class GpfWfsDescribeTypeTool extends MCPTool<GpfWfsDescribeTypeInput> {
76
72
  enum?: string[];
77
73
  defaultCrs?: string;
78
74
  }[];
79
- }>;
80
- }, "strip", z.ZodTypeAny, {
81
- result?: {
82
- id?: string;
83
75
  namespace?: string;
84
76
  name?: string;
85
77
  title?: string;
86
78
  description?: string;
79
+ }>;
80
+ }, "strip", z.ZodTypeAny, {
81
+ result?: {
82
+ id?: string;
87
83
  properties?: {
88
84
  type?: string;
89
85
  name?: string;
@@ -92,14 +88,14 @@ declare class GpfWfsDescribeTypeTool extends MCPTool<GpfWfsDescribeTypeInput> {
92
88
  enum?: string[];
93
89
  defaultCrs?: string;
94
90
  }[];
95
- };
96
- }, {
97
- result?: {
98
- id?: string;
99
91
  namespace?: string;
100
92
  name?: string;
101
93
  title?: string;
102
94
  description?: string;
95
+ };
96
+ }, {
97
+ result?: {
98
+ id?: string;
103
99
  properties?: {
104
100
  type?: string;
105
101
  name?: string;
@@ -108,11 +104,15 @@ declare class GpfWfsDescribeTypeTool extends MCPTool<GpfWfsDescribeTypeInput> {
108
104
  enum?: string[];
109
105
  defaultCrs?: string;
110
106
  }[];
107
+ namespace?: string;
108
+ name?: string;
109
+ title?: string;
110
+ description?: string;
111
111
  };
112
112
  }>;
113
113
  schema: z.ZodObject<{
114
114
  typename: z.ZodString;
115
- }, "strip", z.ZodTypeAny, {
115
+ }, "strict", z.ZodTypeAny, {
116
116
  typename?: string;
117
117
  }, {
118
118
  typename?: string;
@@ -8,7 +8,7 @@ const gpfWfsDescribeTypeInputSchema = z.object({
8
8
  .trim()
9
9
  .min(1, "le nom du type ne doit pas être vide")
10
10
  .describe("Le nom du type (ex : BDTOPO_V3:batiment)"),
11
- });
11
+ }).strict();
12
12
  const gpfWfsPropertySchema = z.object({
13
13
  name: z.string().describe("Le nom de la propriété."),
14
14
  type: z.string().describe("Le type de la propriété."),
@@ -34,8 +34,9 @@ class GpfWfsDescribeTypeTool extends MCPTool {
34
34
  description = [
35
35
  "Renvoie le schéma détaillé d'un type WFS à partir de son identifiant (`typename`) : identifiants, description et liste des propriétés.",
36
36
  "Utiliser ce tool après `gpf_wfs_search_types` pour inspecter les propriétés disponibles avant d'appeler `gpf_wfs_get_features`.",
37
- "La sortie inclut notamment le type des propriétés, leur description, et leurs valeurs possibles (`enum`) lorsqu'elles existent.",
38
- ].join("\r\n");
37
+ "La sortie inclut notamment le type des propriétés, leur description, leurs valeurs possibles (`enum`) lorsqu'elles existent",
38
+ "**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
+ ].join("\n");
39
40
  outputSchemaShape = gpfWfsDescribeTypeOutputSchema;
40
41
  schema = gpfWfsDescribeTypeInputSchema;
41
42
  async execute(input) {
@@ -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;AAGxB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,qCAAqC,EAAE,MAAM,+BAA+B,CAAC;AAEtF,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,EAAE,sCAAsC,CAAC;SAC9C,QAAQ,CAAC,0CAA0C,CAAC;CACxD,CAAC,CAAC;AAIH,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IACpD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IACrD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAC,QAAQ,EAAE;IAC1E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC,CAAC,QAAQ,EAAE;IAC9E,IAAI,EAAE,CAAC,CAA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B,CAAC;IAE7D,MAAM,GAAG,6BAA6B,CAAC;IAEvC,KAAK,CAAC,OAAO,CAAC,KAA8B;QAC1C,IAAI,CAAC;YACH,MAAM,WAAW,GAAe,MAAM,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC/E,OAAO;gBACL,MAAM,EAAE,WAAW;aACpB,CAAC;QACJ,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,110 @@
1
+ import { MCPTool } from "mcp-framework";
2
+ import type { Collection } from "@ignfab/gpf-schema-store";
3
+ import { z } from "zod";
4
+ import { type CompiledRequest } from "../helpers/wfs_internal/request.js";
5
+ declare const gpfWfsGetFeatureByIdInputSchema: z.ZodObject<{
6
+ typename: z.ZodString;
7
+ feature_id: z.ZodString;
8
+ result_type: z.ZodDefault<z.ZodEnum<["results", "request"]>>;
9
+ select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
10
+ }, "strict", z.ZodTypeAny, {
11
+ typename?: string;
12
+ feature_id?: string;
13
+ result_type?: "request" | "results";
14
+ select?: string[];
15
+ }, {
16
+ typename?: string;
17
+ feature_id?: string;
18
+ result_type?: "request" | "results";
19
+ select?: string[];
20
+ }>;
21
+ type GpfWfsGetFeatureByIdInput = z.infer<typeof gpfWfsGetFeatureByIdInputSchema>;
22
+ type PublishedInputSchema = {
23
+ type: "object";
24
+ properties?: Record<string, object>;
25
+ required?: string[];
26
+ };
27
+ declare class GpfWfsGetFeatureByIdTool extends MCPTool<GpfWfsGetFeatureByIdInput> {
28
+ name: string;
29
+ title: string;
30
+ annotations: {
31
+ readOnlyHint: boolean;
32
+ destructiveHint: boolean;
33
+ idempotentHint: boolean;
34
+ openWorldHint: boolean;
35
+ };
36
+ description: string;
37
+ schema: z.ZodObject<{
38
+ typename: z.ZodString;
39
+ feature_id: z.ZodString;
40
+ result_type: z.ZodDefault<z.ZodEnum<["results", "request"]>>;
41
+ select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
42
+ }, "strict", z.ZodTypeAny, {
43
+ typename?: string;
44
+ feature_id?: string;
45
+ result_type?: "request" | "results";
46
+ select?: string[];
47
+ }, {
48
+ typename?: string;
49
+ feature_id?: string;
50
+ result_type?: "request" | "results";
51
+ select?: string[];
52
+ }>;
53
+ /**
54
+ * Exposes an input schema variant that stays compatible with most MCP integrations.
55
+ *
56
+ * @returns The published input schema exposed through the MCP tool definition.
57
+ */
58
+ get inputSchema(): PublishedInputSchema;
59
+ /**
60
+ * Formats compact responses (`request`) into `structuredContent`.
61
+ *
62
+ * @param data Raw execution result returned by the tool implementation.
63
+ * @returns An MCP success response, optionally enriched with structured content.
64
+ */
65
+ protected createSuccessResponse(data: unknown): import("mcp-framework").ToolResponse | {
66
+ content: {
67
+ type: "text";
68
+ text: string;
69
+ }[];
70
+ structuredContent: {
71
+ body?: string;
72
+ result_type?: "request";
73
+ method?: "POST";
74
+ url?: string;
75
+ query?: Record<string, string>;
76
+ get_url?: string;
77
+ };
78
+ };
79
+ /**
80
+ * Loads a WFS feature type description from the embedded catalog.
81
+ *
82
+ * @param typename Exact WFS typename to load from the embedded schema store.
83
+ * @returns The matching feature type description.
84
+ */
85
+ protected getFeatureType(typename: string): Promise<Collection>;
86
+ /**
87
+ * Executes a compiled WFS request as POST and returns the JSON FeatureCollection.
88
+ *
89
+ * @param request Compiled request split into query-string parameters and POST body.
90
+ * @returns The parsed JSON response returned by the WFS endpoint.
91
+ */
92
+ protected fetchFeatureCollection(request: CompiledRequest): Promise<any>;
93
+ /**
94
+ * Builds the optional `propertyName` request parameter from `select`.
95
+ *
96
+ * @param featureType Feature type definition loaded from the embedded catalog.
97
+ * @param input Normalized tool input.
98
+ * @returns A comma-separated property list, or `undefined` when all properties should be returned.
99
+ */
100
+ protected buildPropertyName(featureType: Collection, input: GpfWfsGetFeatureByIdInput): string;
101
+ /**
102
+ * Orchestrates the by-id execution flow:
103
+ * schema lookup -> request compilation -> optional request output -> WFS execution -> cardinality validation.
104
+ *
105
+ * @param input Normalized tool input.
106
+ * @returns Either a compiled request or a transformed FeatureCollection containing one feature.
107
+ */
108
+ execute(input: GpfWfsGetFeatureByIdInput): Promise<Record<string, unknown>>;
109
+ }
110
+ export default GpfWfsGetFeatureByIdTool;
@@ -0,0 +1,156 @@
1
+ import { MCPTool } from "mcp-framework";
2
+ import { z } from "zod";
3
+ import { wfsClient } from "../gpf/wfs.js";
4
+ import { fetchJSONPost } from "../helpers/http.js";
5
+ import { READ_ONLY_OPEN_WORLD_TOOL_ANNOTATIONS } from "../helpers/toolAnnotations.js";
6
+ import { generatePublishedInputSchema } from "../helpers/jsonSchema.js";
7
+ import { compileSelectProperty, getGeometryProperty } from "../helpers/wfs_internal/compile.js";
8
+ import { buildGetFeatureByIdRequest } from "../helpers/wfs_internal/request.js";
9
+ import { attachFeatureRefs } from "../helpers/wfs_internal/response.js";
10
+ import { gpfWfsGetFeaturesRequestOutputSchema } from "../helpers/wfs_internal/schema.js";
11
+ const gpfWfsGetFeatureByIdInputSchema = z.object({
12
+ typename: z
13
+ .string()
14
+ .trim()
15
+ .min(1, "le nom du type ne doit pas être vide")
16
+ .describe("Nom exact du type WFS à interroger, par exemple `ADMINEXPRESS-COG.LATEST:commune`."),
17
+ feature_id: z
18
+ .string()
19
+ .trim()
20
+ .min(1, "le feature_id ne doit pas être vide")
21
+ .describe("Identifiant WFS exact de l'objet à récupérer, par exemple `commune.8952`."),
22
+ result_type: z
23
+ .enum(["results", "request"])
24
+ .default("results")
25
+ .describe("`results` renvoie une FeatureCollection normalisée avec exactement un objet. `request` renvoie la requête WFS compilée (`get_url`) à destination de `create_map` via `geojson_url`, ou pour déboguer."),
26
+ select: z
27
+ .array(z.string().trim().min(1))
28
+ .min(1)
29
+ .optional()
30
+ .describe("Liste des propriétés non géométriques à renvoyer. Quand `result_type=\"request\"`, la géométrie est automatiquement ajoutée."),
31
+ }).strict();
32
+ const gpfWfsGetFeatureByIdPublishedInputSchema = generatePublishedInputSchema(gpfWfsGetFeatureByIdInputSchema);
33
+ class GpfWfsGetFeatureByIdTool extends MCPTool {
34
+ name = "gpf_wfs_get_feature_by_id";
35
+ title = "Lecture d’un objet WFS par identifiant";
36
+ annotations = READ_ONLY_OPEN_WORLD_TOOL_ANNOTATIONS;
37
+ description = [
38
+ "Récupère exactement un objet WFS à partir de `typename` et `feature_id`, sans filtre attributaire ni spatial.",
39
+ "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`).",
40
+ "Le contrat garantit une cardinalité stricte : 0 résultat ou plusieurs résultats provoquent une erreur explicite.",
41
+ "Utiliser `result_type=\"request\"` pour récupérer la requête WFS compilée (avec `get_url`) et l'utiliser ou la visualiser ailleurs."
42
+ ].join("\n");
43
+ schema = gpfWfsGetFeatureByIdInputSchema;
44
+ /**
45
+ * Exposes an input schema variant that stays compatible with most MCP integrations.
46
+ *
47
+ * @returns The published input schema exposed through the MCP tool definition.
48
+ */
49
+ get inputSchema() {
50
+ return gpfWfsGetFeatureByIdPublishedInputSchema;
51
+ }
52
+ /**
53
+ * Formats compact responses (`request`) into `structuredContent`.
54
+ *
55
+ * @param data Raw execution result returned by the tool implementation.
56
+ * @returns An MCP success response, optionally enriched with structured content.
57
+ */
58
+ createSuccessResponse(data) {
59
+ if (typeof data === "object" &&
60
+ data !== null &&
61
+ "result_type" in data &&
62
+ data.result_type === "request") {
63
+ return {
64
+ content: [{ type: "text", text: JSON.stringify(data) }],
65
+ structuredContent: gpfWfsGetFeaturesRequestOutputSchema.parse(data),
66
+ };
67
+ }
68
+ return super.createSuccessResponse(data);
69
+ }
70
+ /**
71
+ * Loads a WFS feature type description from the embedded catalog.
72
+ *
73
+ * @param typename Exact WFS typename to load from the embedded schema store.
74
+ * @returns The matching feature type description.
75
+ */
76
+ async getFeatureType(typename) {
77
+ return wfsClient.getFeatureType(typename);
78
+ }
79
+ /**
80
+ * Executes a compiled WFS request as POST and returns the JSON FeatureCollection.
81
+ *
82
+ * @param request Compiled request split into query-string parameters and POST body.
83
+ * @returns The parsed JSON response returned by the WFS endpoint.
84
+ */
85
+ async fetchFeatureCollection(request) {
86
+ const url = `${request.url}?${new URLSearchParams(request.query).toString()}`;
87
+ return fetchJSONPost(url, request.body, {
88
+ "Content-Type": "application/x-www-form-urlencoded",
89
+ "Accept": "application/json",
90
+ });
91
+ }
92
+ /**
93
+ * Builds the optional `propertyName` request parameter from `select`.
94
+ *
95
+ * @param featureType Feature type definition loaded from the embedded catalog.
96
+ * @param input Normalized tool input.
97
+ * @returns A comma-separated property list, or `undefined` when all properties should be returned.
98
+ */
99
+ buildPropertyName(featureType, input) {
100
+ if (!input.select || input.select.length === 0) {
101
+ return undefined;
102
+ }
103
+ const geometryProperty = getGeometryProperty(featureType);
104
+ const selectedProperties = input.select.map((propertyName) => compileSelectProperty(featureType, geometryProperty, propertyName));
105
+ if (input.result_type === "request") {
106
+ return [...selectedProperties, geometryProperty.name].join(",");
107
+ }
108
+ return selectedProperties.join(",");
109
+ }
110
+ /**
111
+ * Orchestrates the by-id execution flow:
112
+ * schema lookup -> request compilation -> optional request output -> WFS execution -> cardinality validation.
113
+ *
114
+ * @param input Normalized tool input.
115
+ * @returns Either a compiled request or a transformed FeatureCollection containing one feature.
116
+ */
117
+ async execute(input) {
118
+ const featureType = await this.getFeatureType(input.typename);
119
+ const propertyName = this.buildPropertyName(featureType, input);
120
+ const request = buildGetFeatureByIdRequest(input.typename, input.feature_id, propertyName);
121
+ if (input.result_type === "request") {
122
+ return {
123
+ result_type: "request",
124
+ method: request.method,
125
+ url: request.url,
126
+ query: request.query,
127
+ body: request.body,
128
+ get_url: request.get_url ?? null,
129
+ };
130
+ }
131
+ const featureCollection = await this.fetchFeatureCollection(request);
132
+ if (!Array.isArray(featureCollection?.features)) {
133
+ throw new Error("Le service WFS n'a pas retourné de collection d'objets exploitable.");
134
+ }
135
+ if (featureCollection.features.length === 0) {
136
+ throw new Error(`Le feature '${input.feature_id}' est introuvable dans '${input.typename}'.`);
137
+ }
138
+ if (featureCollection.features.length > 1) {
139
+ throw new Error(`Le feature '${input.feature_id}' dans '${input.typename}' devrait être unique, mais ${featureCollection.features.length} objets ont été retournés.`);
140
+ }
141
+ const [firstFeature] = featureCollection.features;
142
+ if (firstFeature?.id !== input.feature_id) {
143
+ throw new Error(`Le service WFS a retourné l'identifiant '${String(firstFeature?.id)}' au lieu de '${input.feature_id}'.`);
144
+ }
145
+ const singleFeatureCollection = {
146
+ ...featureCollection,
147
+ features: [firstFeature],
148
+ totalFeatures: 1,
149
+ numberReturned: 1,
150
+ numberMatched: 1,
151
+ };
152
+ return attachFeatureRefs(singleFeatureCollection, input.typename);
153
+ }
154
+ }
155
+ export default GpfWfsGetFeatureByIdTool;
156
+ //# sourceMappingURL=GpfWfsGetFeatureByIdTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GpfWfsGetFeatureByIdTool.js","sourceRoot":"","sources":["../../src/tools/GpfWfsGetFeatureByIdTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,qCAAqC,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,q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I,KAAK,CAAC,qEAAqE,CAAC,CAAC;QACzF,CAAC;QAED,IAAI,iBAAiB,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,eAAe,KAAK,CAAC,UAAU,2BAA2B,KAAK,CAAC,QAAQ,IAAI,CAAC,CAAC;QAChG,CAAC;QAED,IAAI,iBAAiB,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,eAAe,KAAK,CAAC,UAAU,WAAW,KAAK,CAAC,QAAQ,+BAA+B,iBAAiB,CAAC,QAAQ,CAAC,MAAM,4BAA4B,CAAC,CAAC;QACxK,CAAC;QAED,MAAM,CAAC,YAAY,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC;QAClD,IAAI,YAAY,EAAE,EAAE,KAAK,KAAK,CAAC,UAAU,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,4CAA4C,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC,iBAAiB,KAAK,CAAC,UAAU,IAAI,CAAC,CAAC;QAC7H,CAAC;QAED,MAAM,uBAAuB,GAAG;YAC9B,GAAG,iBAAiB;YACpB,QAAQ,EAAE,CAAC,YAAY,CAAC;YACxB,aAAa,EAAE,CAAC;YAChB,cAAc,EAAE,CAAC;YACjB,aAAa,EAAE,CAAC;SACjB,CAAC;QAEF,OAAO,iBAAiB,CAAC,uBAAuB,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACpE,CAAC;CACF;AAED,eAAe,wBAAwB,CAAC"}
@@ -1,28 +1,7 @@
1
1
  import { MCPTool } from "mcp-framework";
2
- import { z } from "zod";
3
- declare const gpfWfsGetFeaturesInputSchema: z.ZodObject<{
4
- typename: z.ZodString;
5
- property_names: z.ZodOptional<z.ZodString>;
6
- sort_by: z.ZodOptional<z.ZodString>;
7
- count: z.ZodOptional<z.ZodNumber>;
8
- cql_filter: z.ZodOptional<z.ZodString>;
9
- result_type: z.ZodOptional<z.ZodEnum<["results", "hits", "url"]>>;
10
- }, "strip", z.ZodTypeAny, {
11
- cql_filter?: string;
12
- typename?: string;
13
- property_names?: string;
14
- sort_by?: string;
15
- count?: number;
16
- result_type?: "results" | "hits" | "url";
17
- }, {
18
- cql_filter?: string;
19
- typename?: string;
20
- property_names?: string;
21
- sort_by?: string;
22
- count?: number;
23
- result_type?: "results" | "hits" | "url";
24
- }>;
25
- type GpfWfsGetFeaturesInput = z.infer<typeof gpfWfsGetFeaturesInputSchema>;
2
+ import type { Collection } from "@ignfab/gpf-schema-store";
3
+ import { type CompiledRequest } from "../helpers/wfs_internal/request.js";
4
+ import { type GpfWfsGetFeaturesInput } from "../helpers/wfs_internal/schema.js";
26
5
  declare class GpfWfsGetFeaturesTool extends MCPTool<GpfWfsGetFeaturesInput> {
27
6
  name: string;
28
7
  title: string;
@@ -33,28 +12,121 @@ declare class GpfWfsGetFeaturesTool extends MCPTool<GpfWfsGetFeaturesInput> {
33
12
  openWorldHint: boolean;
34
13
  };
35
14
  description: string;
36
- schema: z.ZodObject<{
37
- typename: z.ZodString;
38
- property_names: z.ZodOptional<z.ZodString>;
39
- sort_by: z.ZodOptional<z.ZodString>;
40
- count: z.ZodOptional<z.ZodNumber>;
41
- cql_filter: z.ZodOptional<z.ZodString>;
42
- result_type: z.ZodOptional<z.ZodEnum<["results", "hits", "url"]>>;
43
- }, "strip", z.ZodTypeAny, {
44
- cql_filter?: string;
15
+ schema: import("zod").ZodObject<{
16
+ typename: import("zod").ZodString;
17
+ limit: import("zod").ZodDefault<import("zod").ZodNumber>;
18
+ result_type: import("zod").ZodDefault<import("zod").ZodEnum<["results", "hits", "request"]>>;
19
+ select: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
20
+ order_by: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
21
+ property: import("zod").ZodString;
22
+ direction: import("zod").ZodDefault<import("zod").ZodEnum<["asc", "desc"]>>;
23
+ }, "strict", import("zod").ZodTypeAny, {
24
+ property?: string;
25
+ direction?: "asc" | "desc";
26
+ }, {
27
+ property?: string;
28
+ direction?: "asc" | "desc";
29
+ }>, "many">>;
30
+ where: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
31
+ property: import("zod").ZodString;
32
+ operator: import("zod").ZodEnum<["eq", "ne", "lt", "lte", "gt", "gte", "in", "is_null"]>;
33
+ value: import("zod").ZodOptional<import("zod").ZodString>;
34
+ values: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
35
+ }, "strict", import("zod").ZodTypeAny, {
36
+ values?: string[];
37
+ value?: string;
38
+ property?: string;
39
+ operator?: "gte" | "gt" | "lte" | "lt" | "eq" | "ne" | "in" | "is_null";
40
+ }, {
41
+ values?: string[];
42
+ value?: string;
43
+ property?: string;
44
+ operator?: "gte" | "gt" | "lte" | "lt" | "eq" | "ne" | "in" | "is_null";
45
+ }>, "many">>;
46
+ spatial_operator: import("zod").ZodOptional<import("zod").ZodEnum<["bbox", "intersects_point", "dwithin_point", "intersects_feature"]>>;
47
+ bbox_west: import("zod").ZodOptional<import("zod").ZodNumber>;
48
+ bbox_south: import("zod").ZodOptional<import("zod").ZodNumber>;
49
+ bbox_east: import("zod").ZodOptional<import("zod").ZodNumber>;
50
+ bbox_north: import("zod").ZodOptional<import("zod").ZodNumber>;
51
+ intersects_lon: import("zod").ZodOptional<import("zod").ZodNumber>;
52
+ intersects_lat: import("zod").ZodOptional<import("zod").ZodNumber>;
53
+ dwithin_lon: import("zod").ZodOptional<import("zod").ZodNumber>;
54
+ dwithin_lat: import("zod").ZodOptional<import("zod").ZodNumber>;
55
+ dwithin_distance_m: import("zod").ZodOptional<import("zod").ZodNumber>;
56
+ intersects_feature_typename: import("zod").ZodOptional<import("zod").ZodString>;
57
+ intersects_feature_id: import("zod").ZodOptional<import("zod").ZodString>;
58
+ }, "strict", import("zod").ZodTypeAny, {
45
59
  typename?: string;
46
- property_names?: string;
47
- sort_by?: string;
48
- count?: number;
49
- result_type?: "results" | "hits" | "url";
60
+ limit?: number;
61
+ result_type?: "request" | "results" | "hits";
62
+ select?: string[];
63
+ order_by?: {
64
+ property?: string;
65
+ direction?: "asc" | "desc";
66
+ }[];
67
+ where?: {
68
+ values?: string[];
69
+ value?: string;
70
+ property?: string;
71
+ operator?: "gte" | "gt" | "lte" | "lt" | "eq" | "ne" | "in" | "is_null";
72
+ }[];
73
+ spatial_operator?: "bbox" | "intersects_point" | "dwithin_point" | "intersects_feature";
74
+ bbox_west?: number;
75
+ bbox_south?: number;
76
+ bbox_east?: number;
77
+ bbox_north?: number;
78
+ intersects_lon?: number;
79
+ intersects_lat?: number;
80
+ dwithin_lon?: number;
81
+ dwithin_lat?: number;
82
+ dwithin_distance_m?: number;
83
+ intersects_feature_typename?: string;
84
+ intersects_feature_id?: string;
50
85
  }, {
51
- cql_filter?: string;
52
86
  typename?: string;
53
- property_names?: string;
54
- sort_by?: string;
55
- count?: number;
56
- result_type?: "results" | "hits" | "url";
87
+ limit?: number;
88
+ result_type?: "request" | "results" | "hits";
89
+ select?: string[];
90
+ order_by?: {
91
+ property?: string;
92
+ direction?: "asc" | "desc";
93
+ }[];
94
+ where?: {
95
+ values?: string[];
96
+ value?: string;
97
+ property?: string;
98
+ operator?: "gte" | "gt" | "lte" | "lt" | "eq" | "ne" | "in" | "is_null";
99
+ }[];
100
+ spatial_operator?: "bbox" | "intersects_point" | "dwithin_point" | "intersects_feature";
101
+ bbox_west?: number;
102
+ bbox_south?: number;
103
+ bbox_east?: number;
104
+ bbox_north?: number;
105
+ intersects_lon?: number;
106
+ intersects_lat?: number;
107
+ dwithin_lon?: number;
108
+ dwithin_lat?: number;
109
+ dwithin_distance_m?: number;
110
+ intersects_feature_typename?: string;
111
+ intersects_feature_id?: string;
57
112
  }>;
113
+ /**
114
+ * Exposes an input schema variant that stays compatible with most MCP integrations.
115
+ *
116
+ * @returns The published input schema exposed through the MCP tool definition.
117
+ */
118
+ get inputSchema(): {
119
+ type: "object";
120
+ properties?: Record<string, object>;
121
+ required?: string[];
122
+ };
123
+ /**
124
+ * Formats compact responses (`hits`, `request`) into `structuredContent`.
125
+ * Full result sets are still delegated to the framework default behavior.
126
+ *
127
+ * @param data Raw execution result returned by the tool implementation.
128
+ * @returns An MCP success response, optionally enriched with structured content.
129
+ */
58
130
  protected createSuccessResponse(data: unknown): import("mcp-framework").ToolResponse | {
59
131
  content: {
60
132
  type: "text";
@@ -70,10 +142,55 @@ declare class GpfWfsGetFeaturesTool extends MCPTool<GpfWfsGetFeaturesInput> {
70
142
  text: string;
71
143
  }[];
72
144
  structuredContent: {
145
+ body?: string;
146
+ result_type?: "request";
147
+ method?: "POST";
73
148
  url?: string;
74
- result_type?: "url";
149
+ query?: Record<string, string>;
150
+ get_url?: string;
75
151
  };
76
152
  };
77
- execute(input: GpfWfsGetFeaturesInput): Promise<any>;
153
+ /**
154
+ * Loads a WFS feature type description from the embedded catalog.
155
+ *
156
+ * @param typename Exact WFS typename to load from the embedded schema store.
157
+ * @returns The matching feature type description.
158
+ */
159
+ protected getFeatureType(typename: string): Promise<Collection>;
160
+ /**
161
+ * Executes a compiled WFS request as POST and returns the JSON FeatureCollection.
162
+ *
163
+ * @param request Compiled request split into query-string parameters and POST body.
164
+ * @returns The parsed JSON response returned by the WFS endpoint.
165
+ */
166
+ protected fetchFeatureCollection(request: CompiledRequest): Promise<any>;
167
+ /**
168
+ * Extracts a result count from a WFS response, preferring `numberMatched`.
169
+ * Explicitly rejects responses that do not provide a usable total.
170
+ *
171
+ * @param featureCollection Parsed WFS response object.
172
+ * @returns The total number of matching features.
173
+ */
174
+ protected getMatchedFeatureCount(featureCollection: Record<string, unknown>): number;
175
+ /**
176
+ * Resolves the geometry of a reference feature when `intersects_feature` is used,
177
+ * then converts it to EWKT for CQL compilation.
178
+ *
179
+ * @param input Normalized tool input.
180
+ * @returns The resolved reference geometry, or `undefined` when no reference feature is needed.
181
+ */
182
+ protected resolveIntersectsFeatureGeometry(input: GpfWfsGetFeaturesInput): Promise<{
183
+ typename: string;
184
+ feature_id: string;
185
+ geometry_ewkt: string;
186
+ }>;
187
+ /**
188
+ * Orchestrates the full tool execution flow:
189
+ * catalog lookup -> compilation -> WFS request -> response post-processing.
190
+ *
191
+ * @param input Normalized tool input.
192
+ * @returns Either a compiled request, a hit count, or a transformed FeatureCollection.
193
+ */
194
+ execute(input: GpfWfsGetFeaturesInput): Promise<Record<string, unknown>>;
78
195
  }
79
196
  export default GpfWfsGetFeaturesTool;