Gateway health
get_healthDetermine if the IB Gateway connection is usable and get the reason when it is not. Includes actionable hints and an optional probe for live verification.
Instructions
Report whether the Interactive Brokers gateway connection is usable, and why not.
Call this first when another tool fails with not_connected or times out. It never
fails itself. `state` is one of:
- connected: everything works.
- connecting: a connection attempt is in progress.
- not_accepting: the gateway refused or ignored the connection (it is down, logged out,
or waiting for the user to approve 2FA). Retries run in the background.
- connectivity_lost: the gateway is up but cut off from IBKR's servers; usually heals.
- not_connected: stopped, or the connection dropped and a retry is pending.
`hint` explains what to do. `trading_enabled` says whether the trading gate is open
(order tools also need `circuit_open` false: after repeated IBKR rejections the
circuit breaker halts order submits until a human resets it). `api_read_only` means
the gateway's own settings reject orders. `is_paper` is true when the login only has
paper accounts. `market_data_type` is the data type requested for this session
(set_market_data_type changes it), and `subscriptions_used`/`subscriptions_max` show
how many streams are open. Pass probe=true to test the connection with a real
request (the state alone can lag behind a stalled socket).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| probe | No | Also send one request to the gateway (its clock) to prove the connection answers right now; the outcome is in `probe`. Takes up to IB_REQUEST_TIMEOUT. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hint | No | What is wrong and what to do, when not connected. | |
| host | Yes | ||
| port | Yes | ||
| probe | No | Result of the live round trip; null unless probe=true was asked. | |
| state | Yes | ||
| accounts | No | Accounts this server may use (the allowlist). | |
| is_paper | No | True when every managed account is a paper account (None: unknown). | |
| client_id | Yes | ||
| last_error | No | ||
| circuit_open | No | True when the order circuit breaker tripped after consecutive IBKR rejections: submit_order refuses new orders, modifications and exercises until a human resets it (reset_circuit_breaker, admin toolset). Cancels still work. | |
| api_read_only | No | The gateway rejected a request because its API is read-only (321). | |
| orders_synced | No | Whether this session loaded the open and completed orders (skipped when no order toolset is enabled). Informational only: trading_enabled decides whether order tools work. | |
| server_version | No | TWS API server version (when connected). | |
| connected_since | No | ||
| trading_enabled | Yes | Whether the trading gate is open right now: connected, accounts allowed, live trading permitted, API not read-only. Order submits are also refused while circuit_open is true. | |
| market_data_type | No | Market data type requested for this session (live, frozen, delayed...). | |
| circuit_threshold | No | Consecutive rejections that trip the breaker; null when disabled. | |
| subscriptions_max | No | Subscription limit (IBKR_MCP_MAX_SUBSCRIPTIONS). | |
| circuit_rejections | No | Consecutive IBKR order rejections since the last accepted order. | |
| subscriptions_used | No | Open streaming subscriptions. |