Create a new EP MCP client.
Connection and gateway options forwarded to MCPConnection,
plus an optional pendingDocumentsStorePath that overrides the
default <cwd>/data/pending-documents.json sidecar location.
Protected_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
ProtectedsafeGeneric error-safe wrapper around callToolWithRetry. Catches any error thrown by the tool (or by the args factory), logs a warning, and returns a fallback payload.
MCP tool name
Tool arguments or a factory that builds them
JSON text to return when the tool is unavailable
Tool result or fallback
Private_Build a standardized per-tool timeout error.
MCP tool identifier
Timeout threshold in milliseconds
Optionalcause: ErrorOptional underlying error
Formatted timeout error
Private_Execute one MCP tool attempt with a per-tool timeout guard.
MCP tool identifier
Tool arguments
Timeout threshold in milliseconds
Tool result or throws on timeout
Private_Decide retry/throw behavior for a failed reliability-timed attempt.
MCP tool identifier
Timeout threshold in milliseconds
The error that occurred
Whether a timeout was previously observed
Current attempt number
Maximum allowed timeout retries
Decision object with retry flag and error details
PrivatecallCall a tool with per-tool timeout and one timeout-only retry budget.
MCP tool identifier
Tool arguments
Timeout threshold in milliseconds
Maximum allowed timeout retries
Tool result
ProtectedsafeWrapper variant of safeCallTool that enforces per-tool timeout/retry policy.
MCP tool name
Tool arguments or arg factory
JSON fallback payload
Tool result or fallback
Get a summary of tools that returned fallback data in the current session.
Map of tool name to error description
Get tools that experienced a timeout but the failure was downgraded to a warning.
Map of tool name to 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.
Formatted summary of tool errors by code
Optionaloptions: GetMEPsOptionsOptionaloptions: GetPlenarySessionsOptionsOptionaloptions: SearchDocumentsOptionsOptionaloptions: GetParliamentaryQuestionsOptionsOptionaloptions: GetCommitteeInfoOptionsOptionaloptions: MonitorLegislativePipelineOptionsOptionaloptions: AnalyzeCoalitionDynamicsOptionsOptionaloptions: DetectVotingAnomaliesOptionsOptionaloptions: VotingRecordsOptionsOptionaloptions: AnalyzeCommitteeActivityOptionsOptionaloptions: TrackMEPAttendanceOptionsOptionaloptions: GeneratePoliticalLandscapeOptionsOptionaloptions: GetCurrentMEPsOptionsOptionaloptions: GetSpeechesOptionsOptionaloptions: GetEventsOptionsOptionaloptions: GetMEPDeclarationsOptionsOptionaloptions: GetIncomingMEPsOptionsOptionaloptions: GetOutgoingMEPsOptionsOptionaloptions: GetHomonymMEPsOptionsOptionaloptions: GetLatestVotesOptionsOptionaloptions: GetPlenaryDocumentsOptionsOptionaloptions: GetCommitteeDocumentsOptionsOptionaloptions: GetPlenarySessionDocumentsOptionsOptionaloptions: GetPlenarySessionDocumentItemsOptionsOptionaloptions: GetControlledVocabulariesOptionsOptionaloptions: GetExternalDocumentsOptionsOptionaloptions: NetworkAnalysisOptionsOptionaloptions: SentimentTrackerOptionsOptionaloptions: EarlyWarningSystemOptionsOptionaloptions: GetAllGeneratedStatsOptionsOptionaloptions: GetMEPsFeedOptionsOptionaloptions: GetEventsFeedOptionsOptionaloptions: GetProceduresFeedOptionsOptionaloptions: GetAdoptedTextsFeedOptionsOptionaloptions: GetMEPDeclarationsFeedOptionsOptionaloptions: GetDocumentsFeedOptionsOptionaloptions: GetPlenaryDocumentsFeedOptionsOptionaloptions: GetCommitteeDocumentsFeedOptionsOptionaloptions: GetPlenarySessionDocumentsFeedOptionsOptionaloptions: GetExternalDocumentsFeedOptionsOptionaloptions: Omit<GetExternalDocumentsFeedOptions, "workType">Optionaloptions: Omit<GetExternalDocumentsFeedOptions, "workType">Optionaloptions: GetParliamentaryQuestionsFeedOptionsOptionaloptions: GetCorporateBodiesFeedOptionsOptionaloptions: GetControlledVocabulariesFeedOptionsOptionaloptions: GetProceduresOptionsOptionaloptions: GetFreshProceduresOptionsOptionaloptions: GetAdoptedTextsOptionsCheck 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). Delegates to handleIncomingMessage in process.ts.
JSON message line from server
Send a request to the MCP server
RPC method name
Method parameters
Server response
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
Attempt to reconnect to the MCP server. Deduplicates concurrent calls — only one reconnect runs at a time.
Resolves when reconnect succeeds or all attempts are exhausted
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
Protected Readonly_Tracks tools that returned fallback data in the current session
Protected Readonly_Tracks tools that have been called (attempted) in the current session
Protected 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.
Protected Readonly_Path to the pending-documents sidecar file.
Undefined means "use the module-level default (<cwd>/data/pending-documents.json)".
ProtectedserverHuman-readable server name for log messages
Base MCP connection managing JSON-RPC 2.0 transport over stdio or HTTP gateway. Extended by domain-specific clients to add tool wrapper methods.