MCP Tools Reference

TradeStaq's MCP server exposes 45 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 (10 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 pendingrunningpassed/failed.

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

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.

ParameterTypeRequiredDescription
idstringYesStrategy ID
versionIdstringYesThe specific version to promote, from list_strategy_versions
channelstringYes"stable" or "beta"

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)
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

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.

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. Any improvement already saved stays saved.

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

Update a bot's risk configuration — leverage, position size, stop loss, take profit, or trade notifications — without redeploying it.

ParameterTypeRequiredDescription
idstringYesThe bot ID to update
leveragenumberNoNew leverage (futures only)
positionSizePercentnumberNoNew position size as % of account balance
stopLoss / takeProfitnumberNoNew risk parameters
notifyOnTradebooleanNoSend a Telegram notification per trade

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