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 (the result names it). 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 is not available for this strategy (for example options on BotSpot Auto, which has no options data of its own), 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.
labelNoOptional short name for this run, shown beside its range and revision in the backtest header and lists (e.g. "stop 2%, 2x size"). Use the name the person gave, or a few words saying what differs from the other runs.
budgetNoStarting cash for the backtest, in quote-currency units unless budgetConversion explicitly declares another input currency. 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.
budgetConversionNoOptional caller-declared starting-capital conversion: budget_currency, quote_currency and positive finite quote_per_budget, as a number or decimal string (quote-wallet units per input-budget unit). The amount may be budget here or an explicit amount already in the saved code/environment; no extra MCP budget is required. Optional as_of, source, note and other JSON metadata preserve provenance, including approximate or missing dates. No exchange rate is fetched or independently verified. Without this record, numeric budget retains its existing quote-currency meaning.
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. Changed36 schema fields changed
    • addedInput schema / properties / budget / anyOf
      Added value: +[
      +  {
      +    "exclusiveMinimum": 0,
      +    "type": "number"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / budget / exclusiveMinimum
      Removed value: -0
    • removedInput schema / properties / budget / type
      Removed value: -"number"
    • removedInput schema / properties / budgetConversion / additionalProperties
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "number"
      -    },
      -    {
      -      "type": "boolean"
      -    },
      -    {
      -      "type": "null"
      -    },
      -    {
      -      "items": {
      -        "$ref": "#/properties/budgetConversion/additionalProperties"
      -      },
      -      "type": "array"
      -    },
      -    {
      -      "additionalProperties": {
      -        "$ref": "#/properties/budgetConversion/additionalProperties"
      -      },
      -      "type": "object"
      -    }
      -  ]
      -}
    • addedInput schema / properties / budgetConversion / anyOf
      Added value: +[
      +  {
      +    "additionalProperties": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "boolean"
      +        },
      +        {
      +          "type": "null"
      +        },
      +        {
      +          "items": {
      +            "$ref": "#/properties/budgetConversion/anyOf/0/additionalProperties"
      +          },
      +          "type": "array"
      +        },
      +        {
      +          "additionalProperties": {
      +            "$ref": "#/properties/budgetConversion/anyOf/0/additionalProperties"
      +          },
      +          "type": "object"
      +        }
      +      ]
      +    },
      +    "properties": {
      +      "budget_currency": {
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "quote_currency": {
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "quote_per_budget": {
      +        "anyOf": [
      +          {
      +            "exclusiveMinimum": 0,
      +            "type": "number"
      +          },
      +          {
      +            "type": "string"
      +          }
      +        ]
      +      }
      +    },
      +    "required": [
      +      "budget_currency",
      +      "quote_currency",
      +      "quote_per_budget"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / budgetConversion / properties
      Removed value: -{
      -  "budget_currency": {
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  "quote_currency": {
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  "quote_per_budget": {
      -    "anyOf": [
      -      {
      -        "exclusiveMinimum": 0,
      -        "type": "number"
      -      },
      -      {
      -        "type": "string"
      -      }
      -    ]
      -  }
      -}
    • removedInput schema / properties / budgetConversion / required
      Removed value: -[
      -  "budget_currency",
      -  "quote_currency",
      -  "quote_per_budget"
      -]
    • removedInput schema / properties / budgetConversion / type
      Removed value: -"object"
    • addedInput schema / properties / cache / anyOf
      Added value: +[
      +  {
      +    "enum": [
      +      "default",
      +      "off"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / cache / enum
      Removed value: -[
      -  "default",
      -  "off"
      -]
    • removedInput schema / properties / cache / type
      Removed value: -"string"
    • addedInput schema / properties / dataConnectionId / anyOf
      Added value: +[
      +  {
      +    "format": "uuid",
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / dataConnectionId / format
      Removed value: -"uuid"
    • removedInput schema / properties / dataConnectionId / type
      Removed value: -"string"
    • addedInput schema / properties / dataProvider / anyOf
      Added value: +[
      +  {
      +    "maxLength": 64,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / dataProvider / maxLength
      Removed value: -64
    • removedInput schema / properties / dataProvider / minLength
      Removed value: -1
    • removedInput schema / properties / dataProvider / type
      Removed value: -"string"
    • addedInput schema / properties / envVarSetIds / anyOf
      Added value: +[
      +  {
      +    "items": {
      +      "format": "uuid",
      +      "type": "string"
      +    },
      +    "maxItems": 10,
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / envVarSetIds / items
      Removed value: -{
      -  "format": "uuid",
      -  "type": "string"
      -}
    • removedInput schema / properties / envVarSetIds / maxItems
      Removed value: -10
    • removedInput schema / properties / envVarSetIds / type
      Removed value: -"array"
    • addedInput schema / properties / label / anyOf
      Added value: +[
      +  {
      +    "maxLength": 80,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / label / maxLength
      Removed value: -80
    • removedInput schema / properties / label / minLength
      Removed value: -1
    • removedInput schema / properties / label / type
      Removed value: -"string"
    • removedInput schema / properties / parameters / additionalProperties
      Removed value: -{}
    • addedInput schema / properties / parameters / anyOf
      Added value: +[
      +  {
      +    "additionalProperties": {},
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / parameters / type
      Removed value: -"object"
    • changedInput schema / properties / profile / type
      Previous value: -"boolean"New value: +[
      +  "boolean",
      +  "null"
      +]
    • addedInput schema / properties / revisionId / anyOf
      Added value: +[
      +  {
      +    "format": "uuid",
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / revisionId / format
      Removed value: -"uuid"
    • removedInput schema / properties / revisionId / type
      Removed value: -"string"
    • addedInput schema / properties / strategyParameterSetId / anyOf
      Added value: +[
      +  {
      +    "format": "uuid",
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / strategyParameterSetId / format
      Removed value: -"uuid"
    • removedInput schema / properties / strategyParameterSetId / type
      Removed value: -"string"
  2. Changed1 schema field changed
    • addedInput schema / properties / label
      Added value: +{
      +  "description": "Optional short name for this run, shown beside its range and revision in the backtest header and lists (e.g. \"stop 2%, 2x size\"). Use the name the person gave, or a few words saying what differs from the other runs.",
      +  "maxLength": 80,
      +  "minLength": 1,
      +  "type": "string"
      +}
  3. Changed2 schema fields changed
    • changedInput schema / properties / budget / description
      Previous value: -"Starting cash for the backtest (in the quote currency, typically USD). Sets BACKTESTING_BUDGET in the backtest environment."New value: +"Starting cash for the backtest, in quote-currency units unless budgetConversion explicitly declares another input currency. Sets BACKTESTING_BUDGET in the backtest environment."
    • addedInput schema / properties / budgetConversion
      Added value: +{
      +  "additionalProperties": {
      +    "anyOf": [
      +      {
      +        "type": "string"
      +      },
      +      {
      +        "type": "number"
      +      },
      +      {
      +        "type": "boolean"
      +      },
      +      {
      +        "type": "null"
      +      },
      +      {
      +        "items": {
      +          "$ref": "#/properties/budgetConversion/additionalProperties"
      +        },
      +        "type": "array"
      +      },
      +      {
      +        "additionalProperties": {
      +          "$ref": "#/properties/budgetConversion/additionalProperties"
      +        },
      +        "type": "object"
      +      }
      +    ]
      +  },
      +  "description": "Optional caller-declared starting-capital conversion: budget_currency, quote_currency and positive finite quote_per_budget, as a number or decimal string (quote-wallet units per input-budget unit). The amount may be budget here or an explicit amount already in the saved code/environment; no extra MCP budget is required. Optional as_of, source, note and other JSON metadata preserve provenance, including approximate or missing dates. No exchange rate is fetched or independently verified. Without this record, numeric budget retains its existing quote-currency meaning.",
      +  "properties": {
      +    "budget_currency": {
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "quote_currency": {
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "quote_per_budget": {
      +      "anyOf": [
      +        {
      +          "exclusiveMinimum": 0,
      +          "type": "number"
      +        },
      +        {
      +          "type": "string"
      +        }
      +      ]
      +    }
      +  },
      +  "required": [
      +    "budget_currency",
      +    "quote_currency",
      +    "quote_per_budget"
      +  ],
      +  "type": "object"
      +}
  4. 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"
      +}
  5. 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."
  6. 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."
  7. 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."
  8. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, non-idempotent and open-world; the description adds the non-obvious behavior: the call is asynchronous, returns a backtest id immediately, consumes material runtime capacity, and creates no visible plan items. It also documents the error taxonomy (DATA_ACCESS_REQUIRED, TRIAL_RANGE_EXCEEDED, DATA_PROVIDER_UNAVAILABLE) and the correct response to each. Some paragraphs are agent coaching ('never invent a validation universe') rather than tool behavior, which slightly dilutes it.

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 key fact (ASYNC, returns immediately) is correctly front-loaded, but the prose is very long for a single tool call and repeats itself: 'Follow the user's instructions about whether to start one' and the 'start acknowledgment does not establish…' passage restate the same caution in different words. Much of the tail is prescriptive response scripting rather than definition content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter, no-output-schema, async, destructive tool, the definition covers what the call returns (backtest id, revision id, wait id, run status), how the job is tracked afterward, and how to recover from the three documented failure modes. Nothing an agent needs in order to invoke it correctly is missing.

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

Parameters4/5

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

Schema coverage is 92%, so the baseline is 3, but the description adds real semantics the schema lacks: revisionId provenance rules (must come from the most recent successful mutation, superseded by any later mutation), budget mapping to BACKTESTING_BUDGET, and the envVarSetIds workflow (create one saved var at a time, then pass ids) with an explicit prohibition on inline secrets. That is meaning well beyond field descriptions.

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?

Opens with a specific verb+resource ('Start a new backtest for a revision with the provided date range') and immediately names the ASYNC contract plus the sibling tools (`backtest_status`, artifact tools) that track the job. An agent can tell this apart from `list_backtests`, `start_parameter_experiment`, and `backtest_status` without opening any 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 given: call `list_backtests` first when revisionId is missing, use `set_data_provider` for provider changes in BotSpot chat, pass `dataProvider` only on non-chat MCP clients, and do not probe providers already declared OFF. It also states the stop condition ('Do not retry the same backtest') for the DATA_PROVIDER_UNAVAILABLE case, which is exactly the when/when-not guidance an agent needs.

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.