Skip to main content
Glama
roman-zaglauer

OctoBot MCP Server

start_backtest

Launch a backtest in the background using either provided data files or the bot's current exchange data. Immediately receive a job ID to poll progress and retrieve results.

Instructions

Start a real OctoBot backtest run in the background and return immediately.

Not confirm-gated (ADR-0003): starts a simulation, never touches live trading or destroys data. Two mutually exclusive modes (all other parameters are mode-specific; unused ones for the chosen mode are ignored):

  • mode="data_files" -> OctoBot's start_backtesting action [V]. Requires files (a non-empty list of exact data file names -- there is currently no MCP tool exposing what's available; the agent must already know a valid name, e.g. from OctoBot's own /backtesting page). start_timestamp/end_timestamp are epoch milliseconds (confirmed against source: _start_backtesting divides by 1000 before use), matching this project's convention elsewhere. run_on_common_part_only defaults to True (OctoBot's own default when omitted).

  • mode="current_bot_data" -> OctoBot's start_backtesting_with_current_bot_data action [V]. Every field is technically optional at the HTTP layer (confirmed against source), but exchange_id is effectively required unless data_source names an explicit data file: if data_source is omitted or None, OctoBot defaults it to "current_bot_data" (use a live snapshot of the bot's own current exchange data), which requires a valid exchange_id -- omitting exchange_id in that case fails with a generic BacktestStartFailedError, not MissingExchangeIdError (that error is only raised for an actually-provided-but-unrecognized id; see this module's docstring, "Open question #6"). exchange_id is the same value get_exchange_details returns as its exchange_id field. exchange_type accepts None, "use_current_profile", "spot", "inverse_perpetual", "linear_perpetual", or "margin" (any other value raises inside OctoBot, surfaced as BacktestStartFailedError).

source (both modes) is an optional caller-supplied override for OctoBot's own per-run source identifier; if omitted (the expected case), a fresh UUID is generated and stored as the job's octobot_run_source, then reused automatically for the later get_job_result report fetch -- the caller never needs to manage this value.

Output: {"job_id": str, "state": "queued"} -- always "queued" immediately after this call (the background watcher has not yet had a chance to run at all: asyncio.create_task schedules it, it does not run any of it synchronously). Poll get_job_status(job_id) to observe the transition to "running" and then progress_percent advancing; call get_job_result(job_id) once state == "completed".

Progress notifications (milestone 11, ADR-0002 decision point 3): if this call's MCP request carries a progressToken, the watcher also opportunistically emits an MCP progress notification (progress/total on the same 0-100 scale as progress_percent) each time progress_percent changes -- entirely optional, additive, and never a substitute for polling: get_job_status behaves identically whether or not a token was ever supplied. See octobot_mcp.tools.backtesting's own module-level "Milestone 11" comment block for exactly how this is implemented.

Errors: BacktestStartFailedError for an unknown mode, a missing required field for the chosen mode, or any other start failure; MissingExchangeIdError specifically for current_bot_data mode's confirmed exception. Both are raised from the background watcher (not this function) and surface as the job's errors/state="failed" via get_job_status -- start_backtest itself only raises synchronously for input validation caught before any job is created (unknown mode, missing files), so a bad call never leaves a dangling queued job behind.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYes
nameNo
filesNo
sourceNo
auto_stopNo
profile_idNo
data_sourceNo
enable_logsNo
exchange_idNo
end_timestampNo
exchange_typeNo
start_timestampNo
reset_tentacle_configNo
run_on_common_part_onlyNo

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.1.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations to convey safety or side effects, the description carries the full burden and fully delivers. It discloses asynchronous scheduling via asyncio.create_task, immediate 'queued' state, background-watcher error surfacing, optional progress notifications, and that no live trading or data destruction occurs.

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

Conciseness5/5

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

The description is long, but the complexity justifies the length: 14 bare parameters, no annotations, and no output schema. It is front-loaded with the core purpose and then organized into clear mode bullets and labeled sections, so an agent can quickly extract the relevant path.

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?

The description is nearly exhaustive for this tool's complexity: it covers call semantics, mode-specific requirements, defaults, error types, output shape, polling/results behavior, and even progressToken behavior. The lack of an output schema is compensated by explicitly stating the returned JSON structure.

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?

Despite 0% schema description coverage, the description compensates thoroughly: it defines the 'mode' variants, requires 'files' to be a non-empty list of exact names, specifies epoch-millisecond units for timestamps, documents defaults such as 'run_on_common_part_only', explains the conditional requirement for 'exchange_id', and enumerates valid 'exchange_type' values. Remaining parameters are either self-explanatory by name or covered by the note that unused mode-specific parameters are ignored.

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 first sentence states a specific action ('Start a real OctoBot backtest run') and a distinctive behavioral property ('in the background and return immediately'), which clearly differentiates it from job-status, job-result, and data-management siblings. The scope is further clarified by 'never touches live trading or destroys data.'

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?

The description explicitly separates the two mutually exclusive modes, explains which parameters apply to each, and names the exact follow-up tools to use: 'Poll get_job_status(job_id)' and 'call get_job_result(job_id)'. It also tells the agent when a call will fail synchronously versus asynchronously, which is essential for correct usage.

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