Skip to main content
Glama
aiordanescu

ib-gateway-mcp

by aiordanescu

Stream live bars

subscribe_bars
Read-only

Loads recent historical bars and keeps them live, updating the newest bar and appending new ones for real-time monitoring.

Instructions

Load recent bars of any size and keep the newest bar updating live.

First loads `duration` of history (like get_historical_bars), then IBKR updates the
last bar and appends new ones as time passes. get_subscription_data returns the
bars oldest first (the newest 100 by default; the server keeps up to 5000). One
stream per contract and parameter set: subscribing again returns the same handle.
Counts against IBKR's historical data pacing (about 60 requests per 10 minutes;
error 162 on a violation) and needs market data permissions. Stop it with
unsubscribe.

Errors: not_found if IBKR has no bars for the period (try a longer duration or
use_rth=false), ib_api_error 321 if IBKR rejects the combination of bar size,
duration and what_to_show (the message names the field).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
use_rthNoTrue: regular trading hours only. False: include pre-market, after-hours and overnight data.
bar_sizeYesLength of one bar, 5 secs or more, e.g. '5 secs', '1 min', '1 hour'.
contractYesThe instrument. A con_id alone is unambiguous; otherwise give symbol and sec_type, plus expiry, strike and right for options.
durationNoHow much history to load first: a number and a unit, S (seconds), D, W, M or Y, e.g. '3600 S', '1 D', '2 W'.1 D
what_to_showNoData the values are built from. TRADES (not for forex), MIDPOINT, BID, ASK, BID_ASK (counts double for pacing), ADJUSTED_LAST (split/dividend adjusted; end must be empty), HISTORICAL_VOLATILITY and OPTION_IMPLIED_VOLATILITY (stocks, indexes), REBATE_RATE and FEE_RATE (stock loan), YIELD_BID, YIELD_ASK, YIELD_BID_ASK, YIELD_LAST (bonds), AGGTRADES (crypto).TRADES

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesWhat it streams for: the contract id plus parameters.
kindYesWhat streams: quotes, depth, tick_by_tick, realtime_bars, bars, scanner, news_bulletins, news or display_group.
contractNoThe instrument, when there is one.
created_atYes
idle_ttl_sYesSeconds without a read before it is cancelled.
deduplicatedNoTrue when an identical stream was already open and its handle was returned instead of opening a second one.
subscription_idYesHandle for get_subscription_data and unsubscribe.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations are readOnlyHint and openWorldHint, and the description adds substantial behavioral context: one stream per contract/parameter set, server retains up to 5000 bars with the newest 100 returned, pacing violations produce error 162, and rejected combinations yield error 321 with the offending field named. This goes well beyond the annotations and helps an agent predict side effects and failure modes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but efficient: it opens with the core behavior, then covers lifecycle, constraints, and errors in a logical order. Every sentence adds operational information, so the length is justified.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a subscription tool with an output schema, the description covers the full lifecycle (subscribe, retrieve via get_subscription_data, stop via unsubscribe), plus limits, permissions, and error handling. It gives agents all necessary operational context to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so parameters are already described. The description adds the stream is unique per contract and parameter set, ties duration to the initial history size, and links bar_size, duration, and what_to_show to error 321, giving a semantic relationship not present in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it loads recent bars and keeps the newest one updating live, with specific verbs and a resource. It references get_historical_bars for the initial history, but does not explicitly contrast with sibling subscribe_realtime_bars, though the live-updating behavior is distinct enough.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use the tool: when you need a history load followed by live bar updates, and it points to get_subscription_data for retrieval and unsubscribe for stopping. It also gives preconditions (market data permissions) and constraints (pacing, 60 requests per 10 minutes, error 162), but does not name alternatives like subscribe_realtime_bars for other bar use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.