Skip to main content
Glama
aiordanescu

ib-gateway-mcp

by aiordanescu

Run a market scan

run_scanner
Read-only

Run an Interactive Brokers market scan and receive ranked instruments, best first, with optional filters for price, volume, and market cap.

Instructions

Run an IBKR market scan once and return the ranked instruments, best first.

Example: top % gainers among US listed stocks above $5 is scan_code=TOP_PERC_GAIN,
instrument=STK, location_code=STK.US.MAJOR, above_price=5. Find other scan codes,
locations and filter tags with get_scanner_parameters. Each row has the rank
(1 = top) and the contract (with con_id, for quotes or orders).
Limits: at most 50 rows. IBKR allows 10 scanner subscriptions at a time; a run
uses one for a moment and always releases it. Scans need market data permissions
for the exchanges scanned.
Errors: not_found when nothing matches right now (loosen the filters, or the
market may be closed); ib_api_error with IBKR's message for an unknown scan code,
location or filter; subscription_limit when 10 scanner subscriptions are open.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsNoHow many rows to return (1-50).
filtersNoMore filters as tag: value, with tags from get_scanner_parameters section="filters", e.g. {"avgVolumeAbove": 100000}.
scan_codeYesWhat to rank by, e.g. TOP_PERC_GAIN or MOST_ACTIVE.
instrumentNoInstrument type, e.g. STK (US stocks) or FUT.US.STK
above_priceNoOnly prices above this.
below_priceNoOnly prices below this.
above_volumeNoOnly volume above this.
location_codeNoMarket or exchange, e.g. STK.US.MAJOR or STK.NASDAQ.STK.US.MAJOR
market_cap_aboveNoOnly market capitalization above this.
market_cap_belowNoOnly market capitalization below this.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsYes
as_ofYesWhen the rows arrived (UTC).
scan_codeYes
truncatedNoTrue when the result was cut to the limit.
instrumentYes
location_codeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true, so the safe-read nature is covered. The description adds substantial behavioral context beyond that: the 50-row limit, the 10-subscription cap and the fact that a run temporarily uses and releases a subscription, the market-data permission requirement, and a detailed error taxonomy (not_found, ib_api_error, subscription_limit). This is exactly the kind of operational nuance an agent needs.

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 organized into clear sections: purpose, example, output shape, limits, permissions, and errors. Every sentence contributes information needed to call the tool correctly or interpret results, and there is no filler or redundancy. It is longer than a one-liner, but the length is justified by the tool's complexity.

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 tool has 10 parameters, no enums, and relies on external knowledge (scan codes, locations, filters), the description is complete: it explains how to discover valid values, what the output contains, what the limits are, what permissions are needed, and what errors to expect. The presence of an output schema further reduces the need to describe return values in prose. Nothing essential is missing for correct invocation.

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 the baseline is 3 per the rubric. The description adds value beyond the schema by giving a concrete composition example (scan_code=TOP_PERC_GAIN, instrument=STK, location_code=STK.US.MAJOR, above_price=5) and by pointing to get_scanner_parameters for valid values. This helps the agent understand how multiple parameters combine, even though each individual parameter is already documented in the schema.

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 specific verb and resource: 'Run an IBKR market scan once and return the ranked instruments, best first.' The word 'once' clearly distinguishes it from the sibling subscribe_scanner, and the example further pins down what the tool does. It also tells the agent what each row contains, making the output expectation clear.

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 explicitly directs users to get_scanner_parameters for discovering valid scan codes, locations, and filter tags, which is a clear alternative for parameter selection. It also states 'once', implying a one-shot operation versus ongoing subscription, but it does not explicitly name subscribe_scanner as the alternative for continuous scanning. The guidance is strong but not fully explicit about when not to use this tool.

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