Skip to main content
Glama

gpf_wfs_get_features

Retrieve geographic vector features from France's Géoplateforme WFS services to access spatial data like buildings, roads, or boundaries for mapping and analysis.

Instructions

Permet de récupérer les objets pour un type WFS.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typenameYesLe nom du type (ex : BDTOPO_V3:batiment). Important : Utiliser gpf_wfs_search_types pour trouver les types disponibles.
property_namesNoLa liste des propriétés séparées par des virgules (ex : "code_insee,nom_officiel,geometrie"). NB : adapter geometrie avec geometryName au niveau du type WFS.
sort_byNoTrier selon une propriété (syntaxe : field1 [A|D], field2 [A|D], ... , fieldN [A|D])
countNoLe nombre d'objets à récupérer (ex : 10)
cql_filterNoLe filtre au format cql_filter de GeoServer. ATTENTION : il faut permuter les coordonnées pour EPSG:4326 (ex : 'DWITHIN(geom,Point(${lat} ${lon}),10,meters)')
result_typeNoType de résultat : - 'results' pour les données complètes (défaut) - 'hits' pour le comptage uniquement - 'url' pour récupérer l'URL de la requête (ex : affichage des données côté client dans une carte)

Implementation Reference

  • Executes the tool logic by constructing a WFS GetFeature request with input parameters, fetching the GeoJSON response, handling special result types ('hits' for count, 'url' for link), and returning features or error.
    async execute(input: GpfWfsGetFeaturesInput) {
      const params : any = {
        service: 'WFS',
        request: 'GetFeature',
        typeName: input.typename,
        outputFormat: 'application/json'
      };
      
      // Only add optional parameters if they are defined
      if (input.cql_filter) {
        params.cql_filter = input.cql_filter;
      }
      if (input.count) {
        params.count = input.count;
      }
      if (input.sort_by) {
        params.sortBy = input.sort_by;
      }
      if (input.property_names && input.property_names.length > 0) {
        params.propertyName = input.property_names;
      }
    
      // Si result_type est 'hits', on utilise count=1 pour récupérer juste le totalFeatures
      if (input.result_type === 'hits') {
        params.count = 1;
        // On n'a pas besoin des propriétés détaillées pour un comptage
        delete params.propertyName;
      }
      
    
      const url = `${GPF_WFS_URL}?` + new URLSearchParams(params).toString();
      logger.info(`[gpf_wfs_get_features] ${url}`);
    
      if ( input.result_type === 'url' ) {
        return url;
      }
    
      try {
        const featureCollection = await fetchJSON(url);
        
        // Si result_type est 'hits', on retourne juste le comptage
        if (input.result_type === 'hits') {
          return featureCollection.totalFeatures;
        }
    
        return featureCollection;
      }catch(e){
        logger.error(`[gpf_wfs_get_features] ${e}`);
        return {
          type: "error",
          message: "Une erreur est survenue lors de la récupération des objets (utiliser gpf_wfs_describe_type pour lister les types disponibles avant d'appeler gpf_wfs_get_features)",
          details: `${e}`
        }
      }
    }
  • Defines the input schema using Zod validators for parameters: typename (required), property_names, sort_by, count, cql_filter, result_type.
    schema = {
      typename: {
        type: z.string(),
        description: "Le nom du type (ex : BDTOPO_V3:batiment). Important : Utiliser gpf_wfs_search_types pour trouver les types disponibles."
      },
      property_names: {
        type: z.string().optional(),
        description: 'La liste des propriétés séparées par des virgules (ex : "code_insee,nom_officiel,geometrie"). NB : adapter geometrie avec geometryName au niveau du type WFS. '
      },
      sort_by: {
        type: z.string().optional(),
        description: 'Trier selon une propriété (syntaxe : field1 [A|D], field2 [A|D], ... , fieldN [A|D])'
      },
      count: {
        type: z.number().optional(),
        description: "Le nombre d'objets à récupérer (ex : 10)"
      },
      cql_filter: {
        type: z.string().optional(),
        description: "Le filtre au format cql_filter de GeoServer. ATTENTION : il faut permuter les coordonnées pour EPSG:4326 (ex : 'DWITHIN(geom,Point(${lat} ${lon}),10,meters)')"
      },
      result_type: {
        type: z.enum(['results', 'hits', 'url']).optional(),
        description: [
          "Type de résultat : ",
          "- 'results' pour les données complètes (défaut)",
          "- 'hits' pour le comptage uniquement",
          "- 'url' pour récupérer l'URL de la requête (ex : affichage des données côté client dans une carte)"
        ].join("\r\n")
      }
    };
  • Class definition extending MCPTool, setting the tool name to 'gpf_wfs_get_features' and description, which registers it in the MCP framework.
    class GpfWfsGetFeaturesTool extends MCPTool<GpfWfsGetFeaturesInput> {
      name = "gpf_wfs_get_features";
      description = "Permet de récupérer les objets pour un type WFS.";
  • TypeScript interface defining the shape of the input for type safety.
    interface GpfWfsGetFeaturesInput {
      typename: string;
      property_names?: string;
      count?: number;
      sort_by?: string;
      cql_filter?: string;
      result_type?: 'results' | 'hits' | 'url';
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves objects but doesn't describe key behaviors: whether it's read-only or has side effects, authentication requirements, rate limits, pagination, error handling, or output format. The description is minimal and lacks essential context for safe and effective use.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in French that directly states the tool's purpose without unnecessary words. It's appropriately sized for a basic description, though it could be more informative. There's no fluff, making it front-loaded and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (6 parameters, no output schema, no annotations), the description is incomplete. It lacks details on behavioral traits, usage context, and output expectations. Without annotations or an output schema, the description should provide more context about what 'récupérer les objets' entails, but it falls short, leaving gaps for effective tool selection.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 6 parameters. The description adds no parameter-specific information beyond what's in the schema (e.g., it doesn't explain 'typename' or 'cql_filter' further). With high schema coverage, the baseline score is 3, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Permet de récupérer les objets pour un type WFS' clearly states the tool's purpose (retrieve objects for a WFS type) with a specific verb and resource. However, it doesn't distinguish this tool from its siblings like 'gpf_wfs_describe_type', 'gpf_wfs_list_types', or 'gpf_wfs_search_types', which also interact with WFS types. The purpose is understandable but lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., using 'gpf_wfs_search_types' to find available types, as noted in the schema), exclusions, or comparisons to sibling tools like 'gpf_wfs_describe_type'. Usage is implied through the action 'récupérer les objets', but no explicit context or alternatives are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ignfab/geocontext'

If you have feedback or need assistance with the MCP directory API, please join our Discord server