Skip to main content
Glama
ElectionData MCP

ElectionData MCP

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
TRUST_PROXYNoSet to 1 behind your own reverse proxy. The rate limit then uses the last X-Forwarded-For value. Leave unset when clients connect directly.
QUERY_TIMEOUT_SNoTime limit per query, in seconds.30
RATE_LIMIT_PER_MINNoHTTP requests per minute per client IP. Set to 0 to turn rate limiting off.60
DUCKDB_MEMORY_LIMITNoMemory limit for queries.1GB
ELECTIONDATA_API_KEYNoKey for the API tools. Optional; required only for live_turnout, seat_lineage, and party_history. Never logged or returned.

Instructions

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

Malaysian election data from ElectionData.MY (MECo): every federal and state contest since 1955, by-elections, polling-centre results, voter demographics, anonymised voter rolls, boundary maps, and live turnout on polling day.

How to answer:

  1. Names first: call search to turn loose text into exact seat names, candidate_uid or party_uid.

  2. Common questions: seat_history, contest_result, candidate_profile, election_summary, byelections, seat_demographics, polling_centre_results, find_seat_by_location.

  3. Analysis: swing, marginal_seats, compare, seat_features. For anything else: search_datasets, describe_dataset, join_guide, then run_sql (DuckDB SQL, read only). Read electiondata://guide first.

  4. Polling day: live_turnout (provisional). Boundary changes: seat_lineage. Party name history: party_history.

  5. Full data on the user's machine: data_access.

Accuracy rules: quote numbers exactly as returned; say which election, state and seat they belong to; pass on any warning, ambiguous or truncated field; never fill gaps with guesses. Each result lists its sources and dashboard links so a person can check them. Credit: Data from ElectionData.MY (MECo, Thevananthan 2025, doi:10.1038/s41597-025-06502-7), CC0. Official source: SPR.

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
searchA

Find exact seat names, candidate_uid, party_uid or coalitions from loose text. Call this first when the user names a seat, person or party.

seat_historyA

Every contest held in a seat, newest first: winner, party, coalition, majority, turnout. Seat codes change over time; the history follows the seat name.

contest_resultB

Full result of one contest: every candidate's votes, share and result, plus contest stats (voters, turnout, rejected votes, majority).

candidate_profileA

Every contest a candidate stood in, with party at the time and result, plus totals. Get candidate_uid from search.

election_summaryA

Seats won and votes by coalition and party, turnout and uncontested seats for one election. GE-xx = Malaysia unless a state is given; SE-xx = one block per state.

byelectionsB

All by-elections with winner, majority and turnout, newest first. Dates as YYYY-MM-DD.

seat_demographicsC

Voters in a seat by sex, age band, ethnicity and voter type, from the voter roll of an election (latest if not given).

polling_centre_resultsA

Votes per polling stream (saluran) or polling district (dm) for one seat and election. Available for GE-12 to GE-15 and many state elections.

swingA

Vote share per seat for one coalition or party in two elections, and the change. Seats whose name changed are listed apart.

marginal_seatsB

Closest contests in an election, smallest majority first, with winner and runner-up.

compareA

Compare 2 to 5 candidates (by candidate_uid), parties or coalitions (by acronym or uid) side by side across elections.

seat_featuresB

One row per seat for an election: turnout, majority, winner, vote share per coalition, previous result and voter demographics. Ready for modelling.

find_seat_by_locationB

Find the Parliament and state seats (optionally polling district) that contain a point. Uses the boundary maps in force in the given year (now if not given).

search_datasetsA

Search all 208 lake datasets by topic, column, election or state. Use before run_sql to find table names.

describe_datasetC

Columns, coverage, join keys and download links of one dataset.

join_guideB

How to join two or more datasets: the columns to join on and known traps.

find_dashboardB

Links to electiondata.my dashboard pages (English and Bahasa Malaysia) for a seat, candidate, party, coalition, election or boundary map.

data_accessB

Direct Parquet links and ready code (Python, R) to load full datasets on the user's own machine, with no row limit. Good for machine learning.

run_sqlA

Run one read-only DuckDB SELECT on the lake tables. Default 200 rows, max 2000; truncated=true means more rows exist. Voter roll tables need LIMIT <= 10000 or an aggregate.

live_turnoutA

PROVISIONAL live turnout on polling day (SPR feed, every 5 minutes, 08:00-18:00 MYT). election like 'mlk-se16'. Optional level, HHMM slot, or seat filter.

party_historyA

A party's or coalition's seats and votes over time in one state, with old names merged (e.g. PERIKATAN into BN).

seat_lineageC

A seat's results back through boundary changes, with notes on each change (from the ElectionData.MY API).

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription
guideNames, definitions, joins, traps and worked SQL. Read before run_sql.

TDQS

B3.3/5.0

Scored across 22 tools

Disambiguation4/5

Most tools target clearly distinct resources or actions, and the descriptions make boundaries fairly clear. A few adjacent pairs exist, such as seat_history vs seat_lineage vs contest_result, and search vs search_datasets, but they are separable with the provided guidance.

Naming Consistency3/5

All names use snake_case and remain readable, but the convention is mixed: bare verbs (search, compare, swing), noun phrases (seat_history, party_history), and verb-object forms (find_seat_by_location, describe_dataset). There is no single predictable naming pattern across the set.

Tool Count3/5

With 22 tools, the surface is above the typical 3-15 sweet spot and spans several subdomains: results, demographics, boundary lookup, lake datasets, dashboards, and live turnout. Each tool has a plausible role, but the overall count is borderline heavy and increases selection overhead.

Completeness5/5

The set covers entity search, contest results, candidate and party history, seat demographics, boundary lookup, by-elections, swing and marginal analysis, polling-centre data, live turnout, dashboards, and raw dataset/SQL access. It appears to provide a very complete election-analysis surface with no obvious dead ends.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues