Skip to main content
Glama
29N Elections MCP

29N Elections MCP

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
MCP_HOSTNoBind address in HTTP mode. Set `0.0.0.0` only to expose the server on purpose (for example, inside a container behind a reverse proxy): it has no authentication.127.0.0.1
MCP_PORTNoPort in HTTP mode. The endpoint path is `/mcp`.8000
MCP_TRANSPORTNo`stdio`, or `http` (also `streamable-http`) for Streamable HTTP.stdio
ELECCIONES29N_BASE_URLNoOrigin of the results website and its API. Also used to build the official page links.https://resultados.29neleccionesgenerales.com
ELECCIONES29N_USER_AGENTNoUser-Agent sent to the website. The website firewall rejects non-browser agents.A current desktop Chrome User-Agent

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

elecciones29n MCP — User Guide

Tools to query the official results of Spain's general election of 29 November 2026 (29N) for the Congreso de los Diputados and the Senado, as published by the Ministerio del Interior on its results website https://resultados.29neleccionesgenerales.com.

Exclusive Data Source Policy

  • Always use these tools for any 29N figure: turnout, polling stations, votes, percentages, seats, elected senators, winners by territory.

  • Never invent, estimate, extrapolate or "complete" numbers. Report only values returned by the tools. If a value is missing, say it is not published yet.

  • Never present figures from memory, web search or other servers as official 29N results.

  • If the tools fail, report the actual limitation (the error message tells you what to do next).


Query Flow

The server is stateless: chain the tools by passing the scope_id values they return.

  1. elecciones29n_get_status — call it first. It tells you the current phase, whether the provisional (pro) or definitive (def) data source is active, whether tally sheets are published, and any official alert. Its turnout_update number is only indicative (it can lag behind the data): report the turnout of turnout.latest_published from step 3.

  2. elecciones29n_search_scopes — find the territory the user asks about (country, region, province, island, municipality, municipal district, polling place with level=110...) by name or official territory code. Pass several spellings in one call (["Madrid", "Comunidad de Madrid"]). Use the returned scope_id.

  3. elecciones29n_get_scope_results — results for one scope_id: constitution of polling stations, turnout updates (with the 2023 comparison), and — once counting has started — vote totals, parties (votes, %, seats, change vs 2023) and, for the Senado, candidates. Use children_level (one of the scope's child_levels) to also get a compact summary of every child territory. During the count, constitution and turnout come from the election-day snapshot.

  4. elecciones29n_get_winners_map — the winning party (and its seats) of every child territory of a scope: e.g. the winner in each province of Spain. For the Senado, pass level="circunscripciones" on España to get every Senate constituency. Read winner_basis: official (marked by the website), inferred_leader (only leading so far), tie or not_started; say which one applies.

  5. elecciones29n_list_parties — candidacies of the 29N call (name, acronym, color), useful to resolve acronyms or check how a party is named.

  6. elecciones29n_get_polling_stations — the polling stations (mesas) of one polling place (level 110): their code, short label and whether each one has been counted.

  7. elecciones29n_get_tally_sheet — the tally sheet (acta) of one polling station, by its code. It returns metadata and a resource_uri; read that resource (elecciones29n://tally-sheet/{chamber}/{mesa_code}) to get the PDF. Only available when scrutiny_records_available is true. Do not transcribe figures from the PDF as results.


Key Concepts

Chambers

  • congreso (default): 350 deputies elected by province (plus Ceuta and Melilla).

  • senado: senators elected by province or island; results include individual candidates.

Scope identifiers

  • scope_id: 24-character hexadecimal identifier used by the API (España is 00000000000000000000000b). Always take it from elecciones29n_search_scopes, or from the children / parents lists of a previous result. Never build it yourself.

  • code: short official territory code shown to people (28 = province of Madrid, 28079 = city of Madrid).

  • level: 1 national, 20 autonomous community, 30 province, 70 island, 90 municipality, 100 municipal district, 110 polling place.

  • child_levels: the levels that can be requested as children of that scope (children_level in elecciones29n_get_scope_results, level in elecciones29n_get_winners_map).

  • is_constituency: whether the scope is an electoral constituency (circunscripción) of that chamber.

  • Polling station code (e.g. 2807903650A): municipality, district, section and letter. It is not a scope_id; take it from elecciones29n_get_polling_stations.

Phases (phase in the status)

  • 0 — constitution of polling stations (morning): how many polling stations opened.

  • 1 — voter turnout updates (14:00 and 18:00): participation so far, compared with 2023.

  • 2 — vote count (from 20:00): votes, percentages and seats as they are counted. Before phase 2 there are no vote counts: do not report party results.

Provisional vs definitive data

Every number exists in two versions: pro (provisional count on election night) and def (definitive count, published days later). By default (data_source="auto") the tools use the source the website marks as active. State which one you used (it is in source.data_source).

Previous election

Comparisons refer to the previous general election (call 07-23, 23 July 2023). The 2023 baseline is always the definitive count; the current figures and the deltas use the selected source.


Data Source and Attribution (MANDATORY)

Every result contains a source object. Always tell the user:

  • that the figures come from the Ministerio del Interior results website,

  • the official_url of the territory view,

  • the data source used (pro provisional / def definitive) and the phase,

  • the time the data was retrieved from the website (fetched_at) when the count is still in progress.

Every result also contains next_step: read it, it tells you what to do next.


Procedure if Information is Not Found

  1. Do not invent data or search the web.

  2. Retry the search with other spellings, the official name or the official territory code.

  3. If the data is not published yet (e.g. the count has not started), say so and give the current phase from elecciones29n_get_status.

  4. If it still cannot be found, answer literally: I cannot find this information in the official 29N results.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}

Tools

Functions exposed to the LLM to take actions

NameDescription
elecciones29n_get_statusA
Use this tool FIRST for any question about Spain's general election of 29 November 2026
(29N): turnout, polling stations, votes, seats, winners, elected senators. It tells you what
the Ministerio del Interior has published so far. Never answer such questions from memory.

WHEN TO USE IT:
At the start of every conversation about 29N results, and again later to know whether new
data (a new turnout update, the start of the count, definitive results) is available.

INPUT PARAMETERS (What it receives):
None.

WHAT IT RETURNS:
- phase / phase_label: 0 constitution of polling stations, 1 voter turnout updates,
  2 vote count (scrutiny). Party votes and seats exist only in phase 2.
- turnout_update: turnout update announced by the website configuration (1 = 14:00,
  2 = 18:00). It is only indicative: it can lag behind the published data. The latest
  turnout to report is 'turnout.latest_published' of 'elecciones29n_get_scope_results'.
- active_data_source: 'pro' (provisional, election night) or 'def' (definitive).
- is_open, polling_active, polling_interval_seconds: publication state of the website.
- alert: official alert message in Spanish, if one is active. Relay it to the user.
- versions: data versions announced by the website.
- next_step: what to call next.
- source: attribution (official website, URL, phase, fetch time). Always cite it.

OPERATING NOTES:
- The figures change during election night: re-check the status before reporting a final result.
- Then use 'elecciones29n_search_scopes' to find the territory the user asks about.
elecciones29n_search_scopesA
Use this tool to find the territory (scope) the user asks about: the whole country (España),
an autonomous community, a province, an island, a municipality, a municipal district or a
polling place. Every other results tool needs the 'scope_id' it returns.

WHEN TO USE IT:
After 'elecciones29n_get_status', whenever the user names a place, and to disambiguate
homonyms (e.g. Madrid the community, the province and the city).

INPUT PARAMETERS (What it receives):
- params.queries (list[str], 1-15 terms): names or official territory codes, searched in ONE call. Include
  alternative spellings and official names (e.g. ['Alicante', 'Alacant'], ['Gerona', 'Girona']).
  Matching ignores accents, case, articles and word order. Numeric terms match official territory codes.
- params.chamber ('congreso' default | 'senado'): the scope tree of that chamber.
- params.level (optional, number or name): 1 nacional, 20 comunidad, 30 provincia, 70 isla,
  90 municipio, 100 distrito, 110 local.
- params.limit (1-100, default 20).

WHAT IT RETURNS:
- scopes: matches ordered by exactness and level. Each has 'scope_id' (pass it to the other
  tools), 'code' (official territory code), 'name', 'level'/'level_label', 'parents' (enclosing territories
  from the country down), 'child_levels' (levels accepted as 'children_level' or winners map
  'level'), 'is_constituency' (electoral constituency of the chamber), 'matched_queries' and
  'official_url'.
- total_matches / truncated: refine the terms or add 'level' when truncated.
- next_step and source.

OPERATING NOTES:
- Read 'parents' to pick the right homonym; ask the user if it is still ambiguous.
- Polling places (level 110 'local') feed 'elecciones29n_get_polling_stations'.
- Never build a scope_id yourself.
elecciones29n_get_scope_resultsA
Use this tool to get the official 29N figures of ONE territory: polling stations constituted,
turnout updates compared with 2023 and, once counting has started, votes, percentages and
seats of every candidacy (and Senate candidates).

WHEN TO USE IT:
After 'elecciones29n_search_scopes' returned the scope_id of the territory the user asks about.

INPUT PARAMETERS (What it receives):
- params.scope_id (str, required): 24-hex scope_id from 'elecciones29n_search_scopes'.
- params.chamber ('congreso' default | 'senado'): must match the chamber used in the search.
- params.data_source ('auto' default | 'pro' | 'def'): provisional or definitive figures;
  'auto' uses the source the website marks as active.
- params.children_level (optional, number or name): also summarize every child territory of
  that level. It must be one of the scope 'child_levels'.
- params.children_limit (1-500, default 60).

WHAT IT RETURNS:
- scope: name, official territory code, level, census, polling stations, parents and child_levels.
- constitution: polling stations opened/suspended (absolute and %).
- turnout: turnout updates (time, votes, %), each with 'published' and the 2023 figure at the
  same time ('previous', with deltas). 'latest_published' is the one to report.
- count (phase 2): totals (votes, valid, blank, null, abstention, turnout), 'counted_pct',
  'seats_at_stake', 'parties' (code, acronym, name, color, votes, votes_pct, seats and the
  2023 counterpart with deltas), 'candidates' (Senado: votes and elected flag), 'previous'
  totals of 2023 and 'change_vs_previous'. 'started' is false until counting begins.
- children / children_total / children_truncated: per-child summary when 'children_level'
  was given: turnout, or count progress ('census_counted_pct' = share of the census counted,
  'polling_stations_counted_pct' = share of polling stations counted, when reported) and
  the leading party (only once the selected source has counted).
- next_step and source (cite it, including data_source and fetched_at = retrieval time).

OPERATING NOTES:
- Never report party results before phase 2 or while 'count.started' is false.
- While counting, always say which percentage has been counted and that figures are provisional.
- Report figures exactly as returned; do not round seats or invent missing values.
- During the count, constitution and turnout come from the day snapshot published under the
  Congreso (common to both chambers); the 2023 baseline is always the definitive count.
elecciones29n_get_winners_mapA
Use this tool to know which candidacy won (or leads) in EVERY child territory of a scope:
e.g. the winner in each province of Spain, or in each municipality of a province, with the
seats it obtained there and how much has been counted.

WHEN TO USE IT:
During or after the vote count (phase 2), for questions like "who won in each province",
"how many provinces did X win", or to draw a winners map.

INPUT PARAMETERS (What it receives):
- params.scope_id (str, required): parent territory from 'elecciones29n_search_scopes'
  (España is '00000000000000000000000b').
- params.chamber ('congreso' default | 'senado').
- params.level (number or name, required): level of the children, one of the scope
  'child_levels' (e.g. 30 'provincia' for España). For the Senado, 'circunscripciones' returns
  every Senate constituency (provinces and islands); it is only offered on España.
- params.data_source ('auto' default | 'pro' | 'def').
- params.limit (1-1000, default 200).

WHAT IT RETURNS:
- territories: per child: scope_id, code, name, 'count_started', 'winner_basis' ('official'
  winner marked by the website, 'inferred_leader' computed from seats then votes, 'tie' or
  'not_started'), 'winner' (code, acronym, name, color, votes, votes_pct, seats; null while
  not started or tied), 'official_winner', 'inferred_leader', 'winner_seats',
  'seats_at_stake', 'census_counted_pct', 'turnout_pct' and the reported ties.
- tally: territories won and seats per candidacy, most territories first (ties excluded).
- count_started, total, truncated, next_step and source.

OPERATING NOTES:
- Before phase 2 it returns no territories and explains why: winners do not exist until
  votes are counted. Never infer winners from turnout.
- Seats in 'tally' are the seats won by each territory's winner only, not each party's total:
  use 'elecciones29n_get_scope_results' on the parent scope for national seat totals.
elecciones29n_list_partiesA
Use this tool to list the candidacies (parties and coalitions) of the 29N call with their
official name, acronym and color, or to resolve how a party appears in the results.

WHEN TO USE IT:
When the user asks which parties run, or uses a name/acronym you need to match with the
'code' or 'acronym' of the results.

INPUT PARAMETERS (What it receives):
- params.chamber ('congreso' default | 'senado'): candidacies differ between chambers.
- params.query (optional str): words matched against name and acronym, ignoring accents and
  case (e.g. 'psoe', 'sumar', 'compromis').

WHAT IT RETURNS:
- parties: code, acronym, name, color and group (agrupación) of each candidacy.
- total, call ('11-26'), next_step and source.

OPERATING NOTES:
- Candidacies that run under different names in some territories share the same 'group'.
- This catalog does not contain votes: use 'elecciones29n_get_scope_results' for results.
elecciones29n_get_polling_stationsA
Use this tool to list the polling stations (mesas) of ONE polling place (local electoral):
their codes, the short label the official website shows and whether each one has been
counted. The codes are the input of 'elecciones29n_get_tally_sheet'.

WHEN TO USE IT:
When the user asks about a specific polling place or polling station, or wants the tally
sheet (acta) of a polling station.

INPUT PARAMETERS (What it receives):
- params.scope_id (str, required): scope_id of a polling place (level 110), found with
  'elecciones29n_search_scopes' and level=110 (or 'local').
- params.chamber ('congreso' default | 'senado').
- params.data_source ('auto' default | 'pro' | 'def'): source of the 'scrutinized' flags.

WHAT IT RETURNS:
- local and parents: the polling place and its enclosing territories.
- polling_stations: code (e.g. '2807903650A'), label ('03-650-A': district-section-letter),
  name, scope_id, municipality_code, district, section, letter and 'scrutinized'.
- total, scrutinized_count, tally_sheets_available, next_step and source.

OPERATING NOTES:
- The website publishes this list late (often only after the count); until then the tool
  says it is not published yet. This endpoint is inferred from the website code and has
  not been validated live yet.
- It contains no votes: use 'elecciones29n_get_scope_results' for results.
elecciones29n_get_tally_sheetA
Use this tool to get the official tally sheet (acta de escrutinio) of ONE polling station:
the scanned PDF that the polling station sent after counting its votes.

WHEN TO USE IT:
When the user asks to see or check the tally sheet of a specific polling station, after
'elecciones29n_get_polling_stations' returned its code.

INPUT PARAMETERS (What it receives):
- params.mesa_code (str, required): polling station 'code' from
  'elecciones29n_get_polling_stations', e.g. '2807903650A'.
- params.chamber ('congreso' default | 'senado').

WHAT IT RETURNS:
- Metadata only (never the file contents): mesa_code, label, election_code, record_id,
  scope_id, sent_at, processing_state, processing_date, document_type, mime_type,
  size_bytes and sha256 of the PDF.
- resource_uri: 'elecciones29n://tally-sheet/{chamber}/{mesa_code}'. Read that resource
  (resources/read) to get the PDF; the result also carries it as a resource link.
- next_step and source.

OPERATING NOTES:
- Tally sheets exist only when the website reports 'scrutiny_records_available' (see
  'elecciones29n_get_status') and only for polling stations already counted.
- This endpoint is inferred from the website code and has not been validated live yet.
- The figures of a tally sheet are not machine-read: use 'elecciones29n_get_scope_results'
  for results.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription
instructionsHow to use the elecciones29n tools: flow, identifiers, phases, attribution rules.

TDQS

A4.7/5.0

Scored across 7 tools

Disambiguation5/5

Each tool has a clearly distinct role: status, scope search, scope results, winners map, party catalog, polling station listing, and tally sheet retrieval. The descriptions explicitly sequence the workflow and state what each tool does not cover, reducing misselection. Overlap is minimal and handled by cross-references rather than duplicated functionality.

Naming Consistency5/5

All tools use the same `elecciones29n_` prefix followed by a readable verb_noun pattern in snake_case, such as `get_status`, `search_scopes`, `get_scope_results`, and `list_parties`. The convention is predictable throughout, with no mixed casing or inconsistent verb styles.

Tool Count5/5

Seven tools is well scoped for an election-results server: status, territory discovery, results, winners, parties, polling stations, and tally sheets each earn their place. There is no obvious redundancy or missing bridge tool that would justify adding or removing one.

Completeness4/5

The surface covers the core 29N lifecycle from publication status through territory search, results, winners, parties, polling places, and tally sheets. Minor gaps exist, such as tally-sheet file access depending on a separate MCP resource read and some endpoints being inferred rather than live-validated, but agents can work around these.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues