@ignfab/geocontext 0.8.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/LICENSE +21 -0
- package/README.md +195 -0
- package/dist/gpf/adminexpress.d.ts +15 -0
- package/dist/gpf/adminexpress.js +50 -0
- package/dist/gpf/adminexpress.js.map +1 -0
- package/dist/gpf/altitude.d.ts +16 -0
- package/dist/gpf/altitude.js +35 -0
- package/dist/gpf/altitude.js.map +1 -0
- package/dist/gpf/geocode.d.ts +10 -0
- package/dist/gpf/geocode.js +27 -0
- package/dist/gpf/geocode.js.map +1 -0
- package/dist/gpf/parcellaire-express.d.ts +12 -0
- package/dist/gpf/parcellaire-express.js +74 -0
- package/dist/gpf/parcellaire-express.js.map +1 -0
- package/dist/gpf/urbanisme.d.ts +18 -0
- package/dist/gpf/urbanisme.js +95 -0
- package/dist/gpf/urbanisme.js.map +1 -0
- package/dist/gpf/wfs.d.ts +22 -0
- package/dist/gpf/wfs.js +65 -0
- package/dist/gpf/wfs.js.map +1 -0
- package/dist/helpers/distance.d.ts +7 -0
- package/dist/helpers/distance.js +17 -0
- package/dist/helpers/distance.js.map +1 -0
- package/dist/helpers/http.d.ts +6 -0
- package/dist/helpers/http.js +24 -0
- package/dist/helpers/http.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +2 -0
- package/dist/logger.js +25 -0
- package/dist/logger.js.map +1 -0
- package/dist/tools/AdminexpressTool.d.ts +22 -0
- package/dist/tools/AdminexpressTool.js +23 -0
- package/dist/tools/AdminexpressTool.js.map +1 -0
- package/dist/tools/AltitudeTool.d.ts +27 -0
- package/dist/tools/AltitudeTool.js +24 -0
- package/dist/tools/AltitudeTool.js.map +1 -0
- package/dist/tools/AssietteSupTool.d.ts +22 -0
- package/dist/tools/AssietteSupTool.js +23 -0
- package/dist/tools/AssietteSupTool.js.map +1 -0
- package/dist/tools/CadastreTool.d.ts +22 -0
- package/dist/tools/CadastreTool.js +23 -0
- package/dist/tools/CadastreTool.js.map +1 -0
- package/dist/tools/GeocodeTool.d.ts +17 -0
- package/dist/tools/GeocodeTool.js +20 -0
- package/dist/tools/GeocodeTool.js.map +1 -0
- package/dist/tools/GpfWfsDescribeTypeTool.d.ts +32 -0
- package/dist/tools/GpfWfsDescribeTypeTool.js +32 -0
- package/dist/tools/GpfWfsDescribeTypeTool.js.map +1 -0
- package/dist/tools/GpfWfsGetFeaturesTool.d.ts +42 -0
- package/dist/tools/GpfWfsGetFeaturesTool.js +89 -0
- package/dist/tools/GpfWfsGetFeaturesTool.js.map +1 -0
- package/dist/tools/GpfWfsListTypesTool.d.ts +10 -0
- package/dist/tools/GpfWfsListTypesTool.js +18 -0
- package/dist/tools/GpfWfsListTypesTool.js.map +1 -0
- package/dist/tools/GpfWfsSearchTypesTool.d.ts +22 -0
- package/dist/tools/GpfWfsSearchTypesTool.js +31 -0
- package/dist/tools/GpfWfsSearchTypesTool.js.map +1 -0
- package/dist/tools/UrbanismeTool.d.ts +22 -0
- package/dist/tools/UrbanismeTool.js +23 -0
- package/dist/tools/UrbanismeTool.js.map +1 -0
- package/package.json +63 -0
package/dist/gpf/wfs.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const GPF_WFS_URL = "https://data.geopf.fr/wfs";
|
|
2
|
+
import { WfsEndpoint } from "@camptocamp/ogc-client";
|
|
3
|
+
import MiniSearch from 'minisearch';
|
|
4
|
+
export class FeatureTypeNotFoundError extends Error {
|
|
5
|
+
constructor(name) {
|
|
6
|
+
super(`Type '${name}' not found`);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export class FeatureTypeSearch {
|
|
10
|
+
featureTypes;
|
|
11
|
+
miniSearch;
|
|
12
|
+
constructor(featureTypes) {
|
|
13
|
+
this.featureTypes = featureTypes;
|
|
14
|
+
this.miniSearch = new MiniSearch({
|
|
15
|
+
idField: 'name',
|
|
16
|
+
fields: ['name', 'title', 'abstract'],
|
|
17
|
+
});
|
|
18
|
+
this.miniSearch.addAll(this.featureTypes);
|
|
19
|
+
}
|
|
20
|
+
search(query) {
|
|
21
|
+
return this.miniSearch.search(query, {
|
|
22
|
+
boost: { name: 3, title: 2 },
|
|
23
|
+
fuzzy: 0.2
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export class WfsClient {
|
|
28
|
+
baseUrl;
|
|
29
|
+
endpoint;
|
|
30
|
+
featureTypes = new Map();
|
|
31
|
+
featureTypeSearch;
|
|
32
|
+
constructor(baseUrl = GPF_WFS_URL) {
|
|
33
|
+
this.baseUrl = baseUrl;
|
|
34
|
+
this.endpoint = new WfsEndpoint(this.baseUrl);
|
|
35
|
+
}
|
|
36
|
+
async getFeatureTypes() {
|
|
37
|
+
await this.endpoint.isReady();
|
|
38
|
+
return this.endpoint.getFeatureTypes();
|
|
39
|
+
}
|
|
40
|
+
async searchFeatureTypes(query, maxResults = 20) {
|
|
41
|
+
await this.endpoint.isReady();
|
|
42
|
+
const featureTypes = await this.endpoint.getFeatureTypes();
|
|
43
|
+
if (!this.featureTypeSearch) {
|
|
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);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
async getFeatureType(name) {
|
|
52
|
+
await this.endpoint.isReady();
|
|
53
|
+
if (this.featureTypes.has(name)) {
|
|
54
|
+
return this.featureTypes.get(name);
|
|
55
|
+
}
|
|
56
|
+
const featureType = await this.endpoint.getFeatureTypeFull(name);
|
|
57
|
+
if (!featureType) {
|
|
58
|
+
throw new FeatureTypeNotFoundError(name);
|
|
59
|
+
}
|
|
60
|
+
this.featureTypes.set(name, featureType);
|
|
61
|
+
return featureType;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export const wfsClient = new WfsClient();
|
|
65
|
+
//# sourceMappingURL=wfs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wfs.js","sourceRoot":"","sources":["../../src/gpf/wfs.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import GeoJSONReader from 'jsts/org/locationtech/jts/io/GeoJSONReader.js';
|
|
2
|
+
import { DistanceOp } from 'jsts/org/locationtech/jts/operation/distance.js';
|
|
3
|
+
/**
|
|
4
|
+
* Compute approximative distance in km between gA and gB.
|
|
5
|
+
*
|
|
6
|
+
* @param {object} gA GeoJSON Point
|
|
7
|
+
* @param {object} gB GeoJSON Geometry
|
|
8
|
+
*/
|
|
9
|
+
export default function distance(gA, gB) {
|
|
10
|
+
const geojsonReader = new GeoJSONReader();
|
|
11
|
+
const a = geojsonReader.read(gA);
|
|
12
|
+
const b = geojsonReader.read(gB);
|
|
13
|
+
// converts to kilometers assuming earth is a sphere
|
|
14
|
+
const distanceInDegree = DistanceOp.distance(a, b);
|
|
15
|
+
return 6480.0 * (distanceInDegree * 2.0 * Math.PI / 360.0);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=distance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distance.js","sourceRoot":"","sources":["../../src/helpers/distance.js"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,+CAA+C,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAA;AAE5E;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,EAAE,EAAE;IACnC,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAA;IACzC,MAAM,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjC,MAAM,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEjC,oDAAoD;IACpD,MAAM,gBAAgB,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnD,OAAO,MAAM,GAAG,CAAE,gBAAgB,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,KAAK,CAAE,CAAE;AAClE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import fetch from 'node-fetch';
|
|
2
|
+
import logger from "../logger.js";
|
|
3
|
+
import { HttpsProxyAgent } from 'https-proxy-agent';
|
|
4
|
+
const fetchOpts = {
|
|
5
|
+
headers: new Headers({
|
|
6
|
+
"Accept": "application/json",
|
|
7
|
+
"User-Agent": "geocontext"
|
|
8
|
+
})
|
|
9
|
+
};
|
|
10
|
+
if (process.env.HTTP_PROXY) {
|
|
11
|
+
fetchOpts.agent = new HttpsProxyAgent(process.env.HTTP_PROXY);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {string} url
|
|
16
|
+
* @returns {Promise<any>}
|
|
17
|
+
*/
|
|
18
|
+
export async function fetchJSON(url) {
|
|
19
|
+
logger.info(`[HTTP] GET ${url} ...`);
|
|
20
|
+
const result = await fetch(url, fetchOpts).then(res => res.json());
|
|
21
|
+
logger.debug(`[HTTP] GET ${url} : ${JSON.stringify(result)}`);
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/helpers/http.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,SAAS,GAAG;IACd,OAAO,EAAE,IAAI,OAAO,CAAC;QACjB,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,YAAY;KAC7B,CAAC;CACL,CAAC;AAEF,IAAK,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IAC1B,SAAS,CAAC,KAAK,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAClE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAG;IAC/B,MAAM,CAAC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACnE,MAAM,CAAC,KAAK,CAAC,cAAc,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAC7D,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { MCPServer } from "mcp-framework";
|
|
3
|
+
import { dirname } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
// Get the directory of the current module (dist directory)
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
/**
|
|
8
|
+
* Available transports
|
|
9
|
+
*/
|
|
10
|
+
const TRANSPORTS = {
|
|
11
|
+
'stdio': {
|
|
12
|
+
type: "stdio"
|
|
13
|
+
},
|
|
14
|
+
'http': {
|
|
15
|
+
type: "http-stream",
|
|
16
|
+
options: {
|
|
17
|
+
port: 3000,
|
|
18
|
+
cors: {
|
|
19
|
+
allowOrigin: "*"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
async function main() {
|
|
25
|
+
// get transport type from environment variable
|
|
26
|
+
const TRANSPORT_TYPE = process.env.TRANSPORT_TYPE || "stdio";
|
|
27
|
+
if (TRANSPORT_TYPE !== "stdio" && TRANSPORT_TYPE !== "http") {
|
|
28
|
+
throw new Error(`Invalid transport type: ${TRANSPORT_TYPE}`);
|
|
29
|
+
}
|
|
30
|
+
// start MCP server
|
|
31
|
+
const mcpServer = new MCPServer({
|
|
32
|
+
basePath: __dirname,
|
|
33
|
+
transport: TRANSPORTS[TRANSPORT_TYPE],
|
|
34
|
+
});
|
|
35
|
+
await mcpServer.start();
|
|
36
|
+
}
|
|
37
|
+
main().catch((error) => {
|
|
38
|
+
console.error("Fatal error in main():", error);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,2DAA2D;AAC3D,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,GAAyB;IACvC,OAAO,EAAG;QACR,IAAI,EAAE,OAAO;KACd;IACD,MAAM,EAAG;QACP,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE;YACP,IAAI,EAAE,IAAI;YACV,IAAI,EAAE;gBACJ,WAAW,EAAE,GAAG;aACjB;SACF;KACF;CACF,CAAA;AAGD,KAAK,UAAU,IAAI;IACjB,+CAA+C;IAC/C,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,OAAO,CAAC;IAC7D,IAAK,cAAc,KAAK,OAAO,IAAI,cAAc,KAAK,MAAM,EAAE,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,2BAA2B,cAAc,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,mBAAmB;IACnB,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC;QAC9B,QAAQ,EAAE,SAAS;QACnB,SAAS,EAAE,UAAU,CAAC,cAAc,CAAC;KACtC,CAAC,CAAC;IACH,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/logger.d.ts
ADDED
package/dist/logger.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createLogger, format, transports } from 'winston';
|
|
2
|
+
const LOG_LEVEL = process.env.LOG_LEVEL ? process.env.LOG_LEVEL : 'debug';
|
|
3
|
+
const formats = {
|
|
4
|
+
json: format.json(),
|
|
5
|
+
simple: format.simple()
|
|
6
|
+
};
|
|
7
|
+
const LOG_FORMAT = process.env.LOG_FORMAT ? process.env.LOG_FORMAT : 'simple';
|
|
8
|
+
if (!Object.keys(formats).includes(LOG_FORMAT)) {
|
|
9
|
+
throw new Error(`LOG_FORMAT=${LOG_FORMAT} not found!`);
|
|
10
|
+
}
|
|
11
|
+
const logger = createLogger({
|
|
12
|
+
level: LOG_LEVEL,
|
|
13
|
+
format: formats[LOG_FORMAT],
|
|
14
|
+
transports: process.env.NODE_ENV != 'test' ? [
|
|
15
|
+
new transports.Console()
|
|
16
|
+
] : [
|
|
17
|
+
new transports.File({
|
|
18
|
+
filename: 'geocontext.log',
|
|
19
|
+
level: 'debug'
|
|
20
|
+
})
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
logger.info(`LOG_FORMAT=${LOG_FORMAT}, LOG_LEVEL=${LOG_LEVEL}`);
|
|
24
|
+
export default logger;
|
|
25
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE3D,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;AAE1E,MAAM,OAAO,GAAG;IACZ,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;CAC1B,CAAC;AACF,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC9E,IAAK,CAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;IAC/C,MAAM,IAAI,KAAK,CAAC,cAAc,UAAU,aAAa,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,MAAM,GAAG,YAAY,CAAC;IACxB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC;QACzC,IAAI,UAAU,CAAC,OAAO,EAAE;KAC3B,CAAC,CAAC,CAAC;QACA,IAAI,UAAU,CAAC,IAAI,CAAC;YAChB,QAAQ,EAAE,gBAAgB;YAC1B,KAAK,EAAE,OAAO;SACjB,CAAC;KACL;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,IAAI,CAAC,cAAc,UAAU,eAAe,SAAS,EAAE,CAAC,CAAC;AAChE,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
interface AdminexpressInput {
|
|
4
|
+
lon: number;
|
|
5
|
+
lat: number;
|
|
6
|
+
}
|
|
7
|
+
declare class AdminexpressTool extends MCPTool<AdminexpressInput> {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
schema: {
|
|
11
|
+
lon: {
|
|
12
|
+
type: z.ZodNumber;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
lat: {
|
|
16
|
+
type: z.ZodNumber;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
execute(input: AdminexpressInput): Promise<object[]>;
|
|
21
|
+
}
|
|
22
|
+
export default AdminexpressTool;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { logger, MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { getAdminUnits, ADMINEXPRESS_TYPES, ADMINEXPRESS_SOURCE } from "../gpf/adminexpress.js";
|
|
4
|
+
class AdminexpressTool extends MCPTool {
|
|
5
|
+
name = "adminexpress";
|
|
6
|
+
description = `Renvoie les unités administratives (${ADMINEXPRESS_TYPES.join(', ')}) pour une position donnée par sa longitude et sa latitude (source : ${ADMINEXPRESS_SOURCE}).`;
|
|
7
|
+
schema = {
|
|
8
|
+
lon: {
|
|
9
|
+
type: z.number(),
|
|
10
|
+
description: "La longitude du point",
|
|
11
|
+
},
|
|
12
|
+
lat: {
|
|
13
|
+
type: z.number(),
|
|
14
|
+
description: "La latitude du point",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
async execute(input) {
|
|
18
|
+
logger.info(`adminexpress(${input.lon},${input.lat})...`);
|
|
19
|
+
return getAdminUnits(input.lon, input.lat);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export default AdminexpressTool;
|
|
23
|
+
//# sourceMappingURL=AdminexpressTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminexpressTool.js","sourceRoot":"","sources":["../../src/tools/AdminexpressTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAOhG,MAAM,gBAAiB,SAAQ,OAA0B;IACvD,IAAI,GAAG,cAAc,CAAC;IACtB,WAAW,GAAG,uCAAuC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,wEAAwE,mBAAmB,IAAI,CAAC;IAElL,MAAM,GAAG;QACP,GAAG,EAAE;YACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,uBAAuB;SACrC;QACD,GAAG,EAAE;YACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,sBAAsB;SACpC;KACF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,KAAwB;QACpC,MAAM,CAAC,IAAI,CAAC,gBAAgB,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;QAC1D,OAAO,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
interface AltitudeInput {
|
|
4
|
+
lon: number;
|
|
5
|
+
lat: number;
|
|
6
|
+
}
|
|
7
|
+
declare class AltitudeTool extends MCPTool<AltitudeInput> {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
schema: {
|
|
11
|
+
lon: {
|
|
12
|
+
type: z.ZodNumber;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
lat: {
|
|
16
|
+
type: z.ZodNumber;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
execute(input: AltitudeInput): Promise<{
|
|
21
|
+
lon: number;
|
|
22
|
+
lat: number;
|
|
23
|
+
altitude: any;
|
|
24
|
+
accuracy: any;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
export default AltitudeTool;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { ALTITUDE_SOURCE, getAltitudeByLocation } from "../gpf/altitude.js";
|
|
4
|
+
import logger from "../logger.js";
|
|
5
|
+
class AltitudeTool extends MCPTool {
|
|
6
|
+
name = "altitude";
|
|
7
|
+
description = `Renvoie l'altitude pour une position donnée par sa longitude et sa latitude (source : ${ALTITUDE_SOURCE}).`;
|
|
8
|
+
schema = {
|
|
9
|
+
lon: {
|
|
10
|
+
type: z.number(),
|
|
11
|
+
description: "La longitude du point",
|
|
12
|
+
},
|
|
13
|
+
lat: {
|
|
14
|
+
type: z.number(),
|
|
15
|
+
description: "La latitude du point",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
async execute(input) {
|
|
19
|
+
logger.info(`altitude(${input.lon},${input.lat})...`);
|
|
20
|
+
return getAltitudeByLocation(input.lon, input.lat);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export default AltitudeTool;
|
|
24
|
+
//# sourceMappingURL=AltitudeTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AltitudeTool.js","sourceRoot":"","sources":["../../src/tools/AltitudeTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,MAAM,MAAM,cAAc,CAAC;AAOlC,MAAM,YAAa,SAAQ,OAAsB;IAC/C,IAAI,GAAG,UAAU,CAAC;IAClB,WAAW,GAAG,yFAAyF,eAAe,IAAI,CAAC;IAE3H,MAAM,GAAG;QACP,GAAG,EAAE;YACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,uBAAuB;SACrC;QACD,GAAG,EAAE;YACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,sBAAsB;SACpC;KACF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,KAAoB;QAChC,MAAM,CAAC,IAAI,CAAC,YAAY,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;QACtD,OAAO,qBAAqB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC;CACF;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
interface SupInput {
|
|
4
|
+
lon: number;
|
|
5
|
+
lat: number;
|
|
6
|
+
}
|
|
7
|
+
declare class AssietteSupTool extends MCPTool<SupInput> {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
schema: {
|
|
11
|
+
lon: {
|
|
12
|
+
type: z.ZodNumber;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
lat: {
|
|
16
|
+
type: z.ZodNumber;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
execute(input: SupInput): Promise<any>;
|
|
21
|
+
}
|
|
22
|
+
export default AssietteSupTool;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { logger, MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { getAssiettesServitudes, URBANISME_SOURCE } from "../gpf/urbanisme.js";
|
|
4
|
+
class AssietteSupTool extends MCPTool {
|
|
5
|
+
name = "assiette_sup";
|
|
6
|
+
description = `Renvoie les assiettes des servitudes d'utilité publique (SUP) pour une position donnée par sa longitude et sa latitude (source: ${URBANISME_SOURCE}).`;
|
|
7
|
+
schema = {
|
|
8
|
+
lon: {
|
|
9
|
+
type: z.number(),
|
|
10
|
+
description: "La longitude du point",
|
|
11
|
+
},
|
|
12
|
+
lat: {
|
|
13
|
+
type: z.number(),
|
|
14
|
+
description: "La latitude du point",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
async execute(input) {
|
|
18
|
+
logger.info(`assiette_sup(${input.lon},${input.lat})...`);
|
|
19
|
+
return getAssiettesServitudes(input.lon, input.lat);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export default AssietteSupTool;
|
|
23
|
+
//# sourceMappingURL=AssietteSupTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssietteSupTool.js","sourceRoot":"","sources":["../../src/tools/AssietteSupTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAO/E,MAAM,eAAgB,SAAQ,OAAiB;IAC7C,IAAI,GAAG,cAAc,CAAC;IACtB,WAAW,GAAG,mIAAmI,gBAAgB,IAAI,CAAC;IAEtK,MAAM,GAAG;QACP,GAAG,EAAE;YACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,uBAAuB;SACrC;QACD,GAAG,EAAE;YACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,sBAAsB;SACpC;KACF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,KAAe;QAC3B,MAAM,CAAC,IAAI,CAAC,gBAAgB,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;QAC1D,OAAO,sBAAsB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACtD,CAAC;CACF;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
interface CadastreInput {
|
|
4
|
+
lon: number;
|
|
5
|
+
lat: number;
|
|
6
|
+
}
|
|
7
|
+
declare class CadastreTool extends MCPTool<CadastreInput> {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
schema: {
|
|
11
|
+
lon: {
|
|
12
|
+
type: z.ZodNumber;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
lat: {
|
|
16
|
+
type: z.ZodNumber;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
execute(input: CadastreInput): Promise<array<object>>;
|
|
21
|
+
}
|
|
22
|
+
export default CadastreTool;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { logger, MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { getParcellaireExpress, PARCELLAIRE_EXPRESS_TYPES, PARCELLAIRE_EXPRESS_SOURCE } from "../gpf/parcellaire-express.js";
|
|
4
|
+
class CadastreTool extends MCPTool {
|
|
5
|
+
name = "cadastre";
|
|
6
|
+
description = `Renvoie les informations cadastrales (${PARCELLAIRE_EXPRESS_TYPES.join(', ')}) pour une position donnée par sa longitude et sa latitude (source :${PARCELLAIRE_EXPRESS_SOURCE}).`;
|
|
7
|
+
schema = {
|
|
8
|
+
lon: {
|
|
9
|
+
type: z.number(),
|
|
10
|
+
description: "La longitude du point",
|
|
11
|
+
},
|
|
12
|
+
lat: {
|
|
13
|
+
type: z.number(),
|
|
14
|
+
description: "La latitude du point",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
async execute(input) {
|
|
18
|
+
logger.info(`cadastre(${input.lon},${input.lat})...`);
|
|
19
|
+
return getParcellaireExpress(input.lon, input.lat);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export default CadastreTool;
|
|
23
|
+
//# sourceMappingURL=CadastreTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CadastreTool.js","sourceRoot":"","sources":["../../src/tools/CadastreTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAO7H,MAAM,YAAa,SAAQ,OAAsB;IAC/C,IAAI,GAAG,UAAU,CAAC;IAClB,WAAW,GAAG,yCAAyC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,uEAAuE,0BAA0B,IAAI,CAAC;IAEjM,MAAM,GAAG;QACP,GAAG,EAAE;YACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,uBAAuB;SACrC;QACD,GAAG,EAAE;YACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,sBAAsB;SACpC;KACF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,KAAoB;QAChC,MAAM,CAAC,IAAI,CAAC,YAAY,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;QACtD,OAAO,qBAAqB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC;CACF;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
interface GeocodeInput {
|
|
4
|
+
text: string;
|
|
5
|
+
}
|
|
6
|
+
declare class GeocodeTool extends MCPTool<GeocodeInput> {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
schema: {
|
|
10
|
+
text: {
|
|
11
|
+
type: z.ZodString;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
execute(input: GeocodeInput): Promise<any>;
|
|
16
|
+
}
|
|
17
|
+
export default GeocodeTool;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { geocode, GEOCODE_SOURCE } from "../gpf/geocode.js";
|
|
4
|
+
import logger from "../logger.js";
|
|
5
|
+
class GeocodeTool extends MCPTool {
|
|
6
|
+
name = "geocode";
|
|
7
|
+
description = `Renvoie les coordonnées (lon,lat) d'un lieu en complétant les informations (source : ${GEOCODE_SOURCE}).`;
|
|
8
|
+
schema = {
|
|
9
|
+
text: {
|
|
10
|
+
type: z.string(),
|
|
11
|
+
description: "Le texte devant être completé et géocodé",
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
async execute(input) {
|
|
15
|
+
logger.info(`geocode(${input.text})...`);
|
|
16
|
+
return geocode(input.text);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export default GeocodeTool;
|
|
20
|
+
//# sourceMappingURL=GeocodeTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeocodeTool.js","sourceRoot":"","sources":["../../src/tools/GeocodeTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,MAAM,MAAM,cAAc,CAAC;AAMlC,MAAM,WAAY,SAAQ,OAAqB;IAC7C,IAAI,GAAG,SAAS,CAAC;IACjB,WAAW,GAAG,wFAAwF,cAAc,IAAI,CAAC;IAEzH,MAAM,GAAG;QACP,IAAI,EAAE;YACJ,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,0CAA0C;SACxD;KACF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,KAAmB;QAC/B,MAAM,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,IAAI,MAAM,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
interface GpfWfsDescribeTypeInput {
|
|
4
|
+
typename: string;
|
|
5
|
+
}
|
|
6
|
+
declare class GpfWfsDescribeTypeTool extends MCPTool<GpfWfsDescribeTypeInput> {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
schema: {
|
|
10
|
+
typename: {
|
|
11
|
+
type: z.ZodString;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
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
|
+
} | {
|
|
27
|
+
type: string;
|
|
28
|
+
message: any;
|
|
29
|
+
help: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
export default GpfWfsDescribeTypeTool;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { wfsClient } from "../gpf/wfs.js";
|
|
4
|
+
class GpfWfsDescribeTypeTool extends MCPTool {
|
|
5
|
+
name = "gpf_wfs_describe_type";
|
|
6
|
+
description = [
|
|
7
|
+
"Renvoie la description détaillée d'un type WFS donné par son nom fourni par gpf_wfs_search_types.",
|
|
8
|
+
].join("\r\n");
|
|
9
|
+
schema = {
|
|
10
|
+
typename: {
|
|
11
|
+
type: z.string(),
|
|
12
|
+
description: "Le nom du type (ex : BDTOPO_V3:batiment)",
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
async execute(input) {
|
|
16
|
+
try {
|
|
17
|
+
const featureType = await wfsClient.getFeatureType(input.typename);
|
|
18
|
+
// remove useless fields outputFormats and otherCrs
|
|
19
|
+
const { outputFormats, otherCrs, ...result } = featureType;
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
return {
|
|
24
|
+
type: "error",
|
|
25
|
+
message: e.message,
|
|
26
|
+
help: `Utiliser gpf_get_feature_types pour trouver les types disponibles`
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export default GpfWfsDescribeTypeTool;
|
|
32
|
+
//# sourceMappingURL=GpfWfsDescribeTypeTool.js.map
|
|
@@ -0,0 +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,MAAM,WAAW,GAAG,MAAM,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACnE,mDAAmD;YACnD,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,WAAW,CAAC;YAC3D,OAAO,MAAM,CAAC;QAChB,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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
interface GpfWfsGetFeaturesInput {
|
|
4
|
+
typename: string;
|
|
5
|
+
property_names?: string;
|
|
6
|
+
count?: number;
|
|
7
|
+
sort_by?: string;
|
|
8
|
+
cql_filter?: string;
|
|
9
|
+
result_type?: 'results' | 'hits' | 'url';
|
|
10
|
+
}
|
|
11
|
+
declare class GpfWfsGetFeaturesTool extends MCPTool<GpfWfsGetFeaturesInput> {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
schema: {
|
|
15
|
+
typename: {
|
|
16
|
+
type: z.ZodString;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
property_names: {
|
|
20
|
+
type: z.ZodOptional<z.ZodString>;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
sort_by: {
|
|
24
|
+
type: z.ZodOptional<z.ZodString>;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
count: {
|
|
28
|
+
type: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
cql_filter: {
|
|
32
|
+
type: z.ZodOptional<z.ZodString>;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
result_type: {
|
|
36
|
+
type: z.ZodOptional<z.ZodEnum<["results", "hits", "url"]>>;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
execute(input: GpfWfsGetFeaturesInput): Promise<any>;
|
|
41
|
+
}
|
|
42
|
+
export default GpfWfsGetFeaturesTool;
|