Skip to main content
Glama
aiordanescu

ib-gateway-mcp

by aiordanescu

Earliest historical data

get_head_timestamp
Read-only

Determine how far back IBKR has historical data for an instrument before requesting bars, preventing empty results and helping set the correct start date.

Instructions

Return the earliest date and time IBKR has historical data for an instrument.

Use it before long get_historical_bars requests, or when they come back empty, to
learn how far back the data goes for this `what_to_show`. Needs market-data
permissions for the instrument; counts toward IBKR's historical-data limits.

Errors: not_found (no such contract, or no data of that type).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
use_rthNoTrue: regular trading hours only. False: include pre-market, after-hours and overnight data.
contractYesThe instrument. A con_id alone is unambiguous; otherwise give symbol and sec_type, plus expiry, strike and right for options.
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
use_rthYes
contractYes
earliestYesEarliest available data (UTC).
what_to_showYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, so the description is not required to restate safety. It adds valuable behavior beyond the annotation: the tool 'Needs market-data permissions', 'counts toward IBKR's historical-data limits', and may fail with not_found for missing contracts or data types. This is useful operational context that annotations do not provide.

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 has no filler: one sentence for the core result, one for usage context, and one for errors. The most important information is front-loaded, and every sentence earns its place by conveying permissions, rate-limit impact, or failure modes.

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?

Given the rich input schema (especially ContractSpec), the presence of an output schema, and readOnlyHint, the description covers what an agent needs: the purpose, when to call it, permission and pacing consequences, and the not_found error. Return-value details are already handled by the output schema, so nothing essential is missing.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents contract, use_rth, and what_to_show in detail. The description adds only a loose tie to what_to_show ('for this what_to_show') and permission context, but it does not meaningfully expand parameter meaning beyond the schema. Baseline 3 is appropriate.

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

Purpose5/5

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

The description opens with a precise statement: 'Return the earliest date and time IBKR has historical data for an instrument.' This names a specific verb, resource, and result scope, and it clearly distinguishes the tool from siblings like get_historical_bars, get_histogram, and get_historical_ticks by its unique head-timestamp purpose.

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

Usage Guidelines5/5

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

The description gives explicit when-to-use guidance: 'Use it before long get_historical_bars requests, or when they come back empty.' It also names the relevant alternative tool (get_historical_bars) and ties the call to the what_to_show parameter, so an agent can decide correctly without inference.

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