EU Parliament Monitor — API Documentation - v1.0.31
    Preparing search index...

    Class WorldBankMCPClient

    MCP Client for World Bank economic data access. Extends MCPConnection with World Bank-specific tool wrapper methods.

    Always supplies an explicit World Bank server path so the base class never falls back to the European Parliament MCP server defaults.

    Hierarchy (View Summary)

    Index
    • Get connection health metrics for telemetry

      Returns { timeoutCount: number; reconnectCount: number; connected: boolean }

      Object with timeout count, reconnection count, and current connection status

    • Send a request to the MCP server

      Type Parameters

      • T = unknown

      Parameters

      • method: string

        RPC method name

      • params: Record<string, unknown> = {}

        Method parameters

      Returns Promise<T>

      Server response

    • Attempt to reconnect to the MCP server. Deduplicates concurrent calls — only one reconnect runs at a time.

      Returns Promise<void>

      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.

      Parameters

      • name: string

        Tool name

      • args: object = {}

        Tool arguments (plain object, non-null, not an array)

      • OptionalmaxRetries: number

        Override the default retry count from options

      Returns Promise<MCPToolResult>

      Tool execution result

    • Get economic indicator data for a specific country.

      Calls the get_indicator_for_country tool on the World Bank MCP server.

      Parameters

      • countryId: string

        World Bank country code (e.g., 'DEU' for Germany, 'FRA' for France)

      • indicatorId: string

        World Bank indicator ID (e.g., 'NY.GDP.MKTP.CD' for GDP)

      Returns Promise<MCPToolResult>

      MCP tool result with CSV-formatted indicator data, or empty text on error

    • Aggregate a World Bank indicator across EU-27 member states.

      This is a client-side fallback for aggregate codes such as EUU that are rejected by the upstream worldbank-mcp server.

      Important: This method uses simple summation (aggregation: "sum"), which is only meaningful for additive flow/stock metrics (e.g., absolute GDP in USD, total population, total exports). For ratios, percentages, rates, or per-capita indicators (e.g., GDP growth %, GDP per capita, school enrollment %, health expenditure as % of GDP), a plain sum is mathematically incorrect. Callers must verify the indicator is additive before using the result.

      Parameters

      • toolName:
            | "get-economic-data"
            | "get-social-data"
            | "get-health-data"
            | "get-education-data"

        World Bank MCP tool (get-economic-data, get-social-data, get-education-data, get-health-data)

      • indicator: string

        Indicator key accepted by the selected tool (must be an additive metric — not a ratio or percentage)

      • years: number = 10

        Number of years to request (default 10)

      Returns Promise<MCPToolResult>

      MCP-like JSON payload with summed year-series across EU-27 (includes aggregation: "sum" field)

    serverLabel: string

    Human-readable server name for log messages