MCP Tools Reference

TradeStaq's MCP server exposes 47 tools organized into 10 categories. Each tool can be called by any MCP-compatible AI client.

Authentication Scopes

For remote OAuth clients, tokens carry one of three scopes, hierarchical — mcp:live implies mcp:paper implies mcp:read. Session-cookie (dashboard) users bypass scope checks entirely.

ScopeMeaning
mcp:readView-only. Safe for research agents — no writes, no trades, no charges.
mcp:paperRead + paper-trade writes (paper exchanges, paper bots). Cannot touch live money.
mcp:liveRead + paper + live-money writes (live deploys, live exchange connections, wallet-charging tools).

When a call needs a scope your token doesn't hold, the server returns 403 insufficient_scope. check_auth returns your current token's scope, tier capabilities, and Strategy Lab wallet balance — call it first to preflight what you can do before attempting a paid or live-money action. See Authentication for the full OAuth flow.

Tools that charge your Strategy Lab wallet (generate_strategy, start_optimization_run) follow a two-step confirm pattern: call once without acknowledgeCost to get a cost estimate with nothing charged or queued, then call again with acknowledgeCost: true after the user approves the spend.


Authentication (7 tools)

login

Sign in with email and password credentials. Returns an authentication token for subsequent requests.

ParameterTypeRequiredDescription
emailstringYesTradeStaq account email
passwordstringYesAccount password

authenticate

Start a browser-based OAuth flow — opens a login page in your browser, you authenticate there, and the token is saved automatically. No credentials enter the chat.

ParameterTypeRequiredDescription
scopestringNoOAuth scope to request: mcp:read, mcp:paper (default), or mcp:live.

check_auth

Preflight check before invoking other tools. Returns the authenticated user, OAuth scope on the current token, tier capabilities (allowLiveTrading, allowAIBuilder, allowNewsTrading, allowMcpServer), Strategy Lab wallet balance, and the OAuth client name/expiry. Cached server-side for 30 seconds per token.

ParameterTypeRequiredDescription
———No parameters required

set_token

Manually set a JWT token for the current session — for headless environments, CI/CD, or passing tokens between systems.

ParameterTypeRequiredDescription
tokenstringYesJWT authentication token

connect_exchange

Connect a real exchange account with API credentials. Supports Binance, Bybit, OKX, Hyperliquid, and 10+ others. Keys are encrypted and never exposed back to the client.

ParameterTypeRequiredDescription
exchangestringYesExchange identifier (e.g. binance, bybit, okx, hyperliquid)
apiKeystringYesYour exchange API key
apiSecretstringYesYour exchange API secret
passphrasestringNoRequired for OKX, KuCoin
walletAddressstringNoRequired for Hyperliquid, dYdX

create_paper_exchange

Create a paper-trading exchange with a simulated balance — no API keys required. Lets an agent test strategies, deploy bots, and place trades without risking real money.

Scope: mcp:paper or mcp:live. Session-cookie (dashboard) users can always call this.

ParameterTypeRequiredDescription
platformstringYesExchange to simulate (e.g. binance, bybit, okx, hyperliquid)
exchangeTypestringNo"spot" or "futures" (default: "spot")
accountLabelstringNoFriendly name for this paper account
initialBalanceUsdtnumberNoSimulated starting balance in USDT (default: 10000)

logout

Sign out and invalidate the current session token.

ParameterTypeRequiredDescription
———No parameters required

Market Data (4 tools)

get_price

Get the current real-time price for a trading pair on a specific exchange — bid, ask, last price, 24h change.

ParameterTypeRequiredDescription
symbolstringYesTrading pair (e.g. BTC/USDT)
exchangestringNoExchange to fetch from (default: binance)

get_candles

Fetch historical OHLCV candlestick data for a trading pair — for technical analysis, backtesting prep, or trend review.

ParameterTypeRequiredDescription
symbolstringYesTrading pair (e.g. BTC/USDT)
exchangestringNoExchange to fetch from (default: binance)
timeframestringNoCandle timeframe: 1m, 5m, 15m, 1h, 4h, 1d (default: 1h)
limitnumberNoNumber of candles to return (default: 100)

list_exchanges

List every exchange TradeStaq supports, including markets, connection status, and feature support.

ParameterTypeRequiredDescription
———No parameters required

search_markets

Search for trading pairs across all connected exchanges.

ParameterTypeRequiredDescription
querystringYesSearch query (e.g. BTC, SOL/USDT, ethereum)
exchangestringNoFilter by exchange

Portfolio (2 tools)

get_portfolio

View total balance, holdings, allocation, and 24h P&L across all connected exchanges.

ParameterTypeRequiredDescription
exchangestringNoFilter by specific exchange

get_positions

List all open trading positions — entry price, current P&L, leverage, margin, liquidation price.

ParameterTypeRequiredDescription
exchangestringNoFilter by specific exchange

Strategies (12 tools)

list_strategies

Browse strategies — either the public marketplace or your own library.

ParameterTypeRequiredDescription
ownedbooleanNotrue = your own strategies; false (default) = public marketplace
marketstringNoFilter by market type: spot, futures, both
categorystringNoFilter by category, e.g. official, community, custom
statusstringNoowned:true only — filter by status (comma-separated)
pricingstringNoowned:false only — filter by free/paid
searchstringNoFilter by name/description substring
sortstringNoSort order (varies by owned)
limitnumberNoMax results, 1-100 (default: 50)

get_strategy

Get full details for a strategy by ID — description, market/timeframe, performance stats, rating, and (if you own it or it's forkable) the code.

ParameterTypeRequiredDescription
idstringYesStrategy ID

explain_strategy

Get a plain-English explanation of what a strategy does, its risk profile, and the market conditions it suits.

ParameterTypeRequiredDescription
idstringYesStrategy ID

compare_strategies

Compare 2-5 strategies side by side on ROI, max drawdown, win rate, Sharpe ratio, rating, and active bot count.

ParameterTypeRequiredDescription
idsstring[]Yes2-5 strategy IDs to compare

create_strategy

Save a new strategy from existing TradeDroid code to your library. Use this when you already have the code (hand-written, or produced by generate_strategy).

ParameterTypeRequiredDescription
namestringYesDisplay name
descriptionstringNoPlain-English summary
codestringYesTradeDroid strategy code (JavaScript)
marketstringNo"spot" or "futures" (default: futures)
timeframestringNoPrimary candle timeframe (default: 1h)

update_strategy

Update one of your own strategies — name, description, category, tags, or the code itself. Code edits write to a draft version only; nothing live changes until you promote it.

ParameterTypeRequiredDescription
idstringYesStrategy ID to update
namestringNoNew display name
descriptionstringNoNew description
categorystringNoNew category
marketstringNoNew market type
tagsstring[]NoReplace the strategy's tags
codestringNoNew strategy code — saved as a draft version
statusstringNoAdvance the publish workflow: draft→testing, testing→draft/live, live→testing/listed, listed→live

generate_strategy

Generate a complete strategy from a natural-language description using AI (FORGE) — no coding required.

Scope: mcp:live. Wallet-charging — see Authentication Scopes above for the two-step confirm pattern.

ParameterTypeRequiredDescription
descriptionstringYesNatural-language description of the strategy
marketstringNo"spot" or "futures" (default: futures)
timeframestringNoPrimary candle timeframe (default: 1h)
acknowledgeCostbooleanNoConfirm the wallet charge to actually generate

list_strategy_versions

List the full version history for one of your own strategies — every stored version, its validation status, and which channel (stable, beta, or none) it currently serves. stable is what every bot without a channel override actually runs.

ParameterTypeRequiredDescription
idstringYesStrategy ID

validate_strategy_version

Run the automated validation pipeline (syntax check, entry/exit logic check, quick real-data backtest) against the current draft version of a strategy. Required before that version can be promoted to stable. Async — poll list_strategy_versions and watch validationStatus go pending → running → passed/failed.

The backtest runs on the version's own primary timeframe (falling back to the strategy's, then 1h) with its multi-timeframe config, over a bounded window of about 2,160 candles capped at 90 days: 2 days of 1m, 8 of 5m, 23 of 15m, 45 of 30m, 90 of 1h and above. The window stretches to cover at least 20 candles of the highest MTF timeframe, but never past 8,640 candles.

ParameterTypeRequiredDescription
idstringYesStrategy ID whose latest/draft version to validate
exchangeIdstringYesAn exchange you own — sources historical candle data only, no real orders placed
symbolstringYesTrading pair to validate against, e.g. BTC/USDT
timeframestringNoOverride the backtest timeframe: 1m, 5m, 15m, 30m, 1h, 4h, 1d or 1w. Defaults to the version's primary timeframe
daysnumberNoOverride the backtest length, 1–90 days (at most 8,640 candles). Defaults to the bounded window above

compare_strategy_versions

Backtest a candidate version and the current stable version on the same candles, score both the way the Strategy Lab optimizer does, and judge whether the candidate is worse. Async: it returns a jobId at once; poll get_version_comparison every 30-60 seconds. A run takes from a few minutes to about two hours (6 pairs x 2 years of 4h is 12 backtests), and is cut at 120 minutes. Free: not billed, not counted against backtest quotas, and no orders are placed. One comparison queued or running per user. Only the strategy's author (or an admin) can run it.

ParameterTypeRequiredDescription
idstringYesStrategy ID
candidateVersionIdstringNoVersion to judge (default: the latest version)
baselineVersionIdstringNoVersion to compare against (default: the current stable version)
exchangeIdstringNoAn exchange you own, used only for candles (default: the candidate's validation exchange, then the baseline's)
symbolsstring[]No1-8 pairs to test on (default: the validation symbol)
timeframestringNo1m, 5m, 15m, 30m, 1h, 4h, 1d or 1w (default: the candidate's primary timeframe, then the baseline's, then 4h)
daysnumberNoWindow length ending now, 7-730 days (default: 180). At most 20,000 candles per pair, so 15m caps at 208 days
scoringProfilestringNobalanced, conservative, aggressive or consistency (default: balanced)
presetIdstringNoA bot preset of this strategy. Both versions run with its parameter overrides on top of their own defaults (only parameters the version declares; an invalid choice keeps the default), and with its position size and, for a futures preset, its leverage. Default: both run on their own defaults with the lab's 5% size and no leverage. Active bots on the preset that run on code defaults (deployed with a legacy string or empty overrides) are not described by the result; the caveat preset_bots_on_code_defaults: <n> counts them

Verdict. Each pair is scored per version, and the pairs are compared the way the optimizer judges a candidate against its baseline. The verdict is worse when the candidate is newly disqualified on a pair, loses money where the stable version did not, collapses on a pair, loses more pairs than it wins, becomes undersampled where the stable version was not, or its blended score falls below the stable version's. It is inconclusive when any pair errored or did not run, better when the blended score rises clearly and it wins more pairs than it loses, and not_worse otherwise. Both versions run with the same parameters source (their own defaults, or the preset's overrides) on the same full window, so the result is in-sample: it compares the two versions on history, it does not predict live results. The caveats list says so, and flags overlap with the window the candidate was optimized on.

get_version_comparison

Poll a comparison started with compare_strategy_versions. Returns the status and progress while it runs; once completed, per-pair and total metrics and scores for both versions side by side, the verdict with its reasons, the caveats, and freshness: whether the stable version is still the one compared against and whether either version was edited since. freshness.promotable is true only when the comparison would pass the promote gate at the default tolerance. A comparison stuck for 20 minutes without progress is reported as failed.

ParameterTypeRequiredDescription
idstringYesStrategy ID
versionIdstringNoThe candidate version (default: the latest version)

promote_strategy_version

Promote a specific version to the stable or beta channel. Promoting to stable is the step that actually changes the code every bot on the default channel runs — editing (update_strategy) or validating a version has no effect on deployed bots until this is called. stable requires validationStatus: 'passed'; beta has no gate.

With requireComparison: true, a stable promote is refused (409) unless a completed compare_strategy_versions run of exactly this version against exactly the current stable version, with neither edited since, judges it not worse. The refusal carries a code (comparison_missing, comparison_running, comparison_failed, comparison_stale_baseline, comparison_preset_mismatch, comparison_stale_preset, comparison_stale_inputs, comparison_inconclusive or comparison_worse) and the comparison summary. A comparison counts only for the preset it ran with: pass the same presetId to promote on a preset comparison; without presetId only a comparison run without a preset counts. Recommended flow: compare_strategy_versions, poll get_version_comparison until completed, then promote with requireComparison: true.

ParameterTypeRequiredDescription
idstringYesStrategy ID
versionIdstringYesThe specific version to promote, from list_strategy_versions
channelstringYes"stable" or "beta"
requireComparisonbooleanNoStable only: refuse unless a fresh comparison says this version is not worse than the current stable version (default: false)
minScoreDeltanumberNoStable only, -100 to 100: the candidate's blended score minus the stable version's must be at least this (default: 0). Passing it turns requireComparison on
presetIdstringNoStable only: the comparison must have been run with this preset, still holding the same values. Passing it turns requireComparison on
forcebooleanNoPromote even when the comparison gate refuses (reported as forced). Overrides only the comparison gate, never validation. Confirm with the user first

Strategy Lab (4 tools)

AI-powered strategy optimization — see the Strategy Lab overview for how the underlying engine works. Every capability here is also available from the dashboard.

start_optimization_run

Start an AI optimization run on one of your own strategies — repeatedly mutates the code, backtests each variant, and keeps only the improvements, walk-forward validated on data no experiment trained on. This is different from generate_strategy, which writes one new strategy from a description; this iteratively improves an existing strategy you already own.

Scope: mcp:live. Wallet-charging per experiment — see Authentication Scopes above. Only one run can be active per user at a time.

ParameterTypeRequiredDescription
strategyIdstringYesID of your own strategy to optimize
exchangeIdstringYesAn exchange you own — sources historical candle data
symbolstringNoTrading pair to optimize against (default: BTC/USDT when symbols is not given; with symbols, it only picks the primary pair when it is one of symbols, otherwise it is ignored)
symbolsstring[]NoPairs to test on, primary first, same exchange account and market type (max: your plan's cap, Free 1 / Pro 3 / Trader 4 / Whale 5). Combinable with searchPresets once an admin prices the multi-pair preset search: every candidate is then tested on every pair, and the search is priced per pair
timeframestringNoCandle timeframe (default: 1h)
maxExperimentsnumberNoMutate-and-backtest experiments to run, 1-30 (default: 20)
scoringProfilestringNobalanced, conservative, aggressive, or consistency (default: balanced)
startDate / endDatestringNoISO dates for the backtest window (default: last 6 months)
trainSplitnumberNoFraction used for training vs. out-of-sample validation, 0.5-0.9 (default: 0.7)
userGuidancestringNoFree-text steering for the AI mutations (max 2000 chars)
autoPromotebooleanNoAuto-promote the result to stable if it clears a strict validation bar (default: false)
acknowledgeCostbooleanNoConfirm the wallet charge to actually start the run
quoteIdstringNoMulti-pair runs: the quoteId from the approved cost estimate
acknowledgedCostnumberNoMulti-pair runs: the approved estimatedCost, used if the quote expired (the run starts only if the fresh price is not higher)

Multi-pair runs. With more than one pair in symbols, every candidate is tested on every pair. Pricing is $0.50 per experiment plus $0.10 per extra pair per experiment (up to $27 for 5 pairs x 30 experiments), billed per pair actually evaluated. The first call always returns a cost_estimate with a quoteId, the pairs, the maximum cost and an estimatedMinutes time estimate; a run time limit may cut the experiments requested (clampedFrom). Confirm by re-sending the same arguments with acknowledgeCost: true and the quoteId; the bill is never above the quote. If the price rose or the arguments changed, the response is a fresh estimate with quoteChanged: true to confirm again. A multi-pair result is only adopted if it beats the original on most pairs, wrecks no pair and loses money out of sample on no pair; otherwise it is held for you to review.

get_optimization_status

Check progress of a run started with start_optimization_run. Each experiment typically takes 1-2+ minutes — poll every 15-30 seconds rather than tight-looping. A completed or failed run stays queryable for 24 hours. Multi-pair runs report per-pair results (progress.bestPerAsset against progress.baselinePerAsset, and progress.validation.perAsset), and a run waiting to start shows its queue position and etaMinutes.

ParameterTypeRequiredDescription
jobIdstringYesJob ID returned by start_optimization_run

cancel_optimization_run

Cancel a run you started. Takes effect after the current experiment finishes, not instantly — confirm with get_optimization_status. The best version found so far is kept but held, so the strategy only changes if you accept it.

ParameterTypeRequiredDescription
jobIdstringYesJob ID to cancel

send_optimization_guidance

Inject live, free-text steering into a running optimization. Applies starting with the next experiment, not the one in flight — overwrites any previously-injected guidance for this run.

ParameterTypeRequiredDescription
jobIdstringYesJob ID to steer
guidancestringYesFree-text guidance for the AI (max 2000 chars)

Backtesting (3 tools)

what_if_backtest

Run a backtest on a strategy against historical data. Async, typically 30-120 seconds.

ParameterTypeRequiredDescription
strategyIdstringYesStrategy to backtest
symbolstringYesTrading pair
exchangestringYesExchange account ID for market data
timeframestringNoCandle timeframe (default: 1h)

get_backtest_results

Check status and results of a previously started backtest.

ParameterTypeRequiredDescription
jobIdstringYesBacktest job ID

export_backtest

Get export links for a completed backtest — CSV and PDF download URLs.

ParameterTypeRequiredDescription
idstringYesBacktest ID

Bot Management (9 tools)

list_bots

List all your bots with status and performance.

ParameterTypeRequiredDescription
statusstringNoFilter by status (running, stopped, error)

get_bot_status

Get detailed status, configuration, and live performance for a specific bot — run status, strategy/symbol/exchange, paper or live, P&L, win rate, trade count, risk config. Read-only.

ParameterTypeRequiredDescription
idstringYesThe bot ID to inspect

deploy_bot

Deploy a strategy as a trading bot. Defaults to paper trading for safety — whether a bot trades real money is determined by the exchange account it's attached to, not by a flag alone.

Scope: mcp:paper for a paper exchange target; mcp:live for a live exchange target.

ParameterTypeRequiredDescription
strategyIdstringYesStrategy to deploy
exchangeIdstringYesExchange account ID
symbolstringYesTrading pair
marketstringNo"spot" or "futures" (default: spot)
livebooleanNoMust match the target exchange's own paper/live status (default: false)
positionSizePercentnumberNoPosition size as % of account balance (default: 10)
stopLoss / takeProfitnumberNoRisk parameters, e.g. 5 for 5%

start_bot

Activate a bot so it starts opening new positions on its next scheduled interval. Newly deployed bots come up paused by default.

ParameterTypeRequiredDescription
idstringYesThe bot ID to activate

stop_bot

Stop a bot from opening new positions. Existing open positions stay open — close those separately with close_position. Reversible; restart with start_bot.

ParameterTypeRequiredDescription
idstringYesThe bot ID to stop

update_bot

Edit a deployed bot without redeploying it: rename it, switch it to another strategy or apply a preset, change its timeframe, execution mode or strategy parameters, or adjust its risk settings, notifications and stop-after-close. Everything you pass goes in one update, so a strategy switch never lands half-done.

  • Merging. The bot's current settings are read first and your changes go on top: position sizing, spin settings and parameter overrides are merged, never wiped by a partial change.
  • Size and leverage change only when you pass positionSizePercent / leverage, also when you switch strategy or apply a preset.
  • Strategy or timeframe changes need the bot to be flat (no open position, no working order). Otherwise the change is refused with OPEN_POSITION and nothing is written: the new strategy would adopt a position it did not open. Pause it first with stopAfterClose: true, wait until get_bot_status shows no open position, then switch. A switch starts the strategy state over and drops the old strategy's parameters, preset and stale owed exits. A paused bot stays paused: start it with start_bot.
  • Presets. presetId applies the preset as the dashboard does when you pick it: its strategy, parameter overrides, timeframe, execution mode and interval, and version. Anything you pass explicitly wins.
  • Returns the resulting configuration (strategy, version and channel, timeframe, mode, parameter overrides, size, leverage, status) and any server warnings, such as the exchange not having enough candle history.

Scope: mcp:paper for a paper bot; any change to a live bot (including a rename) needs mcp:live.

ParameterTypeRequiredDescription
idstringYesThe bot ID to update
namestringNoNew bot name
strategyIdstringNoSwitch to this strategy (ID or slug, e.g. trade-wind). The bot must be flat
presetIdstringNoApply a bot preset (ID or slug, e.g. trade-wind-long-short)
versionChannelstringNostable (default for a switch), beta, latest or custom
pinnedVersionIdstringNoPin a strategy version (sets custom)
timeframestringNoCandle timeframe, e.g. 15m, 1h, 4h. The bot must be flat
executionModestringNoon_bar_close (once per closed candle) or continuous
spinIntervalSecondsnumberNoRun interval in seconds
parameterOverridesobjectNoStrategy parameters to set, merged into the current ones; null removes one
resetParameterOverridesbooleanNoDrop all current parameter overrides first
leveragenumberNoNew leverage (futures only)
positionSizePercentnumberNoNew position size as % of account balance
stopLoss / takeProfitnumberNoNew risk parameters
notifyOnTradebooleanNoSend a Telegram notification per trade
stopAfterClosebooleanNoKeep managing the open position, open nothing new, pause once flat

delete_bot

Permanently delete a bot and its configuration — irreversible. Refused if the bot still has an open trade recorded; close_position and stop_bot it first.

ParameterTypeRequiredDescription
idstringYesThe bot ID to delete

export_bot_trades

Export a bot's trade history — every closed trade with entry/exit prices and P&L, plus a performance summary.

ParameterTypeRequiredDescription
idstringYesThe bot ID whose trades to export
formatstringNo"summary" (default) or "full"

close_position

Close an open position at market price, fully or partially. Moves real money when the position is live.

ParameterTypeRequiredDescription
exchangeIdstringYesExchange account ID where the position is open
symbolstringYesTrading pair, e.g. BTC/USDT
sidestringYes"long" or "short"
percentagenumberNoPercentage to close, 1-100 (default: 100)

Trade History (2 tools)

get_trade_history

View complete trade history — entry/exit prices, P&L per trade, timestamps, triggering strategy.

ParameterTypeRequiredDescription
botIdstringNoFilter by bot ID
exchangestringNoFilter by exchange
limitnumberNoNumber of trades to return (default: 50)

get_performance_metrics

Get aggregated performance metrics — total P&L, win rate, average return, Sharpe ratio, max drawdown — over 7d/30d/90d windows.

ParameterTypeRequiredDescription
periodstringNo7d, 30d, 90d, all (default: 30d)
botIdstringNoFilter by bot ID

Copy Trading (2 tools)

list_top_traders

Discover top-performing traders on the leaderboard — win rate, total return, drawdown, followers.

ParameterTypeRequiredDescription
periodstringNo7d, 30d, 90d (default: 30d)
limitnumberNoNumber of traders to return (default: 10)

follow_trader

Start copy trading a top-performing trader — their trades mirror automatically on your connected exchange.

Scope: mcp:paper for a paper exchange target; mcp:live for a live exchange target.

ParameterTypeRequiredDescription
traderIdstringYesThe trader ID or alias to follow
exchangestringYesExchange to copy trades on
amountnumberYesMaximum position size per trade

AI Advisor (2 tools)

suggest_strategies

Get AI-powered strategy recommendations based on current market conditions, portfolio, and risk tolerance.

ParameterTypeRequiredDescription
riskLevelstringNoconservative, moderate (default), aggressive
marketstringNospot or futures

get_market_context

Get a real-time market analysis snapshot — trend direction, volatility, support/resistance, sentiment.

ParameterTypeRequiredDescription
symbolstringYesTrading pair to analyze
exchangestringNoExchange for data (default: binance)

Next Steps