Skip to main content
Glama
datalattice

mcp-chainladder

by datalattice

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
compute_chain_ladderA

Run a full chain-ladder reserving calculation on a cumulative loss triangle. This is the workhorse tool — call it whenever the user asks "what's the IBNR?", "what does the chain ladder say?", or hands you a triangle and asks for projections.

Args: triangle: Cumulative loss triangle as a list of lists. Outer index is the accident-year row (oldest first). Inner index is the development period (0 = first age). Cells are numbers or null; null means unobserved (typical lower-right corner of a real triangle). All rows should be the same length — pad with trailing nulls if needed. selected_factors: Optional list of user-chosen age-to-age factors, one per development-period transition (length = n_dev - 1). When omitted, the volume-weighted factors derived from the triangle are used as the selected set. tail: Multiplicative tail factor applied beyond the last development period. Default 1.0 (no tail). excluded: List of [row_i, dev_j] pairs identifying individual link ratios to drop from the volume and simple averages. Use this for outlier handling — typically after consulting mack_diagnostics to find suspect cells.

Returns: A dictionary containing: - volume_factors: list[float] — volume-weighted age-to-age - simple_factors: list[float] — simple average of link ratios - selected_factors: list[float] — the set actually used - individual_factors: list[list[float | None]] — per-row link ratios C[i, j+1] / C[i, j]; null where the pair is unobserved - cdf: list[float] — cumulative dev factors to ultimate; last element is tail - latest_diagonal: list[float] — most recent observed value per accident row - ultimates: list[float] — projected ultimate per accident row - ibnr: list[float] — Ultimate − Latest, per accident row - total_latest, total_ultimate, total_ibnr: float scalars - n_acc, n_dev: int — triangle dimensions for convenience

project_triangleA

Fill the lower-right (unobserved) cells of a cumulative triangle using the supplied age-to-age factors.

Args: triangle: As in compute_chain_ladder. selected_factors: One factor per development-period transition. Length must be n_dev - 1.

Returns a dict with: - triangle: 2-D list of floats, same shape as the input, with unobserved cells filled in by chain-ladder projection. Rows with no observation contain nan for the projected cells. - disclaimer: standard actuarial-use disclaimer.

mack_stochasticA

Mack (1993) stochastic chain-ladder error estimation. Returns distribution-free standard errors and coefficients of variation per accident row plus the totals — the canonical sensitivity check for a deterministic chain-ladder result.

Use this when the user asks about uncertainty, reserve risk, or confidence intervals. Pair it with compute_chain_ladder (use the same selected_factors for consistency).

Args: triangle: As in compute_chain_ladder. selected_factors: The factors used for the point-estimate projection. Length = n_dev - 1. excluded: Outlier exclusions to honour, same shape as in compute_chain_ladder.

Returns: - sigma2: list[float] — σ̂_j² per development period; backfilled via Mack's tail rule when only one observation is available - se_per_row: list[float] — standard error of each ultimate - cv_per_row: list[float] — coefficient of variation (SE / Ultimate) per accident row - se_total: float — SE of the sum of all ultimates (includes cross-row covariance per Mack eq. 5.15) - cv_total: float — CV of the total ultimate

mack_diagnosticsA

Mack (1994) assumption diagnostics — three statistical tests plus standardised-residual outlier detection. Use when the user asks "does the chain ladder look OK?", "are there any outliers?", or "should I be worried about [calendar-year / inflation / dependence] effects?".

Args: triangle: As in compute_chain_ladder. selected_factors: Length-(n_dev - 1) factor set. excluded: Outlier exclusions to honour. outlier_threshold: Absolute standardised-residual threshold for flagging an outlier. Default 2.0 (the Tk app's default).

Returns: - standardised_residuals: list[list[float | null]] — per-cell residual r[i,j] = (C[i,j+1] − f_j·C[i,j]) / (σ_j·√C[i,j]); null where the cell is excluded or the pair is unobserved - outliers: list of {row: int, dev: int, residual: float} — cells with |residual| > outlier_threshold - calendar_year: {z: float, p_two_sided: float} — Tarbell sign test for calendar-year effects (large |z| ⇒ suspect) - independence: {z: float, p_two_sided: float} — Spearman rank-correlation between adjacent development columns (large |z| ⇒ link ratios are not independent) - inflation: {slope: float, p_value: float} — OLS slope of mean(ln link-ratio) on accident-year index (non-zero ⇒ accident-year trend in link ratios)

Verdict guidance for translating p-values to plain English: p < 0.005 → "strong evidence"; p < 0.05 → "significant"; p < 0.10 → "borderline"; p ≥ 0.10 → "no evidence".

parse_csv_triangleA

Parse a CSV file from disk into a cumulative loss triangle.

Reads the file, treats empty cells and the tokens "NA", "N/A", "NaN", "-" as unobserved, strips embedded commas (thousand separators), and drops any leading row whose first cell is non-numeric but whose remaining cells are mostly numeric (e.g. a "Dev 1, Dev 2, …" header). Auto-pads jagged rows to a rectangle with nulls.

Use this when the user gives you a CSV file path and wants to run the chain ladder on it.

Args: path: Absolute or ~-relative path to the CSV file. Must be readable by the server process.

Returns: - triangle: list[list[float | null]] — parsed cells, ready to pass to compute_chain_ladder - n_acc: int — number of accident-year rows - n_dev: int — number of development periods (max row length) - source: str — absolute path actually read

to_incrementalA

Convert a cumulative triangle to incremental (per-period) values.

inc[i, 0] = cum[i, 0] inc[i, j>0] = cum[i, j] - cum[i, j-1] (when both observed)

Unobserved cells stay unobserved.

Args: cumulative: Cumulative triangle, possibly with unobserved cells.

Returns dict with triangle (incremental, same shape) and the standard disclaimer.

to_cumulativeA

Convert an incremental triangle to cumulative (running sum per row). Unobserved cells propagate as null. Inverse of to_incremental on observed cells.

Args: incremental: Incremental triangle.

Returns dict with triangle (cumulative, same shape) and the standard disclaimer.

pro_license_statusA

Inspect the current Pro-tier license state. Returns whether Pro tools are unlocked, the registered owner, an expiry date if any, and a human-readable message that Claude can relay to the user. Free to call regardless of license state.

Returns: - active: bool — whether the license is currently valid - owner: str | null — email associated with the license - expires: int | null — unix-epoch seconds, null = perpetual - message: str — plain-English status (great for Claude to read back to the user) - upgrade_url: str — where to buy / renew

bornhuetter_fergusonA

Bornhuetter-Ferguson (1972) reserving method. Pro tier.

Combines the chain-ladder development pattern with an externally- provided a-priori ultimate per accident year, giving a result that is far less sensitive to noisy late development than pure chain ladder. The canonical "second method" for benchmarking reserves — when chain-ladder and BF agree, you can publish with confidence; when they diverge, the divergence is the finding.

Args: triangle: Cumulative loss triangle, same shape as compute_chain_ladder. a_priori_ultimates: Expected ultimate per accident-year row, usually derived from premium × expected loss ratio or a plan figure. Must have length n_acc. selected_factors: Override factor set; defaults to volume- weighted (same default as chain ladder). tail: Multiplicative tail factor. Default 1.0. excluded: Outlier exclusions, same shape as in compute_chain_ladder.

Returns either: - On success: {a_priori_ultimates, used_up_proportion, bf_ultimates, bf_ibnr, cl_ultimates, cl_ibnr, total_bf_ultimate, total_bf_ibnr, total_cl_ultimate, total_cl_ibnr} — note the chain-ladder values are returned alongside so the user can see the two methods side-by-side. - On license failure: {error, status} with status giving the upgrade URL and reason. Free-tier callers get this and can still see the API shape; no compute happens.

interpret_diagnosticsA

Run Mack assumption diagnostics + label each result with a plain- English verdict and a recommended action. Pro tier.

Free-tier mack_diagnostics returns raw Z-scores and p-values; this Pro variant adds:

• verdict band ("strong evidence" / "significant" / "borderline" / "no evidence") for each test, using the standard p-value cutoffs • a one-paragraph summary written so Claude can read it back to the user without further interpretation • a specific recommended action for each finding ("try BF", "weight recent years only", "investigate cells X, Y, Z", …) • an overall verdict pulling the three tests + outlier scan together into a single sentence

Use this when the user asks "is the chain ladder OK?", "should I publish this?", or "what does the model tell me about itself?".

Args: triangle: As in compute_chain_ladder. selected_factors: Length-(n_dev - 1) factor set used for the point estimate. excluded: Outlier exclusions to honour. outlier_threshold: Absolute residual threshold for flagging cells (default 2.0).

Returns either: - On success: {calendar_year, independence, inflation, outliers, overall} — each test object carries stat, p_value, verdict, summary, recommendation. The outliers object also reports count, severity (clean / mild / moderate / severe), and a list of flagged cells. - On license failure: {error: "pro_license_required", status: {...}}.

sensitivity_analysisA

Drop each observable link ratio one at a time, rerun the chain ladder, and rank the link ratios by their impact on total IBNR. Pro tier.

The fastest way to find the few observations that are actually driving the projection. Use after mack_diagnostics flags outliers — these are the cells to investigate first.

Args: triangle: As in compute_chain_ladder. selected_factors: Override factor set; defaults to volume- weighted. tail: Multiplicative tail factor. excluded: Existing exclusions; the analysis honours these and tests one additional cell at a time. top_n: Cap on the number of "most influential" cells returned. Default 10. Set higher for larger triangles.

Returns either: - On success: {baseline_ibnr, n_tested, top_influential[], summary} — each top_influential entry has row, dev, ratio, ibnr_with_excluded, ibnr_delta, ibnr_delta_pct. - On license failure: {error, status}.

tail_extrapolationA

Fit parametric tail models to the late development factors and extrapolate forward. Pro tier.

Fits two candidate models — exponential decay (ln(f_j - 1) = a + b·j) and inverse-power (ln(f_j - 1) = a + b·ln(j+1)) — picks the better R², and returns the implied tail factor for plugging back into compute_chain_ladder(tail=…).

Use this when the triangle obviously hasn't reached ultimate by the last observed development period — i.e., the last selected factor is still meaningfully above 1.

Args: selected_factors: The factor set you want to extrapolate from. n_extra: How many extra development periods to project. Default 6 (covers most P&C lines).

Returns either: - On success: {fits[], recommended, summary} — each fits entry has model, parameters, r_squared, extrapolated[], tail_factor. - On license failure: {error, status}.

compare_methodsA

Run chain ladder + Bornhuetter-Ferguson on the same triangle and return a side-by-side comparison. Pro tier.

The canonical "second opinion" — when both methods agree, the reserve is defensible; when they diverge, the divergence is the finding. Reports total deltas plus the single AY where the two methods disagree most.

Args: triangle: As in compute_chain_ladder. a_priori_ultimates: One expected ultimate per AY for the BF method. selected_factors, tail, excluded: As in compute_chain_ladder.

Returns either: - On success: {chain_ladder, bornhuetter_ferguson, diffs_by_ay, total_diff_ultimate, total_diff_ibnr, largest_divergence}. - On license failure: {error, status}.

sample_triangleA

Return the classic textbook 10×10 cumulative-paid triangle (Friedland-style). Useful for demos, examples, and verifying the server is working — feed it to compute_chain_ladder to get the well-known parity values (Paid 49,458 / Ultimate 65,883 / IBNR 16,425 / Mack SE ±354.61).

Returns: - triangle: the 10×10 list with the lower-right as null - n_acc: 10 - n_dev: 10 - expected_totals: well-known parity values for cross-checking

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

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/datalattice/mcp-chainladder'

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