Skip to main content
Glama
simonmak-ascent

io.github.simonmak-ascent/fair-value

Expected credit loss

calculate_ecl
Read-onlyIdempotent

Compute IFRS 9 or HKFRS 9 expected credit loss for a single exposure by multiplying EAD, PD, and LGD, returning the ECL amount in the exposure's currency.

Instructions

Compute IFRS 9 / HKFRS 9 expected credit loss as EAD x PD x LGD. Use this for a single exposure; for portfolio or staging PD models use the delegated credit-risk tools. Returns the ECL amount in the exposure's currency.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
loss_given_defaultYesLoss given default as a decimal 0-1 (1 - recovery rate).
exposure_at_defaultYesExposure at default (EAD) in currency units.
probability_of_defaultYesProbability of default over the horizon, as a decimal 0-1.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNoError detail, present only when status='error'.
stepsNoOrdered computation steps, when the method reports them.
valueNoPrimary result: a number for scalar tools, an object for valuation tools.
methodNoMethod or tool name that produced the result.
statusYes'ok' on success, 'error' on failure.
tickerNoTicker the result pertains to, when applicable.
assumptionsNoInputs and assumptions used, echoed for traceability.
formula_refNoFormula or standards reference for the method.
data_timestampNoISO-8601 UTC timestamp of the underlying data, when fetched.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint and destructiveHint=false, so the safety profile is covered by structured data. The description adds the formula and states the return currency, but says nothing about validation failures, precision, or error behavior beyond what annotations and the output schema supply.

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

Conciseness5/5

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

Three short sentences with zero filler: what it computes, when to use it versus alternatives, and what it returns. The purpose is front-loaded and the routing guidance follows immediately.

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?

With full schema coverage, annotations, and an output schema, the description covers purpose, formula, scope and return currency adequately. The only gap is the unclear reference to unspecified 'delegated credit-risk tools' for the portfolio case.

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?

Schema description coverage is 100%, so EAD, PD and LGD units/ranges are already documented in the schema; baseline for that is 3. The description adds only the relationship among the three inputs via the formula, not per-parameter syntax or edge cases.

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 ('Compute IFRS 9 / HKFRS 9 expected credit loss') and gives the exact formula EAD x PD x LGD, so the agent knows precisely what is calculated. It also distinguishes itself from portfolio/staging siblings.

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?

Explicitly scopes usage to a single exposure and routes portfolio or staging PD models elsewhere, which is clear when-to-use guidance. The alternative is only referred to vaguely as 'the delegated credit-risk tools', which do not appear in the sibling list, so routing is not fully actionable.

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