Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions docs/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,19 @@ Les niveaux 1 et 2 nécessitent un build à jour (`npm run build`) et un accès

### Vue d'ensemble des commandes

| Commande | Rôle |
| --------------------------- | --------------------------------------------------------------- |
| `npm run typecheck` | Type-check de l'application (`tsconfig.json`) |
| `npm run typecheck:test` | Type-check des fichiers de test (`tsconfig.test.json`) |
| `npm test` / `test:unit` | Tests unitaires |
| `npm run test:integration` | Tests d'intégration niveau 1 |
| `npm run test:e2e` | Tests E2E agent niveau 2 |
| `npm run test:coverage` | Tests unitaires avec couverture |
| `npm run bench` | Benchmark du calcul de `intersection_area` |
| `npm run verify:fast` | `typecheck` + `typecheck:test` + `build` + `test:unit` |
| `npm run verify` | `verify:fast` + `test:integration` |
| `npm run verify:full` | `verify` + `test:e2e` |
| Commande | Rôle |
| -------------------------- | -------------------------------------------------------------------- |
| `npm run typecheck` | Type-check de l'application (`tsconfig.json`) |
| `npm run typecheck:test` | Type-check des fichiers de test (`tsconfig.test.json`) |
| `npm test` / `test:unit` | Tests unitaires |
| `npm run test:perf` | Tests chronométrés (`*.perf.test.ts`), un fichier à la fois |
| `npm run test:integration` | Tests d'intégration niveau 1 |
| `npm run test:e2e` | Tests E2E agent niveau 2 |
| `npm run test:coverage` | Tests unitaires avec couverture |
| `npm run bench` | Benchmark du calcul de `intersection_area` |
| `npm run verify:fast` | `typecheck` + `typecheck:test` + `build` + `test:unit` + `test:perf` |
| `npm run verify` | `verify:fast` + `test:integration` |
| `npm run verify:full` | `verify` + `test:e2e` |

### Tests unitaires

Expand All @@ -143,6 +144,14 @@ npm run test:unit
npm test
```

### Tests chronométrés

Les tests qui mesurent un temps (`*.perf.test.ts`) tournent à part, un fichier à la fois, pour que les autres tests ne faussent pas la mesure. `verify:fast` les lance après les tests unitaires.

```bash
npm run test:perf
```

### Tests d'intégration (niveau 1)

```bash
Expand All @@ -166,7 +175,7 @@ npm run test:coverage
### Vérifications combinées

```bash
npm run verify:fast # typecheck + build + tests unitaires
npm run verify:fast # typecheck + build + tests unitaires et chronométrés
npm run verify # verify:fast + tests d'intégration niveau 1
npm run verify:full # verify + tests E2E niveau 2
```
Expand Down
130 changes: 130 additions & 0 deletions docs/mcp-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Annotations MCP exposées dans la définition `tools/list` de chaque tool :
- [`gpf_count_features`](#gpf_count_features)
- [`gpf_get_feature_by_id`](#gpf_get_feature_by_id)
- [`gpf_get_feature_by_id_layer`](#gpf_get_feature_by_id_layer)
- [`distance`](#distance)

## `geocode`

Expand Down Expand Up @@ -2212,3 +2213,132 @@ Cet outil ne peut renvoyer qu'un unique objet (0 ou plusieurs résultats provoqu
| --- | --- | --- | --- |
| Succès | oui | oui | `content[0].text` est `JSON.stringify(structuredContent)`. |
| Erreur | oui | non | `content[0].text` porte le message d'erreur ; aucun `structuredContent` n'est ajouté (réservé au `outputSchema` du cas de succès). |

## `distance`

Code Source : [src/tools/DistanceTool.ts](../src/tools/DistanceTool.ts)

### Titre

Distance entre deux points

### Description du tool

```
Renvoie la distance (en mètres) entre deux points à partir de leur longitude et latitude.
```

### Schéma d’entrée

| Champ | Type | Requis | Description |
| --- | --- | --- | --- |
| `arrival` | object | oui | Le point d'arrivée |
| `departure` | object | oui | Le point de départ |
| `profile` | string (enum) | non | Le type de chemin suivi : `spherical` distance à vol d'oiseau (Terre ronde, précision à 0.5%), `ellipsoidal` distance à vol d'oiseau (Terre ellipsoïde, plus précise, précision à 0.5cm). Valeurs : spherical, ellipsoidal. Valeur par défaut : spherical. |

<details>
<summary>Schéma d’entrée brut</summary>

```json
{
"type": "object",
"properties": {
"departure": {
"type": "object",
"properties": {
"lon": {
"type": "number",
"minimum": -180,
"maximum": 180,
"description": "La longitude du point de départ."
},
"lat": {
"type": "number",
"minimum": -90,
"maximum": 90,
"description": "La latitude du point de départ."
}
},
"required": [
"lon",
"lat"
],
"additionalProperties": false,
"description": "Le point de départ"
},
"arrival": {
"type": "object",
"properties": {
"lon": {
"type": "number",
"minimum": -180,
"maximum": 180,
"description": "La longitude du point d'arrivée."
},
"lat": {
"type": "number",
"minimum": -90,
"maximum": 90,
"description": "La latitude du point d'arrivée."
}
},
"required": [
"lon",
"lat"
],
"additionalProperties": false,
"description": "Le point d'arrivée"
},
"profile": {
"type": "string",
"enum": [
"spherical",
"ellipsoidal"
],
"default": "spherical",
"description": "Le type de chemin suivi : `spherical` distance à vol d'oiseau (Terre ronde, précision à 0.5%), `ellipsoidal` distance à vol d'oiseau (Terre ellipsoïde, plus précise, précision à 0.5cm)."
}
},
"required": [
"departure",
"arrival"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
```

</details>

### Schéma de sortie

| Champ | Type | Requis | Description |
| --- | --- | --- | --- |
| `distance` | number | oui | La distance entre les deux points, en mètres. |

<details>
<summary>Schéma de sortie brut</summary>

```json
{
"type": "object",
"properties": {
"distance": {
"type": "number",
"description": "La distance entre les deux points, en mètres."
}
},
"required": [
"distance"
]
}
```

</details>

### Réponse MCP

| Cas | `content` | `structuredContent` | Relation entre `content` et `structuredContent` |
| --- | --- | --- | --- |
| Succès | oui | oui | `content[0].text` est `JSON.stringify(structuredContent)`. |
| Erreur | oui | non | `content[0].text` porte le message d'erreur ; aucun `structuredContent` n'est ajouté (réservé au `outputSchema` du cas de succès). |
60 changes: 51 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@
"start": "node --use-env-proxy dist/index.js",
"test": "npm run test:unit",
"test:unit": "vitest run",
"test:perf": "vitest run --config vitest.perf.config.mts",
"test:integration": "vitest run --config vitest.integration.config.mts",
"test:e2e": "vitest run --config vitest.e2e.config.mts",
"test:coverage": "vitest run --coverage",
"bench": "vitest bench --run --reporter=verbose",
"verify:fast": "npm run typecheck && npm run typecheck:test && npm run build && npm run test:unit",
"verify:fast": "npm run typecheck && npm run typecheck:test && npm run build && npm run test:unit && npm run test:perf",
"verify": "npm run verify:fast && npm run test:integration",
"verify:full": "npm run verify && npm run test:e2e",
"fresh": "npm run reset:local && npm ci && npm run verify",
Expand All @@ -62,10 +63,11 @@
"@turf/bbox-polygon": "^7.4.0",
"@turf/centroid": "^7.4.0",
"@turf/circle": "^7.4.0",
"@turf/distance": "^7.4.0",
"@turf/helpers": "^7.4.0",
"@turf/length": "^7.4.0",
"@turf/midpoint": "^7.4.0",
"earcut": "^3.2.4",
"geographiclib-geodesic": "^2.2.0",
"jsts": "^2.12.1",
"mcp-framework": "^0.2.22",
"node-fetch": "^3.3.2",
Expand Down
2 changes: 1 addition & 1 deletion src/gpf/parcellaire-express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export async function getParcellaireExpress(lon: number, lat: number): Promise<P
const { _rawGeometry, ...rest } = item;
return {
...rest,
distance: distance(sourceGeom, _rawGeometry as Geometry),
distance: distance(sourceGeom, _rawGeometry as Geometry).distance,
source: PARCELLAIRE_EXPRESS_SOURCE,
};
});
Expand Down
4 changes: 2 additions & 2 deletions src/gpf/urbanisme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export async function getUrbanisme(lon: number, lat: number): Promise<Record<str
const { _rawGeometry, ...rest } = item;
const urbanismeItem: UrbanismeItem = {
...rest,
distance: distance(sourceGeom, _rawGeometry as Geometry),
distance: distance(sourceGeom, _rawGeometry as Geometry).distance,
};
return sanitizeUrbanismeItem(urbanismeItem);
});
Expand Down Expand Up @@ -148,7 +148,7 @@ export async function getAssiettesServitudes(lon: number, lat: number): Promise<
const { _rawGeometry, ...rest } = item;
return {
...rest,
distance: distance(sourceGeom, _rawGeometry as Geometry),
distance: distance(sourceGeom, _rawGeometry as Geometry).distance,
};
});
}
Loading
Loading