reunion_list_cantons
List electoral cantons of La Réunion with details like code, name, type, and polling bureau for departmental election analysis.
Instructions
List the electoral cantons of La Réunion (used for departmental elections, "élections cantonales/départementales"). Each canton elects a binôme (2 conseillers départementaux). Returns canton code, name, current code (handles redistricting), type, department, region, central polling-bureau, year reference. Useful for electoral analysis, conseil départemental research.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max cantons to return (1-100, default 50) |
Implementation Reference
- src/modules/geography.ts:130-156 (handler)The tool 'reunion_list_cantons' is defined via server.tool(). The handler function (lines 136-155) calls client.getRecords with DATASET_CANTONS ('cantons-millesime-france'), maps results extracting fields like can_code, can_name, can_current_code, can_type, dep_name, reg_name, can_burcentral, and year, and returns JSON with total_cantons and cantons array.
server.tool( 'reunion_list_cantons', 'List the electoral cantons of La Réunion (used for departmental elections, "élections cantonales/départementales"). Each canton elects a binôme (2 conseillers départementaux). Returns canton code, name, current code (handles redistricting), type, department, region, central polling-bureau, year reference. Useful for electoral analysis, conseil départemental research.', { limit: z.number().int().min(1).max(100).default(50).describe('Max cantons to return (1-100, default 50)'), }, async ({ limit }) => { try { const data = await client.getRecords<RecordObject>(DATASET_CANTONS, { limit }); return jsonResult({ total_cantons: data.total_count, cantons: data.results.map((row) => ({ code: pickString(row, ['can_code']), name: pickString(row, ['can_name']), current_code: pickString(row, ['can_current_code']), type: pickString(row, ['can_type']), department: pickString(row, ['dep_name']), region: pickString(row, ['reg_name']), central_bureau: pickString(row, ['can_burcentral']), year: pickString(row, ['year']), })), }); } catch (error) { return errorResult(error instanceof Error ? error.message : 'Failed to list cantons'); } } ); - src/modules/geography.ts:133-135 (schema)Input schema for 'reunion_list_cantons' — accepts a single optional 'limit' parameter (integer, 1-100, default 50) validated with Zod.
{ limit: z.number().int().min(1).max(100).default(50).describe('Max cantons to return (1-100, default 50)'), }, - src/modules/geography.ts:12-12 (helper)Constant DATASET_CANTONS = 'cantons-millesime-france' is the dataset identifier used by the handler to query the OpenDataSoft API.
const DATASET_CANTONS = 'cantons-millesime-france'; - src/modules/geography.ts:17-17 (registration)The function registerGeographyTools is exported and called from src/modules/index.ts line 43, which registers this tool (and others) with the MCP server.
export function registerGeographyTools(server: McpServer): void {