Skip to main content
Glama

Falls and recoveries of a stock or fund

smartfin_calculate_crash_recovery
Read-onlyIdempotent

Every fall of a chosen size (default 20%) for one US-listed stock or index ETF, on daily closing prices adjusted for stock splits with dividends reinvested, the way SmartFin's Crash & Recovery page measures it. A fall starts at the highest close since the last fall ended. It counts once a close is fall_pct or more below that high. It ends when it recovers (the first close at or above that high), or at a close fall_pct or more above its lowest close. A fall not yet recovered by to_date can also hold a drop of fall_pct or more to the same low, from a lower close on the way down with no higher close between it and that low, that recovered to its own starting close by to_date, before any close below that low. The biggest such drop is its own fall, with inside_fall_from set to the high date of the fall that holds it; it counts toward the total, at most one per fall, and the time limit runs from its own start. ended_by says whether a fall ended by recovering to its high ("high") or on a rise of fall_pct or more off its lowest close ("rebound"); end_date is that close and rebound_pct the rise from the lowest close to it. For a drop inside a fall (inside_fall_from set), "high" means it recovered to its own starting close, not to the high of the fall that holds it. Nothing after to_date is used, so a rise or a recovery after it shows as not yet. Only prices from from_date to to_date are used; the high is the highest close in those dates, or since the last fall ended. A fall counts only if it reached fall_pct within the time limit (within). For each fall: the high date and close, the bottom date and close, the depth, the recovery date, the first close at or above the high (this can come after later falls, or not yet), and the months from the high to the bottom and from the high to recovery. A summary: how many falls, the deepest, the longest and median months to recover, how many have not yet recovered (not_yet_back), and the latest close against the all-time high up to the to date. For the deepest fall: what a buy at the high and a buy at the bottom did, SPY from its own close on the same high date (the benchmark), and buys at the first close 10, 20 and 30% below the high. The same dates at 10, 20, 30 and 50%. With mode crash it measures the symbol's own fall during one named S&P 500 crash instead (dotcom: SPY's 2000-03-24 high to its 2002-10-09 low; 2008: SPY's 2007-10-09 high to its 2009-03-09 low; covid: SPY's 2020-02-19 high to its 2020-03-23 low; 2022: SPY's 2022-01-03 high to its 2022-10-12 low). amount (default 1000) is bought at each counted fall's high, at the first close fall_pct below it, and at its low, each valued at the to_date close (data.buys). Use when someone asks how far a stock or fund fell and how long it took to recover, e.g. "how long did Apple take to recover from 2008", "NVDA biggest falls and recovery time" or "how many 20% drops has SPY had". Do not use for forecasts or whether something will recover, for intraday moves, for symbols outside the supported list, or for a price-only basis: every figure includes reinvested dividends. For what an amount became between two dates use smartfin_calculate_investment_return. Limits: today's S&P 500 companies and major index ETFs, prices in US dollars, daily closes; the last 10 years by default, or the full history if shorter; every claim is dated and none is a prediction.

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": {
      "symbol": "<symbol>"
    },
    "name": "smartfin_calculate_crash_recovery"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNosize (default): every fall of fall_pct or more over the dates. crash: the symbol's own fall during the named S&P 500 crash, from its highest close between a year before SPY's high and SPY's low
crashNoThe crash for mode crash: dotcom (dot-com), 2008 (2008), covid (COVID), 2022 (2022)
amountNoThe same amount bought at each counted fall: at its high, at the first close fall_pct down, and at its lowest close, each valued at the to_date close, in US dollars. Default 1000
symbolYesStock or ETF symbol, not a company name: AAPL not Apple. Covers 508 symbols: the S&P 500 companies plus the index ETFs SPY, VOO, IVV, QQQ, DIA, IWM, VTI.
withinNoHow fast a fall had to reach fall_pct, counted from its high: 1m, 3m (default), 1y, any, or a whole number of days from 1 to 3650. Ignored with mode crash
to_dateNoLast date, YYYY-MM-DD. Omit for the latest close. Ignored with mode crash
fall_pctNoA fall counts once a close is this % or more below the highest close since the last fall ended. A rise of this % or more from its lowest close ends it. Default 20. Ignored with mode crash
from_dateNoFirst date, YYYY-MM-DD. Omit for 10 years before the latest close, or the full history if shorter. Ignored with mode crash

Output Schema

NameRequiredDescriptionDefault
citeYesHow to credit this result
dataYes
nextYesSuggested follow-up calls
linksYes
how_toYesSteps for the user to see or redo this on smartfin.fyi
sourceYes
summaryYesPlain-language result the assistant can quote

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedOutput schema / properties / data / properties / falls / items / properties / end_date
      Added value: +{
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / data / properties / falls / items / properties / ended_by
      Added value: +{
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / data / properties / falls / items / properties / inside_fall_from
      Added value: +{
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / data / properties / falls / items / properties / rebound_pct
      Added value: +{
      +  "type": [
      +    "number",
      +    "null"
      +  ]
      +}
  2. Changed5 schema fields changed
    • changedInput schema / properties / amount / description
      Previous value: -"Optional lump sum invested at the deepest fall's high, in US dollars: when it was worth that amount again"New value: +"The same amount bought at each counted fall: at its high, at the first close fall_pct down, and at its lowest close, each valued at the to_date close, in US dollars. Default 1000"
    • changedInput schema / properties / amount / minimum
      Previous value: -0New value: +1
    • removedInput schema / properties / monthly
      Removed value: -{
      -  "description": "Optional monthly amount from the deepest fall's high on the first trading day of each month, in US dollars: when it was first worth what had been put in",
      -  "maximum": 10000000,
      -  "minimum": 0,
      -  "type": "number"
      -}
    • addedOutput schema / properties / data / properties / buys
      Added value: +{
      +  "type": [
      +    "object",
      +    "null"
      +  ]
      +}
    • removedOutput schema / properties / data / properties / investor
      Removed value: -{
      -  "type": [
      -    "object",
      -    "null"
      -  ]
      -}
  3. Changed5 schema fields changed
    • changedInput schema / properties / fall_pct / description
      Previous value: -"A fall counts once a close is this % or more below the highest close before it. Default 20. Ignored with mode crash"New value: +"A fall counts once a close is this % or more below the highest close since the last fall ended. A rise of this % or more from its lowest close ends it. Default 20. Ignored with mode crash"
    • addedInput schema / properties / within
      Added value: +{
      +  "description": "How fast a fall had to reach fall_pct, counted from its high: 1m, 3m (default), 1y, any, or a whole number of days from 1 to 3650. Ignored with mode crash",
      +  "pattern": "^(1m|3m|1y|any|[0-9]{1,4})$",
      +  "type": "string"
      +}
    • addedOutput schema / properties / data / properties / slower_falls_left_out
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / data / properties / time_limit_note
      Added value: +{
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / data / properties / within
      Added value: +{
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
  4. Changed3 schema fields changed
    • removedInput schema / properties / compare
      Removed value: -{
      -  "description": "Up to two more symbols measured the same way over the same dates (or in the same crash)",
      -  "items": {
      -    "description": "Stock or ETF symbol, not a company name: AAPL not Apple. Covers 508 symbols: the S&P 500 companies plus the index ETFs SPY, VOO, IVV, QQQ, DIA, IWM, VTI.",
      -    "pattern": "^[A-Za-z][A-Za-z.\\-]{0,9}$",
      -    "type": "string"
      -  },
      -  "maxItems": 2,
      -  "type": "array"
      -}
    • removedOutput schema / properties / data / properties / compare
      Removed value: -{
      -  "type": "array"
      -}
    • changedOutput schema / properties / data / required
      Previous value: -[
      -  "symbol",
      -  "company",
      -  "mode",
      -  "fall_pct",
      -  "from",
      -  "to",
      -  "as_of",
      -  "basis",
      -  "falls",
      -  "summary",
      -  "selected",
      -  "benchmark",
      -  "triggers",
      -  "compare",
      -  "sensitivity",
      -  "limits",
      -  "method_version"
      -]New value: +[
      +  "symbol",
      +  "company",
      +  "mode",
      +  "fall_pct",
      +  "from",
      +  "to",
      +  "as_of",
      +  "basis",
      +  "falls",
      +  "summary",
      +  "selected",
      +  "benchmark",
      +  "triggers",
      +  "sensitivity",
      +  "limits",
      +  "method_version"
      +]
  5. Added

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnly, idempotent, closed-world, non-destructive), so the bar is low, but the description far exceeds it: data basis (split-adjusted closes, dividends reinvested, USD), universe limits (508 symbols: S&P 500 plus named ETFs), default date window (10 years or full history if shorter), the rule that nothing after to_date is used, and how not-yet-recovered falls and inside-falls are represented in the output.

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

Conciseness2/5

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

Roughly 470 words in a single undifferentiated block, with the practical guidance (use when / do not use / limits) stranded at the very end. Several sentences are unparseable on first read, e.g. the inside-fall clause chaining 'from a lower close on the way down with no higher close between it and that low, that recovered to its own starting close by to_date, before any close below that low', and the return-value inventory duplicates what the output schema already provides.

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 an 8-parameter tool with an output schema, the description leaves nothing material unexplained: the measurement methodology, the universe, date defaults, the crash-mode override, and benchmark handling (SPY on the same high date) are all covered. An agent could invoke this correctly and interpret the results without further information.

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 a 3 is the baseline, but the description adds real meaning beyond the schema: the default fall_pct of 20 and how a fall starts/ends, the 'within' time-limit semantics, the exact S&P 500 crash windows used by mode crash (dotcom 2000-03-24 to 2002-10-09, 2008, covid, 2022), and what amount is bought at which three prices. Only from_date/to_date and crash enum are mostly restated from the schema.

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 opening states the resource and scope precisely: every fall of a chosen size (default 20%) for one US-listed stock or ETF, measured on split-adjusted daily closes with dividends reinvested. It also differentiates from a sibling by name (smartfin_calculate_investment_return for 'what an amount became between two dates'). The gap is that the statement is a noun-phrase fragment with no governing verb, and the core purpose is immediately buried under algorithmic mechanics, so an agent must parse a wall of text to extract 'find drawdowns and their recoveries'.

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?

Explicit when-to-use with three concrete example phrasings ('how long did Apple take to recover from 2008', 'NVDA biggest falls and recovery time', 'how many 20% drops has SPY had'). It also gives explicit exclusions (no forecasts, no intraday, no out-of-universe symbols, no price-only basis) and names the correct alternative tool for a related-but-different question.

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