reunion_search_rge_companies
Locate RGE-certified companies in La Réunion, required for clients to qualify for energy-renovation state aids. Use free-text search or filter by commune and domain.
Instructions
Search companies certified RGE (Reconnu Garant de l'Environnement) in La Réunion. RGE certification is required for clients to qualify for state aids on energy-renovation work (MaPrimeRénov', éco-PTZ, CEE). Returns SIRET, company name, address, postal code, commune, phone, email, website, certification name, qualification, domain (insulation/heating/PV/...), meta-domain, certifying organization, lat/lon. Source: ADEME via data.regionreunion.com.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | Free-text search across company name, address, certification | |
| commune | No | Commune name prefix match | |
| domain | No | Specific domain prefix match. Examples: "Isolation", "Chauffage", "Photovoltaïque", "Eau chaude sanitaire", "Pompe à chaleur" | |
| limit | No | Max companies to return (1-100, default 25) |
Implementation Reference
- src/modules/environment.ts:95-138 (handler)The MCP tool handler for 'reunion_search_rge_companies'. Defines the tool with name, description, input schema (query, commune, domain, limit), and the async handler function that queries the OpenDataSoft API (dataset 'liste-des-entreprises-rge-2') and maps results to a structured JSON response with company fields (SIRET, name, address, commune, phone, email, website, certification, qualification, domain, meta-domain, lat/lon).
server.tool( 'reunion_search_rge_companies', 'Search companies certified RGE (Reconnu Garant de l\'Environnement) in La Réunion. RGE certification is required for clients to qualify for state aids on energy-renovation work (MaPrimeRénov\', éco-PTZ, CEE). Returns SIRET, company name, address, postal code, commune, phone, email, website, certification name, qualification, domain (insulation/heating/PV/...), meta-domain, certifying organization, lat/lon. Source: ADEME via data.regionreunion.com.', { query: z.string().optional().describe('Free-text search across company name, address, certification'), commune: z.string().optional().describe('Commune name prefix match'), domain: z.string().optional().describe('Specific domain prefix match. Examples: "Isolation", "Chauffage", "Photovoltaïque", "Eau chaude sanitaire", "Pompe à chaleur"'), limit: z.number().int().min(1).max(100).default(25).describe('Max companies to return (1-100, default 25)'), }, async ({ query, commune, domain, limit }) => { try { const data = await client.getRecords<RecordObject>(DATASET_RGE_COMPANIES, { where: buildWhere([ query ? `search(${quote(query)})` : undefined, commune ? `commune LIKE ${quote(`${commune}%`)}` : undefined, domain ? `domaine LIKE ${quote(`${domain}%`)}` : undefined, ]), limit, }); return jsonResult({ total_companies: data.total_count, companies: data.results.map((row) => ({ siret: pickString(row, ['siret']), name: pickString(row, ['nom_entreprise']), address: pickString(row, ['adresse']), postal_code: pickString(row, ['code_postal']), commune: pickString(row, ['commune']), phone: pickString(row, ['telephone']), email: pickString(row, ['email']), website: pickString(row, ['site_internet']), certification: pickString(row, ['nom_certificat']), qualification: pickString(row, ['nom_qualification']), domain: pickString(row, ['domaine']), meta_domain: pickString(row, ['meta_domaine']), organization: pickString(row, ['organisme']), lat: pickNumber(row, ['latitude']), lon: pickNumber(row, ['longitude']), })), }); } catch (error) { return errorResult(error instanceof Error ? error.message : 'Failed to search RGE companies'); } } ); - src/modules/environment.ts:98-103 (schema)Input schema for the tool: optional free-text query, optional commune prefix, optional domain prefix, and limit (1-100, default 25) defined using Zod.
{ query: z.string().optional().describe('Free-text search across company name, address, certification'), commune: z.string().optional().describe('Commune name prefix match'), domain: z.string().optional().describe('Specific domain prefix match. Examples: "Isolation", "Chauffage", "Photovoltaïque", "Eau chaude sanitaire", "Pompe à chaleur"'), limit: z.number().int().min(1).max(100).default(25).describe('Max companies to return (1-100, default 25)'), }, - src/modules/environment.ts:95-138 (registration)The tool is registered via McpServer.tool() in the registerEnvironmentTools function. This is called from src/modules/index.ts which is invoked from src/index.ts main().
server.tool( 'reunion_search_rge_companies', 'Search companies certified RGE (Reconnu Garant de l\'Environnement) in La Réunion. RGE certification is required for clients to qualify for state aids on energy-renovation work (MaPrimeRénov\', éco-PTZ, CEE). Returns SIRET, company name, address, postal code, commune, phone, email, website, certification name, qualification, domain (insulation/heating/PV/...), meta-domain, certifying organization, lat/lon. Source: ADEME via data.regionreunion.com.', { query: z.string().optional().describe('Free-text search across company name, address, certification'), commune: z.string().optional().describe('Commune name prefix match'), domain: z.string().optional().describe('Specific domain prefix match. Examples: "Isolation", "Chauffage", "Photovoltaïque", "Eau chaude sanitaire", "Pompe à chaleur"'), limit: z.number().int().min(1).max(100).default(25).describe('Max companies to return (1-100, default 25)'), }, async ({ query, commune, domain, limit }) => { try { const data = await client.getRecords<RecordObject>(DATASET_RGE_COMPANIES, { where: buildWhere([ query ? `search(${quote(query)})` : undefined, commune ? `commune LIKE ${quote(`${commune}%`)}` : undefined, domain ? `domaine LIKE ${quote(`${domain}%`)}` : undefined, ]), limit, }); return jsonResult({ total_companies: data.total_count, companies: data.results.map((row) => ({ siret: pickString(row, ['siret']), name: pickString(row, ['nom_entreprise']), address: pickString(row, ['adresse']), postal_code: pickString(row, ['code_postal']), commune: pickString(row, ['commune']), phone: pickString(row, ['telephone']), email: pickString(row, ['email']), website: pickString(row, ['site_internet']), certification: pickString(row, ['nom_certificat']), qualification: pickString(row, ['nom_qualification']), domain: pickString(row, ['domaine']), meta_domain: pickString(row, ['meta_domaine']), organization: pickString(row, ['organisme']), lat: pickNumber(row, ['latitude']), lon: pickNumber(row, ['longitude']), })), }); } catch (error) { return errorResult(error instanceof Error ? error.message : 'Failed to search RGE companies'); } } ); - src/utils/helpers.ts:36-41 (helper)Helper buildWhere used to construct the ODSQL WHERE clause from optional conditions (query, commune, domain).
export function buildWhere( conditions: Array<string | undefined | null | false> ): string | undefined { const valid = conditions.filter((condition): condition is string => Boolean(condition)); return valid.length > 0 ? valid.join(' AND ') : undefined; } - src/modules/environment.ts:11-16 (helper)Dataset ID constant DATASET_RGE_COMPANIES = 'liste-des-entreprises-rge-2' which points to the ADEME RGE companies dataset on data.regionreunion.com.
const DATASET_RGE_COMPANIES = 'liste-des-entreprises-rge-2'; const DATASET_ZNIEFF = 'zones-naturelles-d-interet-ecologique-faunistique-et-floristique-a-la-reunion'; const DATASET_PNRUN = 'pnrun_2021'; const DATASET_PETROLEUM = 'donnees-locales-de-consommation-de-produits-petroliers-a-la-reunion'; const DATASET_WATER_POIS = 'les-points-d-activite-ou-d-interet-la-gestion-des-eaux';