Private_Record a tool failure and log a warning.
MCP tool name that failed
Raw error text from the failure
JSON text for the fallback result
Fallback MCPToolResult
PrivatesafeGeneric error-safe wrapper around callToolWithRetry. Retries transient failures (timeouts, connection drops) with a bounded back-off delay before falling back. Non-retriable errors (session expiry, rate limits, programmer errors) are caught immediately without additional delay. Catches any error thrown by the tool (or by the args factory), logs a warning, and returns a fallback payload.
Also inspects the tool result for the MCP protocol isError flag. When
isError === true, the first content item's text is passed through
classifyToolError for diagnostic categorization, and the tool is
recorded as failed via _recordToolFailure. This handles EP MCP
Server error responses that are returned (not thrown) as structured results.
Accepts either a plain args object or a factory function () => object.
Using a factory ensures that options normalization/destructuring runs inside
the try/catch so invalid runtime inputs fall back gracefully.
MCP tool name
Tool arguments or a factory that builds them
JSON text to return when the tool is unavailable
Tool result or fallback
Get a summary of tools that returned fallback data in the current session. Useful for diagnosing feed availability and data quality issues.
Map of tool name to error description
Get tools that experienced a timeout but the failure was downgraded to a warning.
Unlike getFailedTools, entries here are not counted against the
reliability score โ they represent expected-slow tools whose timeouts are
classified as ๐ข LIMITATION (see .github/prompts/07-mcp-reference.md ยง11 row #8).
Map of tool name to "SLOW_FEED: <message>" warning description
Get a human-readable feed health summary for diagnostics.
Formatted summary of feed availability
Get a per-error-code breakdown of tool-level rejections recorded during the current session. Designed for end-of-run observability so regressions like Hack23/European-Parliament-MCP-Server#378 (raw upstream 404 leaking through as "successful" feed calls) surface in agent-stdio without needing to hand-comb the MCP gateway logs.
Each entry in _failedTools is stored as "${errorCode}: ${message}" by
_recordToolFailure. This method splits on the first colon to
group tool names by error code.
Formatted summary: one line per error code, with affected tools, terminated by a final counts line. Returns a single "all operational" line when no failures have been recorded.
Get Members of European Parliament
Filter options
List of MEPs
Get plenary sessions
Filter options including dateFrom, dateTo, eventId, year, location
Plenary sessions data
This repository is currently documented/configured against
european-parliament-mcp-server@1.2.15.
Upstream date-filter contract (v1.2.14+, active on the pinned v1.2.15 server): the upstream server
applies a server-side post-filter on dateFrom/dateTo before serialisation, because the
EP Open Data Portal /meetings endpoint silently ignores its date-from/date-to query
parameters (Defect #5). Under this contract:
data[] contains only sessions within the requested window.total reflects the filtered count, not the raw upstream count.No local post-filter is applied here. The repository is pinned to v1.2.15, so the date-filter guarantees above apply; consumers running against an older server image (pre-v1.2.14) must not assume them.
Search legislative documents
Search options using v1.2.13 parameters: keyword, documentType, docId, etc.
Search results
Get parliamentary questions
Filter options including docId, type, author, topic, status, dateFrom, dateTo
Parliamentary questions data
Get committee information
Filter options: id, abbreviation, showCurrent
Committee info data
Monitor legislative pipeline
Filter options
Legislative pipeline data
Analyze legislative effectiveness of an MEP or committee
Options including subjectType and subjectId
Legislative effectiveness data
Assess MEP influence using 5-dimension scoring model
Options including required mepId and optional date range
MEP influence score and breakdown
Analyze coalition dynamics and cohesion
Options including optional groupIds and date range
Coalition cohesion and stress analysis
Detect voting anomalies and party defections
Options including optional MEP id, groupId, and date range
Anomaly detection results
Compare political groups across dimensions
Options including required groupIds and optional dimensions and date range
Cross-group comparative analysis
Get detailed information about a specific MEP
MEP identifier (must be non-empty)
Detailed MEP information including biography, contact, and activities
Retrieve voting records with optional filters
Filter options (sessionId, mepId, topic, dateFrom, dateTo, limit, offset)
Voting records data
Analyze voting behavior patterns for an MEP
Analysis options (mepId required non-empty, dateFrom, compareWithGroup)
Voting pattern analysis
Track a legislative procedure by its identifier
Legislative procedure identifier (must be non-empty)
Procedure status and timeline
Generate an analytical report
Report options (reportType required non-empty, subjectId, dateFrom)
Generated report data
Analyze committee activity, workload, and engagement
Options including optional committeeId and date range
Committee activity analysis data
Track MEP attendance patterns and trends
Options including optional mepId and date range
MEP attendance data
Analyze country delegation voting behavior and composition
Options including required country code and optional date range
Country delegation analysis data
Generate a parliament-wide political landscape overview
Options including optional date range and detail level
Political landscape overview data
Get currently active Members of European Parliament
Pagination options
Active MEPs data
Get plenary speeches and debate contributions
Filter options including optional speechId, dateFrom/dateTo (v1.2.13: year removed)
Speeches data
Get legislative procedures
Filter options including optional processId (v1.2.13: year removed)
Procedures data
Get fresh legislative procedures using client-side date filtering as a
workaround for the broken EP /procedures/feed timeframe filter.
Background: the EP Open Data Portal /procedures/feed endpoint stopped
honouring the timeframe parameter on or around 2026-04-19 and began
returning historical-tail pagination (oldest records first, all metadata
empty). This regression is tracked as Defect #3 in
analysis/daily/2026-04-24/propositions/intelligence/mcp-reliability-audit.md
and has been reported to open-data-helpdesk@europarl.europa.eu.
Strategy:
get_procedures(limit=100, offset=0) โ the stable non-feed endpoint.dateLastActivity DESC, falling back to
dateInitiated when dateLastActivity is empty.windowDays
(default 30 days). Apply optional topN cap.(procedureId, dateLastActivity) pairs to the seen-cache so
subsequent runs can detect new/updated IDs without re-paginating.Discovery options (limit, windowDays, topN, seenCacheStorePath)
Sorted, filtered procedure list in {"procedures": [...]} envelope
Get adopted texts (legislative resolutions, positions, non-legislative resolutions)
When called with options.docId this method delegates to
_fetchAdoptedTextByDocId which handles two CONTENT_PENDING conditions
with the correct classification from the first log entry:
UPSTREAM_404 indexing lag (primary, v1.2.13+): The EP MCP Server
throws UPSTREAM_404: document indexed but content not yet available
when the EP Open Data Portal has indexed a document identifier but the
content body has not yet been populated (typically 5โ15-day lag).
The docId is recorded in the pending-documents sidecar with exponential
back-off scheduling so subsequent runs can re-probe without over-reporting
the lag as a reliability defect.
Empty-string sentinel (secondary, pre-v1.2.13 defence-in-depth):
Every string field is "" โ upstream issue
Hack23/European-Parliament-MCP-Server#369.
In both cases the method returns the empty {"texts": []} fallback so
downstream consumers do not render blank title/reference/date fields.
Year-range list queries (no docId) use the standard safeCallTool
wrapper and are not affected by content-availability detection.
Filter options including optional docId or year
Adopted texts data
Private_Contextual fetcher for single-document get_adopted_texts lookups.
Wraps callToolWithRetry directly so content-availability lag is
classified as CONTENT_PENDING from the first log entry โ not reclassified
from NOT_FOUND after the fact. Two conditions are handled:
UPSTREAM_404 indexing lag (thrown exception or isError:true body):
message contains CONTENT_NOT_YET_AVAILABLE_SUBSTRING.
Empty-string sentinel (isError:false, pre-v1.2.13 defence-in-depth):
every string field is "".
Trimmed document identifier
Adopted texts data or ADOPTED_TEXTS_FALLBACK
Return the docIds of pending adopted texts that are due for a re-probe according to their exponential back-off schedule.
Call this at the start of each Stage B deep-fetch run to obtain the list
of identifiers to re-probe. For each returned docId, call
getAdoptedTexts with { docId }. If the fetch succeeds (real
content returned), call resolveAdoptedText to mark it resolved.
Array of docIds due for reprobe (may be empty)
Mark a previously-pending adopted text as resolved (content is now available and has been successfully retrieved).
Adopted-text identifier (e.g., "TA-10-2026-0104")
Escalate PENDING adopted texts that have exceeded the 14-day maximum tracking age. Escalated documents are excluded from future reprobes and should be handled by the wildcards-blackswans family.
Array of docIds that were escalated
Return a human-readable summary of the pending-documents sidecar for Stage B observability logging.
Formatted summary string
Get European Parliament events (hearings, conferences, seminars)
Filter options including optional eventId, pagination only (v1.2.13: year/dateFrom/dateTo removed โ EP API /events has no date filtering)
Events data
Get activities linked to a specific plenary sitting
Options including required sittingId
Meeting activities data
Get decisions made in a specific plenary sitting
Options including required sittingId
Meeting decisions data
Get MEP declarations of financial interests
Filter options including optional docId or year
MEP declarations data
Get incoming Members of European Parliament
Pagination options
Incoming MEPs data
Get outgoing Members of European Parliament
Pagination options
Outgoing MEPs data
Get homonym MEPs (MEPs with identical names)
Pagination options
Homonym MEPs data
Get plenary documents
Filter options including optional docId or year
Plenary documents data
Get committee documents
Filter options including optional docId (v1.2.13: year removed)
Committee documents data
Get plenary session documents (agendas, minutes, voting lists)
Filter options including optional docId
Plenary session documents data
Get plenary session document items
Pagination options
Plenary session document items data
Get controlled vocabularies (standardized classification terms)
Filter options including optional vocId
Controlled vocabularies data
Get external documents (non-EP documents such as Council positions)
Filter options including optional docId (v1.2.13: year removed)
External documents data
Get foreseen (planned) activities for a specific plenary sitting
Options including required sittingId
Foreseen activities data
Get events linked to a specific legislative procedure
Options including required processId
Procedure events data
Get plenary session documents linked to a specific meeting
Options including required sittingId
Meeting plenary session documents data
Get plenary session document items linked to a specific meeting
Options including required sittingId
Meeting plenary session document items data
MEP relationship network mapping using committee co-membership
Options including optional mepId, analysisType, and depth
Network analysis with centrality scores and clusters
Track political group institutional positioning and sentiment
Options including optional groupId and timeframe
Sentiment tracking data
Detect emerging political shifts and coalition fracture signals
Options including optional sensitivity and focusArea
Early warning alerts and trend indicators
Cross-reference MEP activities for comparative multi-dimensional profiling
Options including required mepIds array and optional dimensions
Comparative intelligence profiles
Cross-tool OSINT intelligence correlation engine
Options including required mepIds, optional groups, sensitivityLevel, includeNetworkAnalysis
Correlated intelligence alerts and insights
Retrieve precomputed European Parliament activity statistics (EP6โEP10, 2004โ2025). Includes yearly stats, category rankings, political landscape history, and average-based predictions for 2026โ2030. Static data refreshed weekly โ no live API calls.
Filter options including optional year range, category, and flags
Precomputed EP statistics data
Get MEPs feed (most recent updates via EP API v2)
Pagination options
MEPs feed data
Get events feed (most recent updates via EP API v2)
Implements special timeout-downgrade handling: when the call throws a timeout
error, the failure is recorded in _slowFeedWarnings (not
_failedTools) so it does not reduce the session reliability score.
The events feed is documented as significantly slower than other feeds
(30โ120 s+); timeouts during heavy EP API load are expected behaviour, classified
as ๐ข LIMITATION in .github/prompts/07-mcp-reference.md ยง11 row #8.
A fallback result with slowFeedWarning: true is returned so Stage A consumers
can detect the condition and fall back to get_plenary_sessions({ year }).
Non-timeout errors (404, 5xx, rate-limit, etc.) are still recorded as failures.
Pagination options
Events feed data, or { "feed": [], "slowFeedWarning": true } on timeout
Get procedures feed (most recent updates via EP API v2)
Post-processes the response to detect "recess mode" โ when the EP procedures feed returns historical archive data (all items dated โค 1995) instead of current procedures. This happens during parliamentary recesses when the EP API serves its historical archive in ID order.
When recess mode is detected:
recessMode: true is added to the payloadRECESS_MODE: โฆ entry is appended to dataQualityWarnings[]๐ก procedures-feed: recess mode console warning is emittedThe tool is not recorded as failed โ this is documented EP API behaviour
classified as ๐ข LIMITATION in .github/prompts/07-mcp-reference.md ยง11 row #5.
Downstream Stage A consumers should fall back to
get_adopted_texts({ year: $YEAR }) or track_legislation({ procedureId }).
Pagination options
Procedures feed data, possibly with recessMode: true added to the payload
Get adopted texts feed (most recent updates via EP API v2)
Post-processes the response to honour upstream freshness-fallback warnings
added by Hack23/European-Parliament-MCP-Server when the feed payload
contains no items from the current calendar year:
FRESHNESS_FALLBACK: โฆ in dataQualityWarnings[] indicates the server
augmented the response with GET /adopted-texts?year={currentYear}.
The result is kept (do NOT downgrade to C4 โ the augmented items are
confirmable, current-year, EP-published documents) and two fields are
added to the payload:
freshness: "augmented" โ callers can detect the augmentationdataFreshnessWarnings: string[] โ the subset of dataQualityWarnings
that starts with FRESHNESS_FALLBACK, forwarded for Stage-A consumersFRESHNESS_FALLBACK_FAILED: โฆ indicates the feed was stale AND the
fallback GET /adopted-texts?year=โฆ also returned no items. The tool
is recorded as failed (escalated to ANALYSIS_ONLY) so downstream
consumers do not treat an empty-year dataset as fresh evidence.
Pagination options
Adopted texts feed data, possibly with augmented freshness fields
Get MEP declarations feed (most recent updates via EP API v2)
Pagination options
MEP declarations feed data
Get documents feed (most recent updates via EP API v2)
Pagination options
Documents feed data
Get plenary documents feed (most recent updates via EP API v2)
Pagination options
Plenary documents feed data
Get committee documents feed (most recent updates via EP API v2)
Pagination options
Committee documents feed data
Get plenary session documents feed (most recent updates via EP API v2)
Pagination options
Plenary session documents feed data
Get external documents feed (most recent updates via EP API v2)
Pagination options
External documents feed data
Get parliamentary questions feed (most recent updates via EP API v2)
Pagination options
Parliamentary questions feed data
Get corporate bodies feed (most recent updates via EP API v2)
Pagination options
Corporate bodies feed data
Get controlled vocabularies feed (most recent updates via EP API v2)
Pagination options
Controlled vocabularies feed data
Get a specific event linked to a legislative procedure. Returns a single event for the specified procedure and event identifiers.
Options including required processId and eventId
Procedure event data
Check server health and feed availability status. Returns server version, uptime, per-feed health status, and overall availability. Does not make upstream API calls โ reports cached status from recent tool invocations.
Server health and feed availability data
Check if client is connected
Connection status
Check if using gateway HTTP transport
True if gateway mode is active
Get the configured gateway URL
Gateway URL or null if using stdio transport
Get the configured gateway API key
Gateway API key or null if not set
Get the current MCP session ID
Session ID returned by the gateway, or null if not yet connected
Get connection health metrics for telemetry
Object with timeout count, reconnection count, and current connection status
Connect to the MCP server with retry logic
Disconnect from the MCP server
Handle incoming messages from MCP server (stdio mode only)
JSON message line from server
List available MCP tools
List of available tools
Call an MCP tool
Tool name
Tool arguments (must be a plain object, non-null, not an array)
Tool execution result
Call an MCP tool with automatic retry on timeout or connection loss. Reconnects automatically if the connection was lost between attempts.
Only transient failures are retried (see isRetriableError). Non-retriable
errors โ rate-limit (429), session-expired (401), and programmer errors such
as TypeError โ are re-thrown immediately without consuming any retry budget.
Tool name
Tool arguments (plain object, non-null, not an array)
OptionalmaxRetries: numberOverride the default retry count from options
Tool execution result
Private Readonly_Tracks tools that returned fallback data in the current session
Private Readonly_Tracks tools that have been called (attempted) in the current session
Private Readonly_Tracks tools that experienced a timeout but the failure was downgraded to a warning.
Unlike _failedTools, entries here are NOT counted against the reliability score.
Currently used by getEventsFeed whose documented latency is 30โ120 s+.
Private Readonly_Path to the pending-documents sidecar file.
Undefined means "use the module-level default (<cwd>/data/pending-documents.json)".
Private Static ReadonlyFEED_Fallback payload for feed tools
ProtectedserverHuman-readable server name for log messages
MCP Client for European Parliament data access. Extends MCPConnection with EP-specific tool wrapper methods.