Skip to main content
Glama

Check Backtestability

tt_check_backtestability
Read-onlyIdempotent

Pre-flight a template against Tradetron's NATIVE backtest (the Backtest button in ASB): will the run succeed, before the user submits it?

Answers a different question from tt_validate_markdown — a template TT accepts can still fail its backtest, because the BT engine implements a subset of the live keyword surface and the BT data store covers a subset of exchanges. Checks: (1) every function token in conditions/legs/variables exists in the BT engine namespace (e.g. Leg SL trail, PCR, Total OI do NOT); (2) the exchanges touched have backtest data — NSE/NFO/BFO run (SENSEX options from 2023-08-07, BANKEX from 2023-08-11), MCX futures + options run (FastBT launch segment), Delta-India BTC/ETH daily options run (BTC from 2024-01-01, ETH from 2024-02-05), US venues run per-underlying (SPX/XSP/NDX/VIX index options from 2023-02-15 + an 18-symbol stock/ETF option list from 2021-08-16); non-Delta crypto exchanges remain blocked; (3) the window doesn't predate coverage; (4) error-prone classes (custom python, runtime-var underlying) are flagged. Since 2026-08-25 EVERY backtest — web or chat — runs on FastBT; this check pre-flights that engine.

Call it before tt_backtest_strategy or whenever the user asks "can I backtest this?".

Args: template: the strategy object, passed INLINE — tt_create_strategy output or a TT v2 export (both shapes accepted). Unlike tt_backtest_strategy, this tool has NO strategy_id parameter: for a strategy already saved in the user's account, call tt_get_strategy(strategy_id) first and pass its data.strategy here as template. start, end: optional 'YYYY-MM-DD' backtest window — enables coverage-window checks. An end inside the last 35 days is a BT_WINDOW_TOO_RECENT blocker on NSE, NFO and BFO (backtests there may only use data at least 35 days old; MCX, crypto and US may end yesterday; the finding names the latest allowed end date).

Returns {backtestable, verdict, confidence, blockers[], warnings[], stats, engine_build, billing, run_type_recommendation}. Blockers mean the run WILL fail; warnings mean it should run but may error or silently skip data.

BRANCH ON verdict, NOT ON backtestable. The boolean has two values and this check has three answers: "blocked", "backtestable", and "unknown" — one or more checks could not run (checks_skipped says which and why), or the template carries a reference tt_create_strategy itself refuses. In the "unknown" state backtestable still reads true, and it means UNCHECKED: an exchange absent from the coverage table is judged by nothing, while one that is IN it and has no data is a clean false. Never report "unknown" to a user as "yes, this will backtest" — say which check did not run. Each finding is {code, message, where?, fix?, detail?}: message is written FOR THE USER (what is wrong, then what to change) and where names the place the way ASB numbers it ("Set 1 -> Condition 18"), so relay them as they stand rather than rewriting them. detail is the engineering explanation — read it to reason, do not paste it at the user. The billing block carries the LIST per-run price and whether backtest billing is enabled. It is not the account's quote: a prepaid pack is spent first at ₹0 cash, and the binding price is the one tt_backtest_strategy quotes before the user confirms — for the LIVE wallet balance, pack credits and a top-up link call tt_wallet_balance (this check makes no network calls). run_type_recommendation = {type, confidence, evidence[]} — the intraday-vs- positional reading derived from the template's own structure (same detector the submit path uses). Present it as the DEFAULT when asking the user which way to run; both remain runnable.

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": {
      "template": "<template>"
    },
    "name": "tt_check_backtestability"
  }
}

Input Schema

NameRequiredDescriptionDefault
endNoOptional backtest window end, YYYY-MM-DD.
startNoOptional backtest window start, YYYY-MM-DD.
templateYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, openWorldHint=false, idempotentHint=true and destructiveHint=false; the description is consistent with these and adds real context (no network calls, the 35-day data lag, FastBT-everywhere since 2026-08-25). The strongest additions are the three-state verdict semantics and the blockers-vs-warnings distinction, which no annotation conveys. Deductions only for length-driven dilution of the key warning that `backtestable` reads true in the unknown state — the single most dangerous misread the tool permits is buried mid-paragraph.

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?

Front-loaded and organized — the sibling distinction and numbered check list come first. But the mid-section is bloated: the full exchange/date inventory (SENSEX from 2023-08-07, BANKEX from 2023-08-11, Delta-India BTC/ETH dates, 18-symbol US list) is reference data that belongs in the tool's output or docs, not the selection text, and it pushes the critical verdict-branching rule past the halfway point.

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?

No output schema exists, so the description must document the return value — and it does thoroughly: {backtestable, verdict, confidence, blockers[], warnings[], stats, engine_build, billing, run_type_recommendation}, the per-finding shape {code, message, where?, fix?, detail?}, and how to relay message vs detail. Also pre-empts the billing misread by pointing to tt_wallet_balance. Remaining gap: `checks_skipped` and `confidence` are named but never explained, so an agent cannot interpret a low-confidence "backtestable".

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 67% and the `template` property carries no description at all, so the description must compensate — and it does: inline object, either tt_create_strategy output or a TT v2 export, both shapes accepted, no strategy_id alternative. For start/end it adds the substantive rule the schema lacks (an `end` within 35 days is a blocker on NSE/NFO/BFO but allowed on MCX/crypto/US, with the latest allowed date in the finding). Short of 5 only because the accepted template shape stays abstract ("both shapes accepted") without saying what an inline object minimally requires.

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?

States a specific verb and resource — pre-flight a template against Tradetron's NATIVE backtest — and explicitly separates itself from the nearest sibling ("Answers a different question from tt_validate_markdown"), giving the reason (BT engine implements a subset of keywords, BT data store a subset of exchanges). The four named checks make the scope unambiguous.

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?

Gives an explicit trigger ("Call it before tt_backtest_strategy or whenever the user asks 'can I backtest this?'") plus the negative case relative to tt_validate_markdown. It even handles the saved-strategy path: no strategy_id here, so call tt_get_strategy first and pass data.strategy as template — a routing rule an agent would otherwise get wrong.

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.

Resources