Skip to main content
Glama

run_portfolio_backtest

Backtest a rebalanced, multi-ticker, long-only quant portfolio. Fetches daily history for every ticker over range, then runs a walk-forward simulation: at each period-end rebalance the chosen signal (jt_momentum, mean_reversion, rsi_filtered_momentum, trend_quality) scores each name using only data up to that date, and method turns those scores into long-only weights. Returns gross and net (after cost) performance. rebalance is M (monthly) or Q (quarterly); cost_bps is round-trip cost on turnover; benchmark drives the hit-rate metric and (with crash_filter) a regime filter holding cash when the benchmark trailing-12m return is negative. Returns the standard envelope; values holds equity_curve, rebalances, metrics, holdings and the echoed parameters. (paid: $0.0100/call)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rangeNo
top_nNo
methodNo
signalNo
tickersYes
cost_bpsNo
benchmarkNo
rebalanceNo
crash_filterNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations provided, the description takes on the burden of detailing behavior. It discloses lookahead prevention ('using only data up to that date'), cost handling, the crash filter mechanism, and the return envelope contents. It also notes the paid cost. Some behaviors like rate limits or error conditions are not mentioned, but the core operational behavior is well covered.

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 dense but every sentence adds value. It front-loads the main purpose and follows with mechanics and parameter meanings. The structure is a single paragraph, which could be slightly more scannable with bullet points, but remains effective.

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 a complex tool with 9 parameters and no output schema, the description covers the algorithm, key parameters, and output keys. It misses a clear explanation of top_n and some method details, but overall it gives the agent enough to select and invoke the tool appropriately.

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

Parameters3/5

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

The description explains several parameters (rebalance, cost_bps, benchmark, crash_filter, signal) but omits top_n and does not enumerate method options. Since schema description coverage is 0%, the description needs to compensate more fully; it partially does but leaves gaps for a few parameters.

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 clearly states the tool's purpose: 'Backtest a rebalanced, multi-ticker, long-only quant portfolio.' It specifies the walk-forward simulation, rebalancing, and output metrics, distinguishing it from sibling tools like the simpler 'backtest.'

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 on when to use this tool, such as for multi-ticker rebalanced portfolios with specific signals and methods. However, it does not explicitly state when not to use it or mention alternatives like 'backtest' as a simpler option.

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