Skip to main content
Glama

Loan sizing (LTV / DSCR / debt yield)

calc_debt_sizing
Read-onlyIdempotent

Size the maximum loan under any combination of max LTV, min DSCR, and min debt yield for a given NOI, rate, and amortization. Reports the binding constraint, debt service, and resulting metrics; optionally a stress table over NOI, rate, and value shocks (max loan, binding constraint, LTV, DSCR, debt yield per scenario) and the refinance shortfall against an existing loan balance. Deterministic: the same inputs always give the same result, with formula ID calc.debt_sizing@3, every step, and any warnings.

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": {
      "noi": "<noi>",
      "rate_annual": "<rate_annual>",
      "amortization_years": "<amortization_years>"
    },
    "name": "calc_debt_sizing"
  }
}

Input Schema

NameRequiredDescriptionDefault
noiYesUnderwritten net operating income, USD/yr. Must be greater than 0.
valueNoAppraised or underwritten value, USD. Required when max_ltv is set. Must be greater than 0.
stressNoStress table: every combination of the NOI, rate, and value shocks (up to 1,000 scenarios), each sized under the same constraints and rounding. The base result is unchanged.
max_ltvNoMaximum loan-to-value, e.g. 0.65. Must be greater than 0.
min_dscrNoMinimum debt service coverage ratio, e.g. 1.25. Must be greater than 0.
rate_annualYesAnnual interest rate, e.g. 0.065. Must be less than 1.
round_down_toNoRound the final loan amount down to this increment (lenders often use 1,000 or 10,000). Must be greater than 0.
min_debt_yieldNoMinimum debt yield (NOI ÷ loan), e.g. 0.09. Must be greater than 0. Must be less than 1.
amortization_yearsYesAmortization in years; 0 means interest-only.
existing_loan_balanceNoBalance of the loan being refinanced, USD. Adds a refinance result (shortfall or excess proceeds against the max loan) and a shortfall per stress scenario. Must be greater than 0.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed41 schema fields changed
    • changedInput schema / properties / existing_loan_balance / description
      Previous value: -"Balance of the loan being refinanced, USD. Adds a refinance result (shortfall or excess proceeds against the max loan) and a shortfall per stress scenario."New value: +"Balance of the loan being refinanced, USD. Adds a refinance result (shortfall or excess proceeds against the max loan) and a shortfall per stress scenario. Must be greater than 0."
    • removedInput schema / properties / existing_loan_balance / exclusiveMinimum
      Removed value: -0
    • addedInput schema / properties / existing_loan_balance / minimum
      Added value: +0
    • changedInput schema / properties / max_ltv / description
      Previous value: -"Maximum loan-to-value, e.g. 0.65."New value: +"Maximum loan-to-value, e.g. 0.65. Must be greater than 0."
    • removedInput schema / properties / max_ltv / exclusiveMinimum
      Removed value: -0
    • addedInput schema / properties / max_ltv / minimum
      Added value: +0
    • changedInput schema / properties / min_debt_yield / description
      Previous value: -"Minimum debt yield (NOI ÷ loan), e.g. 0.09."New value: +"Minimum debt yield (NOI ÷ loan), e.g. 0.09. Must be greater than 0. Must be less than 1."
    • removedInput schema / properties / min_debt_yield / exclusiveMaximum
      Removed value: -1
    • removedInput schema / properties / min_debt_yield / exclusiveMinimum
      Removed value: -0
    • addedInput schema / properties / min_debt_yield / maximum
      Added value: +1
    • addedInput schema / properties / min_debt_yield / minimum
      Added value: +0
    • changedInput schema / properties / min_dscr / description
      Previous value: -"Minimum debt service coverage ratio, e.g. 1.25."New value: +"Minimum debt service coverage ratio, e.g. 1.25. Must be greater than 0."
    • removedInput schema / properties / min_dscr / exclusiveMinimum
      Removed value: -0
    • addedInput schema / properties / min_dscr / minimum
      Added value: +0
    • changedInput schema / properties / noi / description
      Previous value: -"Underwritten net operating income, USD/yr."New value: +"Underwritten net operating income, USD/yr. Must be greater than 0."
    • removedInput schema / properties / noi / exclusiveMinimum
      Removed value: -0
    • addedInput schema / properties / noi / minimum
      Added value: +0
    • changedInput schema / properties / rate_annual / description
      Previous value: -"Annual interest rate, e.g. 0.065."New value: +"Annual interest rate, e.g. 0.065. Must be less than 1."
    • removedInput schema / properties / rate_annual / exclusiveMaximum
      Removed value: -1
    • addedInput schema / properties / rate_annual / maximum
      Added value: +1
    • changedInput schema / properties / round_down_to / description
      Previous value: -"Round the final loan amount down to this increment (lenders often use 1,000 or 10,000)."New value: +"Round the final loan amount down to this increment (lenders often use 1,000 or 10,000). Must be greater than 0."
    • removedInput schema / properties / round_down_to / exclusiveMinimum
      Removed value: -0
    • addedInput schema / properties / round_down_to / minimum
      Added value: +0
    • addedInput schema / properties / stress / properties / noi_shocks / items / description
      Added value: +"Must be greater than -1. Must be less than 10."
    • removedInput schema / properties / stress / properties / noi_shocks / items / exclusiveMaximum
      Removed value: -10
    • removedInput schema / properties / stress / properties / noi_shocks / items / exclusiveMinimum
      Removed value: --1
    • addedInput schema / properties / stress / properties / noi_shocks / items / maximum
      Added value: +10
    • addedInput schema / properties / stress / properties / noi_shocks / items / minimum
      Added value: +-1
    • addedInput schema / properties / stress / properties / rate_shocks / items / description
      Added value: +"Must be greater than -1. Must be less than 1."
    • removedInput schema / properties / stress / properties / rate_shocks / items / exclusiveMaximum
      Removed value: -1
    • removedInput schema / properties / stress / properties / rate_shocks / items / exclusiveMinimum
      Removed value: --1
    • addedInput schema / properties / stress / properties / rate_shocks / items / maximum
      Added value: +1
    • addedInput schema / properties / stress / properties / rate_shocks / items / minimum
      Added value: +-1
    • addedInput schema / properties / stress / properties / value_shocks / items / description
      Added value: +"Must be greater than -1. Must be less than 10."
    • removedInput schema / properties / stress / properties / value_shocks / items / exclusiveMaximum
      Removed value: -10
    • removedInput schema / properties / stress / properties / value_shocks / items / exclusiveMinimum
      Removed value: --1
    • addedInput schema / properties / stress / properties / value_shocks / items / maximum
      Added value: +10
    • addedInput schema / properties / stress / properties / value_shocks / items / minimum
      Added value: +-1
    • changedInput schema / properties / value / description
      Previous value: -"Appraised or underwritten value, USD. Required when max_ltv is set."New value: +"Appraised or underwritten value, USD. Required when max_ltv is set. Must be greater than 0."
    • removedInput schema / properties / value / exclusiveMinimum
      Removed value: -0
    • addedInput schema / properties / value / minimum
      Added value: +0
  2. Changed2 schema fields changed
    • addedInput schema / properties / existing_loan_balance
      Added value: +{
      +  "description": "Balance of the loan being refinanced, USD. Adds a refinance result (shortfall or excess proceeds against the max loan) and a shortfall per stress scenario.",
      +  "exclusiveMinimum": 0,
      +  "type": "number"
      +}
    • addedInput schema / properties / stress
      Added value: +{
      +  "description": "Stress table: every combination of the NOI, rate, and value shocks (up to 1,000 scenarios), each sized under the same constraints and rounding. The base result is unchanged.",
      +  "properties": {
      +    "noi_shocks": {
      +      "description": "Relative NOI changes as decimals, e.g. [-0.05, -0.1, -0.2] for NOI down 5%, 10%, 20%. Omit for no NOI shock.",
      +      "items": {
      +        "exclusiveMaximum": 10,
      +        "exclusiveMinimum": -1,
      +        "type": "number"
      +      },
      +      "maxItems": 10,
      +      "minItems": 1,
      +      "type": "array"
      +    },
      +    "rate_shocks": {
      +      "description": "Absolute changes to rate_annual as decimals, e.g. [0.005, 0.01] for +50 and +100 bp. The stressed rate must stay at or above 0 and below 1. Omit for no rate shock.",
      +      "items": {
      +        "exclusiveMaximum": 1,
      +        "exclusiveMinimum": -1,
      +        "type": "number"
      +      },
      +      "maxItems": 10,
      +      "minItems": 1,
      +      "type": "array"
      +    },
      +    "value_moves_with_noi": {
      +      "default": false,
      +      "description": "Also scale value by each NOI shock (value × (1 + noi_shock), a constant cap rate), as a lender repricing value on stressed NOI would.",
      +      "type": "boolean"
      +    },
      +    "value_shocks": {
      +      "description": "Relative value changes as decimals, e.g. [-0.1, -0.2]; requires value. Omit for no value shock.",
      +      "items": {
      +        "exclusiveMaximum": 10,
      +        "exclusiveMinimum": -1,
      +        "type": "number"
      +      },
      +      "maxItems": 10,
      +      "minItems": 1,
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
  3. First observed

TDQS

A4/5.0
Behavior4/5

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

Annotations already establish read-only, idempotent, closed-world, non-destructive behavior, and the description adds genuinely new context: determinism, a versioned formula ID (calc.debt_sizing@3), that every step and any warnings are surfaced, that the base result is unaffected by stress, and what the refinance branch returns. It stops short of noting magnitude limits or computational cost, but the behavioral disclosure is solid.

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?

Three sentences, front-loaded with the core action and constraints before the optional outputs. Dense but every clause carries information; the final run-on covering determinism, formula ID, and warnings could have been split for scanability.

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 10-parameter tool with a nested stress object and no output schema, the description enumerates the return payload (binding constraint, debt service, resulting metrics, per-scenario max loan/LTV/DSCR/debt yield, refinance shortfall), which is exactly what an agent needs since no output schema exists. Safety profile is covered by annotations.

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% and the stress sub-object is thoroughly documented in-schema, so the schema carries the parameter burden. The description adds conceptual framing — 'binding constraint', 'debt service', 'shortfall per scenario' — but repeats ground the schema already covers rather than adding new semantics.

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 ('Size the maximum loan') and enumerates the constraining ratios (max LTV, min DSCR, min debt yield) plus the inputs it consumes (NOI, rate, amortization). This is unmistakably the loan-sizing calculation and cannot be confused with siblings like calc_amortization_schedule or calc_direct_cap.

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?

The phrase 'under any combination of' tells the agent the constraints are optional and composable, and the optional stress/refinance blocks are flagged with 'optionally'. However, it names no alternatives and gives no explicit when-not guidance (e.g., when to prefer calc_amortization_schedule for payment detail or calc_dcf_pro_forma for full pro formas), leaving routing to inference.

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.