Skip to main content
Glama

Audit a strategy return series

audit_returns
Read-onlyIdempotent

Run a statistical red-team on a backtest return series: net vs gross costs and break-even, autocorrelation-aware Sharpe, Deflated Sharpe, stability, drawdown and a plain-English verdict with a 0-100 audit score.

Instructions

Statistical red-team of a backtest's return series: net vs gross at 0/5/10/20 bps and the break-even cost; Sharpe with Newey-West and Lo-style t-stats (autocorrelation-aware); the Deflated Sharpe Ratio (Bailey & Lopez de Prado 2014) for n_trials and the minimum track record length; stability by thirds and by year; share of PnL from the best 5% of days; max drawdown and duration; excess return, IR and beta against an optional benchmark. Ends with a plain-English verdict (No red flags found / Some red flags / Major red flags), the reasons, and a 0-100 audit score with its breakdown. No red flags doesn't mean a strategy will make money; it means these checks didn't find the common errors.

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": {
      "returns": "<returns>"
    },
    "name": "audit_returns"
  }
}

Input Schema

NameRequiredDescriptionDefault
freqNoReturn frequency: auto (inferred from the dates; default), D, W, M, Q, Y, or periods per year as a number.auto
unitsNo'decimal' (0.01 = 1%) or 'percent' (1 = 1%).decimal
returnsYesPer-period strategy returns as CSV (date,return) or JSON (list of numbers, {date: return}, or records). Decimals: 0.01 = 1%.
n_trialsNoTotal number of strategy variants tried before choosing this one (parameters, universes, rules). Drives the Deflated Sharpe Ratio.
turnoverNoOne-way turnover per period (sum of |change in weights|): a number (average) or a series like `returns`.
benchmarkNoOptional benchmark returns, same format as `returns`.
costs_bpsNoYour all-in cost per unit of one-way turnover, in bps. Default 10 when turnover is given.
positionsNoOptional weights table (CSV/JSON): wide date + one column per asset, or long date,ticker,weight. Used to compute turnover.
input_kindNo'returns' or 'equity' (an equity/NAV curve).returns
returns_are_netNoTrue if the returns already include trading costs.
trials_sr_varianceNoOptional variance of the annualized Sharpe ratios across all trials. Default assumes zero-skill trials.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.7.0

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false, so the agent knows this is a safe, repeatable computation. The description adds real context (the verdict tiers, the 0-100 audit score with breakdown, and the caveat that 'no red flags doesn't mean a strategy will make money'), but it does not state cost, latency, data-length requirements, or error behavior for malformed input. With annotations and an output schema both already present, this is solid but not exceptional.

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 framing sentence is front-loaded and the analysis list follows in a dense but scannable enumeration, with the interpretation caveat correctly placed last. It is long and list-like, but nearly every clause carries a distinct claim and none is pure repetition of the title.

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 an 11-parameter, read-only analysis tool with full schema coverage and an output schema, the description covers what is computed, what the verdict output looks like, and how to interpret it, which is what an agent needs to call it correctly. The remaining gap is the absence of routing guidance among the audit_* siblings and any note on minimum data requirements.

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 100%, so the baseline is 3, and the description earns the extra point by explaining how parameters interlock: net vs gross across 0/5/10/20 bps and break-even cost ties costs_bps, turnover and returns_are_net together; n_trials is explicitly said to drive the Deflated Sharpe Ratio; benchmark is stated to produce excess return, IR and beta. That is meaning beyond the field-level descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific framing, 'statistical red-team of a backtest's return series', and enumerates the concrete analyses performed, so the resource acted on and the operation are unambiguous. It does not, however, distinguish itself from the sibling audit_backtest or audit_trade_log, so an agent must infer which audit surface applies to a return series versus a full backtest or trade log.

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

Usage Guidelines3/5

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

Usage is implied rather than stated: the agent can infer this is the right tool when holding only a return series, and the 'optional benchmark' remark hints at a comparison workflow. There is no explicit when-to-use, when-not-to-use, or alternative-naming guidance, and nothing says what to do if the series is too short for the Deflated Sharpe or minimum track record length checks.

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