Skip to main content
Glama
alpacahq

alpaca-mcp-server

Official
by alpacahq

Get Stock Bars

get_stock_bars
Read-only

Retrieve historical OHLCV price bars for any stock or stock list, with selectable timeframe, date range, and price adjustments for analysis and backtesting.

Instructions

Retrieve historical price bars (OHLCV) for one or more stocks.

When start is omitted, it is automatically computed as now minus the days/hours/minutes lookback.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endNoInclusive end time (RFC 3339). Omit for current time.
asofNoAs-of date (YYYY-MM-DD) for point-in-time symbol mapping. Useful for backtesting with historical ticker changes.
daysNoDays to look back when start is omitted (default 5).
feedNoData feed — "sip" (all US exchanges, default, paid), "iex" (IEX only, free tier), "otc", or "boats".
sortNoTimestamp sort order — "asc" (default) or "desc".asc
hoursNoAdditional hours in the lookback (default 0).
limitNoMax total data points returned across all symbols, 1–10000 (default 1000).
startNoInclusive start time (RFC 3339). Omit to use relative lookback.
minutesNoAdditional minutes in the lookback (default 0).
symbolsYesComma-separated tickers (e.g. "AAPL" or "AAPL,MSFT,GOOG").
currencyNoPrice currency (ISO 4217, e.g. "USD"). Default USD.
timeframeNoBar aggregation period — "1Min", "5Min", "15Min", "30Min", "1Hour", "1Day", "1Week", or "1Month".1Day
adjustmentNoPrice adjustment — "raw", "split", "dividend", "spin-off", or "all". Comma-separated combos allowed (e.g. "split,dividend"). Default "raw".raw

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed13 schema fields changedv2.3.2
    • addedInput schema / properties / adjustment / description
      Added value: +"Price adjustment — \"raw\", \"split\", \"dividend\",\n        \"spin-off\", or \"all\". Comma-separated combos allowed\n        (e.g. \"split,dividend\"). Default \"raw\"."
    • addedInput schema / properties / asof / description
      Added value: +"As-of date (YYYY-MM-DD) for point-in-time symbol mapping.\n  Useful for backtesting with historical ticker changes."
    • addedInput schema / properties / currency / description
      Added value: +"Price currency (ISO 4217, e.g. \"USD\"). Default USD."
    • addedInput schema / properties / days / description
      Added value: +"Days to look back when start is omitted (default 5)."
    • addedInput schema / properties / end / description
      Added value: +"Inclusive end time (RFC 3339). Omit for current time."
    • addedInput schema / properties / feed / description
      Added value: +"Data feed — \"sip\" (all US exchanges, default, paid),\n  \"iex\" (IEX only, free tier), \"otc\", or \"boats\"."
    • addedInput schema / properties / hours / description
      Added value: +"Additional hours in the lookback (default 0)."
    • addedInput schema / properties / limit / description
      Added value: +"Max total data points returned across all symbols,\n   1–10000 (default 1000)."
    • addedInput schema / properties / minutes / description
      Added value: +"Additional minutes in the lookback (default 0)."
    • addedInput schema / properties / sort / description
      Added value: +"Timestamp sort order — \"asc\" (default) or \"desc\"."
    • addedInput schema / properties / start / description
      Added value: +"Inclusive start time (RFC 3339). Omit to use relative lookback."
    • addedInput schema / properties / symbols / description
      Added value: +"Comma-separated tickers (e.g. \"AAPL\" or \"AAPL,MSFT,GOOG\")."
    • addedInput schema / properties / timeframe / description
      Added value: +"Bar aggregation period — \"1Min\", \"5Min\", \"15Min\",\n       \"30Min\", \"1Hour\", \"1Day\", \"1Week\", or \"1Month\"."
  2. Addedv2.0.0

TDQS

A4.2/5.0
Behavior4/5

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

With readOnlyHint=true and openWorldHint=true already provided by annotations, the description adds useful behavioral context: when start is omitted, it is computed as now minus the days/hours/minutes lookback. This clarifies a non-obvious default behavior beyond what structured annotations convey.

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 two sentences with no filler. The core purpose is front-loaded, and the second sentence earns its place by explaining a key default behavior.

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

Completeness4/5

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

Given the rich input schema with 100% parameter coverage, the presence of an output schema, and read-only annotations, the description is largely sufficient. It could be slightly more complete with an explicit pointer to sibling tools for latest bars or trades, but nothing critical 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 description coverage is 100%, so the baseline is 3. The description adds value by synthesizing the interaction between start, days, hours, and minutes into a single behavioral rule, helping the agent understand how the relative lookback actually works.

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 uses a specific verb ('Retrieve') with a precise resource ('historical price bars (OHLCV) for one or more stocks'). This clearly distinguishes it from sibling tools like get_stock_latest_bar, get_crypto_bars, and get_option_bars by asset class and historical scope.

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

Usage Guidelines3/5

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

The description implies the tool is for historical stock bar data, but it does not explicitly state when to prefer this tool over alternatives like get_stock_latest_bar or get_stock_trades. There is no direct comparison or exclusion guidance.

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

Deploy Server

Other Tools