reunion_search_public_facilities
Search the official inventory of public facilities in La Réunion for shops, education, health, transport, and more. Use for accessibility analysis, market studies, or urban planning.
Instructions
Search the INSEE Base Permanente des Équipements (BPE) for La Réunion. BPE is the reference inventory of facilities providing services to the public: shops (commerces), education, health, social services, transport, sports, tourism, public administration. Each row is one geocoded equipment with INSEE category code. Returns equipment name and code, category, commune, EPCI, year, geocoding quality. Use this for accessibility/coverage analysis, market studies, urban planning.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Equipment category prefix match. Examples: "Services aux particuliers", "Commerce", "Enseignement", "Santé", "Sports, loisirs et culture", "Transports et tourisme" | |
| commune | No | Commune name prefix match | |
| equipment_name | No | Free-text search on the equipment name | |
| limit | No | Max equipments to return (1-500, default 50) |
Implementation Reference
- src/modules/facilities.ts:14-49 (handler)Handler function for 'reunion_search_public_facilities' tool. Executes the search logic: builds a WHERE clause from optional filters (category, commune, equipment_name), queries the 'base-permanente-des-equipements-geolocalisee-la-reunion' dataset via the ReunionClient, maps results to a structured response (name, code, category, commune, epci, year, geo_quality), and returns JSON or an error.
server.tool( 'reunion_search_public_facilities', 'Search the INSEE Base Permanente des Équipements (BPE) for La Réunion. BPE is the reference inventory of facilities providing services to the public: shops (commerces), education, health, social services, transport, sports, tourism, public administration. Each row is one geocoded equipment with INSEE category code. Returns equipment name and code, category, commune, EPCI, year, geocoding quality. Use this for accessibility/coverage analysis, market studies, urban planning.', { category: z.string().optional().describe('Equipment category prefix match. Examples: "Services aux particuliers", "Commerce", "Enseignement", "Santé", "Sports, loisirs et culture", "Transports et tourisme"'), commune: z.string().optional().describe('Commune name prefix match'), equipment_name: z.string().optional().describe('Free-text search on the equipment name'), limit: z.number().int().min(1).max(500).default(50).describe('Max equipments to return (1-500, default 50)'), }, async ({ category, commune, equipment_name, limit }) => { try { const data = await client.getRecords<RecordObject>(DATASET_BPE, { where: buildWhere([ category ? `category LIKE ${quote(`${category}%`)}` : undefined, commune ? `com_arm_name LIKE ${quote(`${commune}%`)}` : undefined, equipment_name ? `search(${quote(equipment_name)})` : undefined, ]), limit, }); return jsonResult({ total_equipments: data.total_count, equipments: data.results.map((row) => ({ name: pickString(row, ['equipment_name']), code: pickString(row, ['equipment_code']), category: pickString(row, ['category']), commune: pickString(row, ['com_arm_name']), epci: pickString(row, ['epci_name']), year: pickString(row, ['year']), geo_quality: pickString(row, ['geocode_quality']), })), }); } catch (error) { return errorResult(error instanceof Error ? error.message : 'Failed to search facilities'); } } - src/modules/facilities.ts:17-22 (schema)Input schema for 'reunion_search_public_facilities'. Defines optional filters: category (string prefix), commune (string prefix), equipment_name (free-text), and limit (integer 1-500, default 50).
{ category: z.string().optional().describe('Equipment category prefix match. Examples: "Services aux particuliers", "Commerce", "Enseignement", "Santé", "Sports, loisirs et culture", "Transports et tourisme"'), commune: z.string().optional().describe('Commune name prefix match'), equipment_name: z.string().optional().describe('Free-text search on the equipment name'), limit: z.number().int().min(1).max(500).default(50).describe('Max equipments to return (1-500, default 50)'), }, - src/modules/facilities.ts:13-50 (registration)Registration of 'reunion_search_public_facilities' via server.tool() within registerFacilityTools(). The function registerFacilityTools is called from src/modules/index.ts (line 42) which is called from src/index.ts (line 22).
export function registerFacilityTools(server: McpServer): void { server.tool( 'reunion_search_public_facilities', 'Search the INSEE Base Permanente des Équipements (BPE) for La Réunion. BPE is the reference inventory of facilities providing services to the public: shops (commerces), education, health, social services, transport, sports, tourism, public administration. Each row is one geocoded equipment with INSEE category code. Returns equipment name and code, category, commune, EPCI, year, geocoding quality. Use this for accessibility/coverage analysis, market studies, urban planning.', { category: z.string().optional().describe('Equipment category prefix match. Examples: "Services aux particuliers", "Commerce", "Enseignement", "Santé", "Sports, loisirs et culture", "Transports et tourisme"'), commune: z.string().optional().describe('Commune name prefix match'), equipment_name: z.string().optional().describe('Free-text search on the equipment name'), limit: z.number().int().min(1).max(500).default(50).describe('Max equipments to return (1-500, default 50)'), }, async ({ category, commune, equipment_name, limit }) => { try { const data = await client.getRecords<RecordObject>(DATASET_BPE, { where: buildWhere([ category ? `category LIKE ${quote(`${category}%`)}` : undefined, commune ? `com_arm_name LIKE ${quote(`${commune}%`)}` : undefined, equipment_name ? `search(${quote(equipment_name)})` : undefined, ]), limit, }); return jsonResult({ total_equipments: data.total_count, equipments: data.results.map((row) => ({ name: pickString(row, ['equipment_name']), code: pickString(row, ['equipment_code']), category: pickString(row, ['category']), commune: pickString(row, ['com_arm_name']), epci: pickString(row, ['epci_name']), year: pickString(row, ['year']), geo_quality: pickString(row, ['geocode_quality']), })), }); } catch (error) { return errorResult(error instanceof Error ? error.message : 'Failed to search facilities'); } } );