Skip to main content
Glama
Dor1Toes

BackTest_MCP

by Dor1Toes

run_backtest_dynamic

Run a custom Python trading strategy in an isolated sandbox, validate its code and configuration, and get backtest performance metrics such as total return and max drawdown.

Instructions

Run a dynamic Strategy backtest in an isolated sandbox and persist artifacts.

Args: code: Python source with exactly one Strategy subclass. Strategy rules and allowed imports are enforced before execution; see quantforge://codegen/spec. config_json: JSON string for backtest settings (required: symbols; optional: name, start, end, initial_capital, commission, slippage, target_weights, sizing_fraction, rebalance, last_rebalance_ts, history_tail). Dates must be YYYY-MM-DD. Full schema and examples: quantforge://codegen/spec.

Returns: On success: {"ok": true, "job_id": str, "status": "done", "result": {...}} where result includes metrics (total_return, max_drawdown, n_trades, ...). On validation failure: {"ok": false, "validation": {...}} (no job created). On runtime failure: {"ok": false, "job_id": str, "status": "failed", "error": str}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
config_jsonYes
Behavior5/5

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

With no annotations, the description carries the full burden and does so excellently. It discloses sandbox isolation, pre-execution validation, validation failure (no job created), runtime failure (job_id plus error), and success result with metrics. It also hints at artifact persistence, giving the agent a clear behavioral model.

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

Conciseness4/5

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

The description is logically structured with a summary, Args, and Returns sections. It is moderately long but every part serves a purpose. The spec URI is repeated twice, which is slightly redundant, but the overall organization keeps it readable and efficient for the complexity.

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?

Given the tool has two complex string parameters and no output schema, the description fully covers the important aspects: success, validation failure, and runtime failure responses, plus a preview of the metrics returned. It also references a spec for deeper details, making it self-contained enough for an agent to invoke correctly.

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 descriptions are absent (0% coverage), so the description fully compensates. It explains `code` as Python source with exactly one Strategy subclass and enforced imports, and `config_json` as a JSON string with required/optional settings, date format, and pointer to full schema. This adds substantial meaning beyond the raw schema.

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 begins with a specific verb and resource: 'Run a dynamic Strategy backtest in an isolated sandbox and persist artifacts.' This clearly states what the tool does and distinguishes it from siblings like get_backtest_result or scan_strategy_signals. The 'dynamic' and 'persist artifacts' add specificity beyond the tool name.

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

Usage Guidelines4/5

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

The description provides clear context for when to use the tool: it runs backtests, enforces strategy rules, and returns a job_id for later retrieval. It does not explicitly name alternative tools or state when not to use it, but the context makes the primary use case obvious. This aligns with 'clear context, no exclusions'.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Dor1Toes/BackTest_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server