Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
UPSTOX_API_KEYYesYour Upstox API Key obtained from https://upstox.com/developer/
UPSTOX_API_SECRETYesYour Upstox API Secret obtained from https://upstox.com/developer/
UPSTOX_REDIRECT_URINoThe redirect URI for Upstox authenticationhttp://localhost:3000/callback

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
get_profileB

Get user profile information.

get_funds_marginA

Get available funds and margin. version v3 (default) = GET /v3/user/get-funds-and-margin (Api-Version 3.0); v2 supports the optional segment SEC (equity) or COM (commodity).

get_holdingsB

Retrieve long-term DEMAT holdings.

get_positionsB

Get current intraday and delivery positions with P/L.

get_mtf_positionsB

Get Margin Trade Funding positions.

convert_positionC

Convert position product type (e.g., intraday to delivery).

place_orderC

Place a new order (market, limit, stop-loss, bracket).

modify_orderC

Modify an existing open order.

cancel_orderC

Cancel a pending order.

get_order_bookA

Get all orders for the day (open, pending, filled, cancelled).

get_order_detailsC

Get details of a specific order by order_id.

get_order_historyC

Get order state history by order_id or tag.

get_tradesB

Get all executed trades for the day.

get_order_tradesC

Get trades for a specific order.

exit_positionsB

Exit all open positions (square off).

get_market_quoteB

Full market quote with OHLC, depth, volume. Up to 500 instruments.

get_ltp_quotesC

Last Traded Price for up to 1000 instruments (v3).

get_ohlc_quotesC

OHLC quotes for up to 1000 instruments (v3). interval: 1d (default), I1 (1-minute) or I30 (30-minute).

get_historical_candlesA

Get historical OHLCV candles (Upstox v3). Returns [timestamp, open, high, low, close, volume]. Use interval (legacy names) OR unit+interval_value. Units: minutes 1-300, hours 1-5, days/weeks/months 1. Max range per request: 1 month for minutes 1-15; 1 quarter for minutes >15 and hours; 1 decade for days. from_date is optional (defaults to to_date).

get_intraday_candlesA

Get today's intraday candles (Upstox v3). Use interval (legacy names) OR unit+interval_value (minutes 1-300, hours 1-5, days 1).

get_option_contractsC

Get option contracts for an underlying instrument.

get_option_chainC

Get put/call option chain.

calculate_marginC

Calculate required margin for instruments (max 20).

get_brokerageC

Get brokerage charges for a trade.

get_trade_pnlC

Get trade-wise profit and loss data.

get_market_holidaysB

Get list of market holidays, or only the given date (path segment /v2/market/holidays/{date}).

get_market_timingsB

Get exchange market timings.

get_full_quote_v3C

Full market quote (OHLC, depth, volume) via v3, up to 500 instruments.

get_option_greeksB

Option greeks (delta, gamma, theta, vega, IV) for up to 50 option instruments.

get_pnl_metadataC

Trade P&L metadata (counts/totals) for a segment and financial year.

get_pnl_chargesC

Charges and taxes breakdown for realised P&L in a segment and financial year.

get_historical_tradesC

Historical executed trades between two dates (paginated).

get_expired_expiriesC

List expired expiry dates available for an underlying instrument.

get_expired_option_contractsC

Expired option contracts for an underlying on a given expiry.

get_expired_future_contractsC

Expired future contracts for an underlying on a given expiry.

get_expired_historical_candlesB

Historical candles for an expired instrument key (from the expired contract listings).

get_exchange_statusB

Current trading status of an exchange (e.g. NSE, BSE, NFO, BFO, MCX).

search_instrumentsC

Search instruments by text. exchanges/segments/instrument_types are comma-separated lists; records max 30.

get_gtt_ordersA

Read-only: list GTT orders, or fetch one by gtt_order_id.

get_kill_switch_statusC

Kill-switch status per segment.

get_static_ipsC

Static IPs registered for the account/app.

get_newsC

News feed. category: instrument_keys (requires instrument_keys, max 30), positions, or holdings.

get_iposC

IPO listings. status: open|closed|listed|upcoming; records max 30.

get_mf_holdingsC

Mutual fund holdings.

authorize_market_feedA

Get a one-time wss:// URL for the v3 market data feed. Not cached; single use.

authorize_portfolio_feedA

Get a one-time wss:// URL for the portfolio stream feed. update_types: comma list of order,gtt_order,position,holding. Not cached.

get_open_interestC

Option OI by strike for an underlying (GET /v2/market/oi).

get_change_in_oiC

Change in option OI over N days (GET /v2/market/change-oi).

get_pcrC

Put-call ratio with intraday insights (GET /v2/market/pcr). bucket_interval is minutes between points (e.g. 60).

get_max_painC

Max pain with intraday insights (GET /v2/market/max-pain). bucket_interval is minutes between points (e.g. 60).

get_fii_activityA

FII activity (GET /v2/market/fii). 1D: up to 30 trading days; 1M: up to 12 months; data from 2026-04-01.

get_dii_activityB

DII activity (GET /v2/market/dii), cash segment only. 1D: up to 30 trading days; 1M: up to 12 months.

get_key_ratiosA

Company key ratios vs sector (P/E, P/B, ROA, ROE, ROCE, EV/EBITDA) by ISIN (GET /v2/fundamentals/{isin}/key-ratios).

get_token_statusB

Token health: preview, expiry (ISO + IST), expired flag, renewal strategy, pending request, auth-port ownership, scheduler state. Never returns secrets.

renew_tokenA

Renew the access token now using the configured strategy: TOTP login (UPSTOX_TOTP_SECRET+UPSTOX_PIN) -> Access Token Request (UPSTOX_NOTIFIER_ENABLED=1) -> OAuth login URL. WARNING: TOTP login revokes the current token. force=true bypasses the 2-minute throttle and the 3-failure pause.

request_access_tokenA

Send an Access Token Request (v3): you approve a notification in the Upstox app/WhatsApp, then Upstox POSTs the token to the Notifier Webhook (needs UPSTOX_NOTIFIER_ENABLED=1 and a registered public webhook URL). force=true resends even if one is pending.

logoutA

Log out: DELETE /v2/logout (invalidates the access token) and clear it from .env. With auto-renewal enabled, the scheduler may obtain a new token shortly after.

start_auth_serverA

Start the embedded auth helper (OAuth /login + /callback, /status) on AUTH_PORT (currently 9080). Returns the login URL. Only one process sharing the .env can own the port; owns_port tells you whether this one does. Stays up until stop_auth_server or process exit.

stop_auth_serverA

Stop the embedded auth helper in this process if it owns it, releasing AUTH_PORT (currently 9080) and stopping the token-renewal scheduler.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

C2.9/5.0

Scored across 59 tools

Disambiguation3/5

Most tools target clear resource+action pairs, but several clusters overlap heavily: get_market_quote vs get_full_quote_v3 (near-identical v1/v3 full quotes), get_ltp_quotes/get_ohlc_quotes, and get_order_book vs get_order_details vs get_order_history vs get_trades vs get_order_trades require careful reading to select correctly. The auth cluster (renew_token, request_access_token, start_auth_server, get_token_status) is distinguishable but dense. Descriptions help, but an agent can easily pick the wrong quote or trade-listing tool.

Naming Consistency4/5

Strong, predictable snake_case verb_noun pattern throughout (get_*, place_*, modify_*, cancel_*, convert_*, authorize_*), with only minor deviations like get_full_quote_v3 and get_mtf_positions embedding version/qualifier tokens. Readable and largely uniform.

Tool Count2/5

59 tools is far beyond a comfortable surface for one agent to navigate, and the count is inflated by versioned duplicates (get_market_quote vs get_full_quote_v3) and many narrow single-endpoint wrappers (get_pcr, get_max_pain, get_change_in_oi, get_fii_activity, get_dii_activity, get_key_ratios). The domain is broad, but the surface is over-fragmented rather than consolidated.

Completeness4/5

Coverage is unusually broad for a broker server: order lifecycle (place/modify/cancel), positions, holdings, funds, margin, quotes, candles, options/greeks, fundamentals, news, IPOs, MF holdings, and auth/token management are all present. Gaps remain: GTT orders are read-only (no create/modify/cancel), and streaming is limited to one-time URL authorization rather than actual subscription tools.