ign_get_cadastre_communes
Retrieve French commune boundaries from the cadastral database using INSEE codes, department codes, or geographic coordinates to support mapping and spatial analysis.
Instructions
Get commune (municipality) boundaries from the cadastral database.
Args:
geom (string, optional): GeoJSON geometry to intersect
code_insee (string, optional): INSEE commune code
code_dep (string, optional): Department code
_limit (number): Max results (default 500)
_start (number): Pagination offset
Returns: GeoJSON FeatureCollection with commune boundaries.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geom | No | GeoJSON geometry string, e.g. {"type":"Point","coordinates":[2.35,48.85]} | |
| code_insee | No | ||
| code_dep | No | ||
| _limit | No | Maximum number of results (1-1000) | |
| _start | No | Starting position for pagination | |
| response_format | No | Output format: 'markdown' for human-readable or 'json' for machine-readable | markdown |
Implementation Reference
- src/index.ts:225-242 (handler)Handler function that queries the cadastre commune API endpoint and formats the GeoJSON response as JSON or markdown.async (params) => { const { response_format, ...queryParams } = params; const data = await apiRequest<unknown>("/cadastre/commune", { params: queryParams as Record<string, string | number | boolean | undefined> }); if (response_format === ResponseFormat.JSON) { return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } const markdown = formatGeoJSONToMarkdown( data as import("./types.js").GeoJSONFeatureCollection, "Communes cadastrales" ); return { content: [{ type: "text", text: truncateResponse(markdown, CHARACTER_LIMIT) }], }; }
- src/index.ts:211-217 (schema)Zod input schema defining parameters: geom (optional GeoJSON), code_insee, code_dep, pagination (_limit, _start), response_format.inputSchema: z.object({ geom: GeometrySchema.optional(), code_insee: z.string().optional(), code_dep: z.string().optional(), ...PaginationSchema, response_format: ResponseFormatSchema, }).strict(),
- src/index.ts:196-243 (registration)Full registration of the ign_get_cadastre_communes tool including name, metadata, schema, annotations, and inline handler function.server.registerTool( "ign_get_cadastre_communes", { title: "Get cadastral commune boundaries", description: `Get commune (municipality) boundaries from the cadastral database. Args: - geom (string, optional): GeoJSON geometry to intersect - code_insee (string, optional): INSEE commune code - code_dep (string, optional): Department code - _limit (number): Max results (default 500) - _start (number): Pagination offset Returns: GeoJSON FeatureCollection with commune boundaries.`, inputSchema: z.object({ geom: GeometrySchema.optional(), code_insee: z.string().optional(), code_dep: z.string().optional(), ...PaginationSchema, response_format: ResponseFormatSchema, }).strict(), annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, }, async (params) => { const { response_format, ...queryParams } = params; const data = await apiRequest<unknown>("/cadastre/commune", { params: queryParams as Record<string, string | number | boolean | undefined> }); if (response_format === ResponseFormat.JSON) { return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } const markdown = formatGeoJSONToMarkdown( data as import("./types.js").GeoJSONFeatureCollection, "Communes cadastrales" ); return { content: [{ type: "text", text: truncateResponse(markdown, CHARACTER_LIMIT) }], }; } );