Skip to content

Redesign WFS querying with structured filters and reusable feature refs#38

Merged
esgn merged 8 commits intomasterfrom
33bis-get-features
Apr 11, 2026
Merged

Redesign WFS querying with structured filters and reusable feature refs#38
esgn merged 8 commits intomasterfrom
33bis-get-features

Conversation

@esgn
Copy link
Copy Markdown
Member

@esgn esgn commented Apr 10, 2026

⚠️ This PR will be actively reviewed and discussed until a consensus is met
⚠️ This PR includes breaking changes

Summary

This branch reworks the WFS querying surface to make it safer, more reusable, and easier for clients/LLMs to use without writing raw CQL manually.

Main changes

  • Rebuilt gpf_wfs_get_features around a structured query contract:
    • replaced the old free-form cql_filter, property_names, sort_by, count, and result_type="url" flow
    • added structured inputs such as select, where, order_by, and spatial_operator
    • added dedicated spatial parameters for bbox, intersects_point, dwithin_point, and intersects_feature
    • added result_type="request" to expose the compiled WFS request, including POST payload and a derived GET URL when possible
  • Added support for reusable WFS feature references:
    • gpf_wfs_get_features now returns feature_ref data on features
    • adminexpress, cadastre, urbanisme, and assiette_sup now expose reusable feature_ref values when available
    • intersects_feature can use those references directly in later WFS queries
  • Split the WFS feature fetching logic into smaller focused modules:
    • query compilation
    • request building
    • response transformation
  • Improved validation and schema publication:
    • introduced shared schemas for coordinates and reusable feature_ref
    • added JSON schema publishing helpers for stricter MCP input schemas
    • validated MiniSearch WFS search options with Zod instead of custom parsing
  • Refactored shared WFS/HTTP helpers:
    • added generic WFS helpers for object-oriented tools
    • added POST JSON fetching support for compiled WFS requests
  • Simplified the public WFS surface:
    • removed the deprecated gpf_wfs_list_types tool
    • removed the wfs-cql-filter resource/cheatsheet now that queries are structured instead of raw CQL-driven
  • Updated documentation and build/dependency setup:
    • README now documents the new gpf_wfs_get_features contract and reusable feature_ref workflow
    • removed the unused @camptocamp/ogc-client dependency
    • simplified the build by removing resource-copying for deleted WFS resource content

esgn added 4 commits April 9, 2026 20:17
- redesign `gpf_wfs_get_features` around a structured input schema with `select`, `where`, `order_by` and dedicated spatial operators
- compile WFS requests as POST calls, add a `request` result mode, and support `intersects_feature` through reusable `feature_ref` values
- expose `feature_ref` metadata in `adminexpress`, `cadastre`, `urbanisme` and `assiette_sup` results
- split the WFS get-features logic and tests into dedicated modules and add JSON schema publishing helpers
- remove the obsolete `gpf_wfs_list_types` tool and the old CQL filter resource
- update the README, tests and build script to match the new WFS workflow
@esgn esgn requested a review from mborne April 10, 2026 09:15
Copy link
Copy Markdown
Contributor

@mborne mborne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved (even if logs might come back in the futur to watch tool invocation for #15 )

.array(orderBySchema)
.min(1)
.optional()
.describe("Liste ordonnée des critères de tri."),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes :

  • turned array to string by the past to avoid problems with some agents / models
  • syntax for ASC / DSC removed

dwithin_lon: longitudeSchema("Longitude du point en WGS84 `lon/lat`, utilisée avec `spatial_operator = \"dwithin_point\"`.").optional(),
dwithin_lat: latitudeSchema("Latitude du point en WGS84 `lon/lat`, utilisée avec `spatial_operator = \"dwithin_point\"`.").optional(),
dwithin_distance_m: z.number().finite().positive().describe("Distance en mètres, utilisée avec `spatial_operator = \"dwithin_point\"`.").optional(),
intersects_feature_typename: z.string().trim().min(1).optional().describe("Type WFS du feature de référence, utilisé avec `spatial_operator = \"intersects_feature\"`."),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brillant!

Comment thread src/tools/AssietteSupTool.ts
@esgn esgn merged commit 65743f4 into master Apr 11, 2026
2 checks passed
@esgn esgn deleted the 33bis-get-features branch April 11, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants