Skip to main content
Glama
Hug0x0

mcp-reunion

reunion_get_legislative_2022_round1

Retrieve per-polling-station results of the June 12, 2022 legislative elections first round for La Réunion, including candidate votes, voter turnout, and abstentions. Filter by commune, circonscription, or polling station code.

Instructions

Per polling-station (bureau de vote) results of the June 12, 2022 legislative elections, 1st round, for La Réunion (7 circonscriptions). Each row is one candidate at one polling station, with: commune, INSEE code, circonscription, polling station code/name, registered voters (inscrits), abstentions, voters, blank votes, null votes, expressed votes, candidate panel number, last name, first name, sex, political nuance, votes, vote share of expressed. Sorted by vote count descending. For round 2 use reunion_get_legislative_2022_round2.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
communeNoCommune name prefix match (e.g. "Saint-Denis")
circumscriptionNoCirconscription label prefix match (e.g. "1ère circonscription de La Réunion")
polling_stationNoExact polling-station code (bureau de vote), e.g. "0001"
limitNoMax rows to return (1-500, default 100)

Implementation Reference

  • Tool registration for 'reunion_get_legislative_2022_round1' — defined via server.tool() within registerAdministrationTools()
    server.tool(
      'reunion_get_legislative_2022_round1',
      'Per polling-station (bureau de vote) results of the June 12, 2022 legislative elections, 1st round, for La Réunion (7 circonscriptions). Each row is one candidate at one polling station, with: commune, INSEE code, circonscription, polling station code/name, registered voters (inscrits), abstentions, voters, blank votes, null votes, expressed votes, candidate panel number, last name, first name, sex, political nuance, votes, vote share of expressed. Sorted by vote count descending. For round 2 use reunion_get_legislative_2022_round2.',
      {
        commune: z.string().optional().describe('Commune name prefix match (e.g. "Saint-Denis")'),
        circumscription: z.string().optional().describe('Circonscription label prefix match (e.g. "1ère circonscription de La Réunion")'),
        polling_station: z.string().optional().describe('Exact polling-station code (bureau de vote), e.g. "0001"'),
        limit: z.number().int().min(1).max(500).default(100).describe('Max rows to return (1-500, default 100)'),
      },
      async ({ commune, circumscription, polling_station, limit }) => {
        try {
          const data = await client.getRecords<RecordObject>(DATASET_LEGIS_2022_T1, {
            where: buildWhere([
              commune ? `com_name LIKE ${quote(`${commune}%`)}` : undefined,
              circumscription ? `libelle_de_la_circonscription LIKE ${quote(`${circumscription}%`)}` : undefined,
              polling_station ? `code_du_b_vote = ${quote(polling_station)}` : undefined,
            ]),
            order_by: 'voix DESC',
            limit,
          });
          return jsonResult({
            total_rows: data.total_count,
            results: data.results.map((row) => ({
              commune: pickString(row, ['com_name']),
              commune_code: pickString(row, ['com_code']),
              circumscription: pickString(row, ['libelle_de_la_circonscription']),
              polling_station_code: pickString(row, ['code_du_b_vote']),
              polling_station_name: pickString(row, ['lib_du_b_vote']),
              registered: pickNumber(row, ['inscrits']),
              abstentions: pickNumber(row, ['abstentions']),
              voters: pickNumber(row, ['votants']),
              blank: pickNumber(row, ['blancs']),
              null_votes: pickNumber(row, ['nuls']),
              expressed: pickNumber(row, ['exprimes']),
              panel_num: pickNumber(row, ['ndegpanneau']),
              candidate_last_name: pickString(row, ['nom']),
              candidate_first_name: pickString(row, ['prenom']),
              candidate_sex: pickString(row, ['sexe']),
              political_label: pickString(row, ['nuance']),
              votes: pickNumber(row, ['voix']),
              votes_pct_expressed: pickNumber(row, ['voix_exp']),
            })),
          });
        } catch (error) {
          return errorResult(error instanceof Error ? error.message : 'Failed to fetch legislative results');
        }
      }
    );
  • Handler function for reunion_get_legislative_2022_round1 — queries OpenDataSoft dataset DATASET_LEGIS_2022_T1 with filters on commune, circumscription, polling_station, returns mapped results
    async ({ commune, circumscription, polling_station, limit }) => {
      try {
        const data = await client.getRecords<RecordObject>(DATASET_LEGIS_2022_T1, {
          where: buildWhere([
            commune ? `com_name LIKE ${quote(`${commune}%`)}` : undefined,
            circumscription ? `libelle_de_la_circonscription LIKE ${quote(`${circumscription}%`)}` : undefined,
            polling_station ? `code_du_b_vote = ${quote(polling_station)}` : undefined,
          ]),
          order_by: 'voix DESC',
          limit,
        });
        return jsonResult({
          total_rows: data.total_count,
          results: data.results.map((row) => ({
            commune: pickString(row, ['com_name']),
            commune_code: pickString(row, ['com_code']),
            circumscription: pickString(row, ['libelle_de_la_circonscription']),
            polling_station_code: pickString(row, ['code_du_b_vote']),
            polling_station_name: pickString(row, ['lib_du_b_vote']),
            registered: pickNumber(row, ['inscrits']),
            abstentions: pickNumber(row, ['abstentions']),
            voters: pickNumber(row, ['votants']),
            blank: pickNumber(row, ['blancs']),
            null_votes: pickNumber(row, ['nuls']),
            expressed: pickNumber(row, ['exprimes']),
            panel_num: pickNumber(row, ['ndegpanneau']),
            candidate_last_name: pickString(row, ['nom']),
            candidate_first_name: pickString(row, ['prenom']),
            candidate_sex: pickString(row, ['sexe']),
            political_label: pickString(row, ['nuance']),
            votes: pickNumber(row, ['voix']),
            votes_pct_expressed: pickNumber(row, ['voix_exp']),
          })),
        });
      } catch (error) {
        return errorResult(error instanceof Error ? error.message : 'Failed to fetch legislative results');
      }
    }
  • Zod schema for reunion_get_legislative_2022_round1 input parameters: commune, circumscription, polling_station (optional strings) and limit (int 1-500, default 100)
      commune: z.string().optional().describe('Commune name prefix match (e.g. "Saint-Denis")'),
      circumscription: z.string().optional().describe('Circonscription label prefix match (e.g. "1ère circonscription de La Réunion")'),
      polling_station: z.string().optional().describe('Exact polling-station code (bureau de vote), e.g. "0001"'),
      limit: z.number().int().min(1).max(500).default(100).describe('Max rows to return (1-500, default 100)'),
    },
  • Helper mapBallotRow function shared across election datasets (legis R1, legis R2, presidential R1) that maps raw API records to the standard output format
    function mapBallotRow(row: RecordObject) {
      return {
        commune: pickString(row, ['com_name']),
        commune_code: pickString(row, ['com_code']),
        circumscription: pickString(row, ['libelle_de_la_circonscription']),
        polling_station_code: pickString(row, ['code_du_b_vote']),
        polling_station_name: pickString(row, ['lib_du_b_vote']),
        registered: pickNumber(row, ['inscrits']),
        abstentions: pickNumber(row, ['abstentions']),
        voters: pickNumber(row, ['votants']),
        blank: pickNumber(row, ['blancs']),
        null_votes: pickNumber(row, ['nuls']),
        expressed: pickNumber(row, ['exprimes']),
        panel_num: pickNumber(row, ['ndegpanneau']),
        candidate_last_name: pickString(row, ['nom']),
        candidate_first_name: pickString(row, ['prenom']),
        candidate_sex: pickString(row, ['sexe']),
        political_label: pickString(row, ['nuance']),
        votes: pickNumber(row, ['voix']),
        votes_pct_expressed: pickNumber(row, ['voix_exp']),
      };
    }
  • Dataset constant DATASET_LEGIS_2022_T1 pointing to the OpenDataSoft dataset for legislative 2022 round 1 results
    const DATASET_LEGIS_2022_T1 =
      'resultats-des-elections-legislatives-2022-1er-tour-par-bureau-de-vote-a-la-reuni';
Behavior4/5

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

Despite no annotations, the description discloses the sorting order (descending by vote count) and the exact structure of each row. It does not mention data freshness or performance, but the key behavioral traits are communicated.

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 paragraph but front-loads the purpose and key details. It is informative without being verbose, though the dense list of fields could be slightly restructured for readability.

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

Completeness4/5

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

With no output schema, the description fully describes the output fields and sorting. It covers the election details and sibling reference. Missing error or pagination info, but acceptable for a data retrieval tool.

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 coverage is 100%, so baseline is 3. The description adds no additional meaning beyond what the schema provides for parameters; it focuses on output fields. This is adequate but not enhanced.

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

Purpose5/5

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

The description clearly states the tool returns per-polling-station results for a specific election (June 12, 2022 legislative, 1st round, La Réunion) and explicitly distinguishes from the round 2 sibling tool. The verb 'get' and resource 'legislative_2022_round1' are precise.

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

Usage Guidelines4/5

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

The description explains which election and round it covers and points to the sibling for round 2. However, it doesn't discuss when to use this tool versus other legislative tools (e.g., 2024 rounds) or any prerequisites.

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/Hug0x0/mcp-reunion'

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