Skip to main content
Glama

BotSpot: AI Trading, Backtests and Bots

Start a backtest

start_backtest
Destructive

Start a new backtest for a revision with the provided date range. ASYNC: This starts a job and returns immediately with a backtest id. backtest_status and artifact tools expose the current state for that id. Backtests are asynchronous and can consume material runtime capacity. Follow the user's instructions about whether to start one. This tool does not create or update visible plan items. Its structured result factually reports the backtest id, revision id, durable external wait id (when created), and Agent run status. Describe only configuration established by the saved revision, submitted parameters or returned result. A start acknowledgment does not establish a restricted seed universe, sampled symbols, completed research, fills or cross-iteration memory. Treat unreturned setup details as unverified; never invent a validation universe that the saved strategy does not define. If revisionId is missing, call list_backtests first and use the Tool IDs section to obtain revisionId/aiStrategyId/strategyId. IMPORTANT: This tool always uses the conversation's configured data provider (defaults to 'botspot_auto' if none is set). Do not call set_data_provider merely to reselect the default. Only when the requested provider is available according to its advertised availability constraints, call set_data_provider first to honor an explicit provider change (inside BotSpot chat you cannot pass a provider directly to this tool). Do not call either tool to probe a provider already declared OFF. Explain that no source changed and no backtest started, offer a supported alternative for the saved assets, and ask which route to use. MCP clients without a BotSpot chat conversation (Claude, ChatGPT, Codex) cannot call set_data_provider; they pass dataProvider (for example alpaca or polygon) on this call instead. The revisionId must be the id from the most recent successful file mutation or readback in this workflow. Every later file mutation supersedes every earlier revision id, even when the later mutation edits the same file. Optional: Provide budget (starting cash) to run the backtest as-if the account started with that amount. This sets BACKTESTING_BUDGET in the backtest environment so it works without modifying strategy code. Use envVarSetIds for saved runtime secrets and data-provider API keys. Do not pass raw env vars, botConfig, API keys, CSV rows, JSON row dumps, workbook data, or inline secret material. Create one saved environment variable at a time with saved_env_vars(action="create") first, then pass returned ids here. Optional: Provide parameters (dict) to override strategy parameters at runtime (e.g. ALLOCATION, symbol, pct_to_trade). BotSpot saves them as an immutable strategy parameter set that can be reused by a backtest or live bot. You may instead pass strategyParameterSetId for this exact saved revision.

IMPORTANT - Handling DATA_ACCESS_REQUIRED errors: If you receive a DATA_ACCESS_REQUIRED or TRIAL_RANGE_EXCEEDED error, this means the user's trial has expired or they need to purchase access. DO NOT attempt to switch to a different data provider (like Polygon or Alpaca) - the user needs to UPGRADE their access to the current provider. Explain that they need to unlock the data add-on for the provider being used (e.g., Theta Data Options). A modal will appear automatically to help them purchase access - do NOT suggest switching providers as a workaround.

IMPORTANT - Handling DATA_PROVIDER_UNAVAILABLE and OPTIONS_DATA_SOURCE_REQUIRED: These mean the data source cannot return data right now (Theta Data is off), so no backtest was started. Do not retry the same backtest. Tell the user plainly what happened and list the alternatives from the result: BotSpot Auto for stocks, indexes, crypto and futures; for options, the user's own connected Alpaca account or their own Polygon API key. On Alpaca or Polygon, index data such as VIX or SPX still works: BotSpot supplies it automatically. When the result has a step marked customerActionNeeded false, do it and start again, then say which data source ran. Otherwise ask which one they want, then call set_data_provider. Never describe this as a problem with their strategy.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "startDate": "<startDate>",
      "endDate": "<endDate>"
    },
    "name": "start_backtest"
  }
}

Input Schema

NameRequiredDescriptionDefault
cacheNoMarket-data cache for this one backtest. Leave unset (or "default") for normal runs. "off" is for measuring cold speed: the run skips the shared market-data cache and fetches from the data provider, so it is slower but the results are the same. backtest_status shows sharedCache "off" for such runs. The data provider may still keep its own caches.
budgetNoStarting cash for the backtest (in the quote currency, typically USD). Sets BACKTESTING_BUDGET in the backtest environment.
endDateYesThe last calendar day to simulate, inclusive. Preserve the requested last date; do not add a day as though this were an exclusive upper bound.
profileNoSet true to profile this backtest with yappi and find where the time goes (slow data calls, slow strategy code). Profiling makes the run slower, so leave it off for normal backtests. When the run finishes, read profile_yappi.csv with get_backtest_artifact and query_csv (columns: full_name, ncall, ttot_s, tsub_s, tavg_s; sort by ttot_s or tsub_s). Only for strategies whose code you own and can see.
startDateYesThe first calendar day to simulate, inclusive. Preserve the user-requested date, normally YYYY-MM-DD.
parametersNoStrategy parameters to override at runtime (e.g. ALLOCATION, symbol, pct_to_trade). BotSpot saves these as an immutable strategy parameter set reusable by backtests and live bots.
revisionIdNo
dataProviderNoOnly for MCP clients without a BotSpot chat conversation (Claude, ChatGPT, Codex): the data source for this backtest, e.g. botspot_auto, alpaca, kalshi, polygon, or projectx. Inside BotSpot chat, use set_data_provider instead; this field is refused there.
envVarSetIdsNoSaved BotSpot environment variable IDs to inject into the backtest runner. The MCP server never reads or exposes the saved values; BotSpot issues a short-lived runtime secret for the backtest.
dataConnectionIdNoSaved broker connection to supply this backtest history, such as Kalshi prediction contracts, Alpaca or ProjectX futures. Credentials and account mode come from the saved connection through its private runtime lease.
strategyParameterSetIdNoExisting immutable strategy parameter set for this exact saved revision.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / cache
      Added value: +{
      +  "description": "Market-data cache for this one backtest. Leave unset (or \"default\") for normal runs. \"off\" is for measuring cold speed: the run skips the shared market-data cache and fetches from the data provider, so it is slower but the results are the same. backtest_status shows sharedCache \"off\" for such runs. The data provider may still keep its own caches.",
      +  "enum": [
      +    "default",
      +    "off"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / profile
      Added value: +{
      +  "description": "Set true to profile this backtest with yappi and find where the time goes (slow data calls, slow strategy code). Profiling makes the run slower, so leave it off for normal backtests. When the run finishes, read profile_yappi.csv with get_backtest_artifact and query_csv (columns: full_name, ncall, ttot_s, tsub_s, tavg_s; sort by ttot_s or tsub_s). Only for strategies whose code you own and can see.",
      +  "type": "boolean"
      +}
  2. Changed2 schema fields changed
    • changedInput schema / properties / dataConnectionId / description
      Previous value: -"Saved broker connection to supply this backtest history, such as a ProjectX futures connection. Credentials stay private in its runtime lease."New value: +"Saved broker connection to supply this backtest history, such as Kalshi prediction contracts, Alpaca or ProjectX futures. Credentials and account mode come from the saved connection through its private runtime lease."
    • changedInput schema / properties / dataProvider / description
      Previous value: -"Only for MCP clients without a BotSpot chat conversation (Claude, ChatGPT, Codex): the data source for this backtest, e.g. botspot_auto, alpaca, polygon, or projectx. Inside BotSpot chat, use set_data_provider instead; this field is refused there."New value: +"Only for MCP clients without a BotSpot chat conversation (Claude, ChatGPT, Codex): the data source for this backtest, e.g. botspot_auto, alpaca, kalshi, polygon, or projectx. Inside BotSpot chat, use set_data_provider instead; this field is refused there."
  3. Changed2 schema fields changed
    • addedInput schema / properties / dataConnectionId
      Added value: +{
      +  "description": "Saved broker connection to supply this backtest history, such as a ProjectX futures connection. Credentials stay private in its runtime lease.",
      +  "format": "uuid",
      +  "type": "string"
      +}
    • changedInput schema / properties / dataProvider / description
      Previous value: -"Only for MCP clients without a BotSpot chat conversation (Claude, ChatGPT, Codex): the data source for this backtest, e.g. botspot_auto, alpaca, polygon. Inside BotSpot chat, use set_data_provider instead; this field is refused there."New value: +"Only for MCP clients without a BotSpot chat conversation (Claude, ChatGPT, Codex): the data source for this backtest, e.g. botspot_auto, alpaca, polygon, or projectx. Inside BotSpot chat, use set_data_provider instead; this field is refused there."
  4. Changed2 schema fields changed
    • addedInput schema / properties / endDate / description
      Added value: +"The last calendar day to simulate, inclusive. Preserve the requested last date; do not add a day as though this were an exclusive upper bound."
    • addedInput schema / properties / startDate / description
      Added value: +"The first calendar day to simulate, inclusive. Preserve the user-requested date, normally YYYY-MM-DD."
  5. First observed

TDQS

A4.5/5.0
Behavior4/5

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

The annotations already declare openWorldHint, non-idempotent and destructive, so the bar is lower, but the description still adds substantial behavior: it is asynchronous and returns immediately with a backtest id, consumes material runtime capacity, does not create plan items, and reports backtest id, revision id, external wait id and agent run status. It also enumerates the specific error classes (DATA_ACCESS_REQUIRED, TRIAL_RANGE_EXCEEDED, DATA_PROVIDER_UNAVAILABLE, OPTIONS_DATA_SOURCE_REQUIRED) and what to do with each, which no annotation conveys. The one gap is that the destructiveHint=true flag is never explained in terms of what capacity/state is actually consumed or whether runs are cancellable via `stop_backtest`.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The forward content is well front-loaded (what it does, async semantics, then error handling), and each block does carry information. However the description is sprawling relative to the tool: multiple all-caps IMPORTANT headers, a long paragraph of epistemic cautions about not inventing a validation universe, and repeated provider-selection advice inflate length and dilute the primary call instructions.

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?

For an 11-parameter asynchronous job with no output schema, the description covers the async contract, the shape of the structured result, the provider/auth requirements, and the main failure modes, so an agent can call it and interpret the acknowledgment correctly. It leaves some gaps around lifecycle — how long runs take, whether `stop_backtest` cancels, and rate/concurrency limits on consuming runtime capacity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 91%, but the description adds semantics the schema cannot: the supersession rule that every later file mutation invalidates earlier revision ids and that revisionId must come from the most recent successful mutation or readback, that `budget` maps to BACKTESTING_BUDGET without code changes, that `parameters` are persisted as an immutable reusable parameter set, and the workflow constraint to create saved env vars one at a time then pass ids. It also specifies prohibited payloads (raw env vars, botConfig, API keys, CSV rows, inline secrets), which governs how the parameters must be shaped.

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 opens with a specific verb and resource plus scope: "Start a new backtest for a revision with the provided date range", then immediately distinguishes itself from siblings by naming `backtest_status` and the artifact tools as the way to observe state, and `stop_backtest`/`list_backtests` as the surrounding workflow. An agent can tell exactly what this tool does and does not do without opening the schema.

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

Usage Guidelines5/5

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

Explicit routing rules are present: if `revisionId` is missing, call `list_backtests` first; do not call `set_data_provider` merely to reselect the default; only call it for an explicit provider change when the provider is advertised as available; MCP clients without a BotSpot chat conversation pass `dataProvider` instead. It also states when NOT to act (do not probe a provider declared OFF, do not switch providers on DATA_ACCESS_REQUIRED), which is the kind of exclusion guidance that genuinely changes agent behavior.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.