Base URL currently in use (set at construction time).
The fully-qualified EP Open Data Portal base URL (no trailing slash).
Per-request timeout in milliseconds.
The timeout applied to every fetch() call.
Reset the connected flag. No real socket to close.
Fetch roll-call voting records from the EP Open Data Portal.
Virtual tool: ep-get-voting-records (see EP_GET_VOTING_RECORDS_TOOL).
Queries /decision?date-of-vote-start=<dateFrom>&date-of-vote-end=<dateTo>
and normalises the JSON-LD response to a { votes: VoteEntry[] }
envelope whose shape mirrors get_voting_records from the EP MCP server,
augmented with _source and _attribution metadata.
Returns the EMPTY_VOTES_FALLBACK envelope on any error so callers can safely chain the result through EPOpenDataClient.isVotingDataEmpty without defensive try/catch.
Query options. dateFrom and dateTo are required and
must be non-empty YYYY-MM-DD strings.
MCP-shaped result with votes[] array (possibly empty on error).
StaticisReturn true when a get_voting_records (or fallback) result carries
zero votes. Used to decide whether to proceed to the next fallback tier.
Handles both the {"votes":[]} MCP empty shape and the plain
{"votes":null} edge case.
MCP tool result to inspect.
true when the votes array is absent or empty.
StaticbuildBuild the canonical 🔴 voting data unavailable marker emitted when
both MCP and the EP Open Data Portal fallback return empty.
The returned payload remains a normal MCP JSON envelope containing an
empty votes array plus human-readable marker metadata (_marker,
_reason, _unavailable). This preserves compatibility with consumers
that parse response.content[0]?.text as JSON, while still exposing a
clear alert message for downstream display or diagnostics.
Analysis period start (YYYY-MM-DD).
Analysis period end (YYYY-MM-DD).
MCP-shaped result containing the 🔴 unavailability marker.
Private_Private_InternalGET a URL and parse the response body as JSON.
Narrow response type declared by the caller.
Path to append to the base URL.
Parsed JSON value.
Private Readonly_Private Readonly_Private Readonly_Optionalinit: RequestInitOptionalinit: RequestInitPrivate_
Direct HTTP client for EP Open Data Portal roll-call vote data.
Queries
GET /api/v2/decisionwithdate-of-vote-startanddate-of-vote-endparameters. The response is JSON-LD; we extract thedataarray and normalise each entry to the samevotes[]shape that the MCPget_voting_recordstool returns, augmented with_sourceand_attributionmetadata.Example