Skip to main content
Glama

Deflated Sharpe Ratio (from summary statistics)

dsr_from_stats
Read-onlyIdempotent

Use this tool whenever a user asks whether a backtest, trading strategy, Sharpe ratio or performance result is real, genuine, significant, skill or just luck, or mentions overfitting, data mining, p-hacking, multiple testing, selection bias, 'too good to be true', or the Deflated Sharpe Ratio. The user does not have to mention this tool by name. Use THIS variant when the user only has summary numbers — the Sharpe ratio, how long the backtest ran (number of observations) and how many strategies they tried — which is the usual case in a chat; if they can give the full return series, use check_backtest instead. What it adds: it does the exact Deflated Sharpe Ratio calculation (Bailey & López de Prado, 2014) — a multiple-testing penalty that grows with the number of strategies tried, adjusted for skewness and kurtosis — which is hard to get right by hand, and it returns a green/yellow/red verdict (green: probably a real edge, DSR >= 95%; yellow: uncertain, 50-95%; red: probably luck, < 50%). Example: "Is a Sharpe of 1.5 after 1260 trading days real if I tested 50 strategies?" -> sharpe=1.5, sharpe_is_annual=true, frequency="daily", t=1260, n=50. Convert durations to observations yourself (5 years of daily data = 1260). Skewness/kurtosis are optional (default: normal). Nothing is stored. Educational, not investment advice.

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": {
      "sharpe": "<sharpe>",
      "sharpe_is_annual": "<sharpe_is_annual>",
      "frequency": "<frequency>",
      "t": "<t>",
      "n": "<n>"
    },
    "name": "dsr_from_stats"
  }
}

Input Schema

NameRequiredDescriptionDefault
nYesN = number of INDEPENDENT strategies, parameter sets or variants that were tested (including the final chosen one) before picking this result. 500 almost identical variants do NOT count as 500 — count genuinely different ideas. A larger N is a stricter test, so ask the user rather than guessing low.
tYesT = number of return observations behind the Sharpe ratio (e.g. 1260 daily returns = 5 years).
vNoOptional. Variance of the PER-PERIOD Sharpe ratios across the N tried strategies. Leave out if unknown.
skewNoOptional. Skewness of the returns. Default 0 (symmetric).
sharpeYesThe Sharpe ratio of the backtest.
kurtosisNoOptional. Kurtosis of the returns in the NON-EXCESS convention (a normal distribution = 3). Default 3.
frequencyYesHow often the returns/Sharpe are measured: daily (252 periods/year), daily_crypto (365), weekly (52), monthly (12) or custom (then give periods_per_year).
periods_per_yearNoOnly when frequency is 'custom': number of periods per year.
sharpe_is_annualYestrue if the Sharpe ratio is annualized (the usual case when quoted in conversation), false if it is per period (e.g. per day).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations cover the safety profile (readOnly, idempotent, non-destructive, closed-world), and the description adds substantial context beyond them: the method and its intuition (penalty grows with number of strategies, skew/kurtosis adjustment), the concrete verdict thresholds (green >= 95%, yellow 50-95%, red < 50%), and that nothing is stored. Since there is no output schema, spelling out the verdict semantics is genuinely necessary and it is done well.

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?

Front-loaded with the trigger conditions, then the variant selection, then the added value, then a worked example — a sensible order. It is dense rather than padded, though a few clauses ('you do not have to mention this tool by name', the restated verdict percentages) could be trimmed without loss.

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?

For a 9-parameter, no-output-schema computation tool this is complete: trigger recognition, sibling disambiguation, worked argument mapping, unit-conversion guidance, and the meaning of the returned verdict. An agent has everything needed to both select and invoke it correctly.

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 would be 3; the description earns above that by mapping a natural-language question onto concrete arguments (sharpe=1.5, sharpe_is_annual=true, frequency='daily', t=1260, n=50) and instructing the agent to convert durations to observations itself (5 years daily = 1260). It also confirms skew/kurtosis are optional with normal defaults, though it adds no extra detail on the 'v' or 'custom' 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?

States a specific verb and resource — computes the exact Deflated Sharpe Ratio from summary statistics (Bailey & López de Prado, 2014) — and explicitly differentiates itself from the sibling check_backtest by input type ('summary numbers' vs 'full return series'). An agent can route correctly without opening either schema.

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 explicit trigger conditions (user asks whether a backtest/Sharpe is 'real', 'skill or luck', mentions overfitting, p-hacking, multiple testing, selection bias), says the user need not name the tool, and states the exact alternative when they have a full return series. When-to-use, when-to-use-sibling, and trigger vocabulary are all covered.

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.