KB / mcp
MCP tool: get_quote
Last verified
get_quote returns last-price, bid, ask, volume, and daily change for one or more tickers. It dispatches to GET /api/v1/trading/quote/{symbol} for a single symbol or GET /api/v1/trading/quotes for a batch — the same routes Schwab-backed trading uses, with yfinance as the silent fallback when Schwab returns nothing.
Signature
get_quote(
symbols: str # comma-separated tickers, e.g. "SPY" or "SPY,QQQ,AAPL". Max 10.
) -> str # JSON-serialised dict or list
Parsing rules (mcp/mcp_server/tools/public.py:get_quote):
- Symbols are upper-cased and stripped before dispatch.
- Empty list after parsing →
ValueError("At least one symbol is required."). - More than 10 symbols →
ValueError("Maximum 10 symbols per request."). - Single-symbol calls hit the per-symbol route; multi-symbol calls hit the batch route.
Returns
Single symbol
{
"symbol": "SPY",
"last": 538.20,
"bid": 538.18,
"ask": 538.22,
"volume": 41_283_400,
"change": 2.15,
"change_pct": 0.40,
"as_of": "2026-05-26T10:14:33-04:00",
"source": "schwab"
}
Batch (2+ symbols)
{
"quotes": {
"SPY": { "last": 538.20, "bid": 538.18, "ask": 538.22, ... },
"QQQ": { "last": 471.05, "bid": 471.02, "ask": 471.08, ... },
"AAPL": { "last": 215.40, "bid": 215.37, "ask": 215.43, ... }
},
"as_of": "2026-05-26T10:14:33-04:00"
}
as_of is ET ISO 8601 with offset (Law 1). source is one of schwab / yfinance so an agent can see which provider answered.
Behaviour
- Cache TTL.
CACHE_TTL_QUOTE = 5s(mcp/mcp_server/config.py). The cache key sorts the symbol list, so"SPY,QQQ"and"QQQ,SPY"share a cache entry. - Schwab → yfinance fallback. When Schwab returns None / empty, the backend silently falls back to yfinance. The
sourcefield on each quote names the provider that actually answered — never a silent degradation. - Read-only, no auth. The route is public; no
TRADING_TOKENrequired. - Stock and ETF only. For option prices, use
option_chaininstead.
Examples
Single quote
Operator: "What's SPY trading at?"
Agent: get_quote(symbols="SPY")
Multi-symbol compare
Operator: "Compare AAPL, MSFT, and GOOGL right now."
Agent: get_quote(symbols="AAPL,MSFT,GOOGL")
Returns the batch shape so the agent can read prices side-by-side in one round-trip.
Pre-trade price check
Agent: get_quote(symbols="SPY")
-> last 538.20, change +0.40%
Agent: plan_trade(symbol="SPY", side="buy", quantity=10)
When to use
- Confirming a price before quoting one to the operator.
- Refreshing position values during a portfolio review.
- Comparing multiple tickers in one round-trip.
When NOT to use
- You need option prices, Greeks, or open interest — use
option_chain. - You need the broader market context — use
market_pulse. - You’re about to call
plan_tradeand don’t actually need the price displayed —plan_tradequotes its own locked price.
See also
option_chain— option contracts with Greeks for the same underlying.market_pulse— market-wide regime + key numbers.plan_trade— quote a price AND lock it for 60s in one call.- Implementation:
mcp/mcp_server/tools/public.py:get_quote, backend routesGET /api/v1/trading/quote/{symbol}andGET /api/v1/trading/quotes.