Skip to main content
Glama

Loan prepayment premium and defeasance

calc_prepayment_and_defeasance
Read-onlyIdempotent

Prepayment premium, total payoff, and cost as a share of balance for a fixed-rate amortizing or interest-only loan under yield maintenance (PV of remaining payments or rate differential, with a minimum and an explicit discounting convention), a step-down schedule, a flat percentage, or defeasance (cost of the securities portfolio that funds the remaining payments plus stated costs). Deterministic: the same inputs always give the same result, with formula ID calc.prepayment_and_defeasance@1, 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": {
      "balance": "<balance>",
      "note_rate_annual": "<note_rate_annual>",
      "remaining_term_months": "<remaining_term_months>",
      "amortization_months": "<amortization_months>",
      "prepayment": "<prepayment>"
    },
    "name": "calc_prepayment_and_defeasance"
  }
}

Input Schema

NameRequiredDescriptionDefault
balanceYesOutstanding principal balance at the payoff date, USD. Must be greater than 0.
prepaymentYesPrepayment provision from the note.
accrued_interestNoAccrued but unpaid interest to the payoff date, USD; added to the total payoff.
note_rate_annualYesFixed annual note rate, e.g. 0.055. Must be less than 1.
amortization_monthsYesRemaining amortization basis in months at the payoff date (e.g. 300 for a 30-year schedule with 5 years elapsed); 0 for interest-only. Must be at least remaining_term_months.
remaining_term_monthsYesMonths from the payoff date to the loan's maturity date (the balloon is due with the final payment).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changed
    • changedInput schema / properties / balance / description
      Previous value: -"Outstanding principal balance at the payoff date, USD."New value: +"Outstanding principal balance at the payoff date, USD. Must be greater than 0."
    • removedInput schema / properties / balance / exclusiveMinimum
      Removed value: -0
    • addedInput schema / properties / balance / minimum
      Added value: +0
    • changedInput schema / properties / note_rate_annual / description
      Previous value: -"Fixed annual note rate, e.g. 0.055."New value: +"Fixed annual note rate, e.g. 0.055. Must be less than 1."
    • removedInput schema / properties / note_rate_annual / exclusiveMaximum
      Removed value: -1
    • addedInput schema / properties / note_rate_annual / maximum
      Added value: +1
    • changedInput schema / properties / prepayment / oneOf
      Previous value: -[
      -  {
      -    "description": "Yield maintenance.",
      -    "properties": {
      -      "basis": {
      -        "default": "pv_of_payments",
      -        "description": "pv_of_payments (default): premium = PV of the remaining scheduled payments at the discount rate − balance. rate_differential: premium = PV of (note rate − discount rate) ÷ 12 × scheduled balance for each remaining month.",
      -        "enum": [
      -          "pv_of_payments",
      -          "rate_differential"
      -        ],
      -        "type": "string"
      -      },
      -      "discount_convention": {
      -        "default": "monthly",
      -        "description": "Compounding convention for the discount rate. monthly (default): monthly rate = annual ÷ 12. semiannual: annual is a bond-equivalent yield, monthly rate = (1 + annual ÷ 2)^(1/6) − 1. Lenders differ; read the note.",
      -        "enum": [
      -          "monthly",
      -          "semiannual"
      -        ],
      -        "type": "string"
      -      },
      -      "minimum_pct": {
      -        "default": 0.01,
      -        "description": "Minimum premium as a fraction of the balance, e.g. 0.01 for a 1% floor (default). 0 for no floor.",
      -        "exclusiveMaximum": 1,
      -        "minimum": 0,
      -        "type": "number"
      -      },
      -      "spread_annual": {
      -        "default": 0,
      -        "description": "Spread added to the Treasury yield for discounting, e.g. 0.005 when the note says 'Treasury plus 50 basis points'. Default 0 (Treasury flat).",
      -        "exclusiveMaximum": 1,
      -        "minimum": 0,
      -        "type": "number"
      -      },
      -      "treasury_rate_annual": {
      -        "description": "Yield on the reference Treasury (usually the one maturing closest to the loan's maturity), e.g. 0.041.",
      -        "exclusiveMaximum": 1,
      -        "minimum": 0,
      -        "type": "number"
      -      },
      -      "type": {
      -        "const": "yield_maintenance",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "treasury_rate_annual"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "description": "Step-down (declining percentage) premium.",
      -    "properties": {
      -      "loan_month": {
      -        "description": "Loan month (1 = first month after origination) in which the payoff occurs.",
      -        "maximum": 9007199254740991,
      -        "minimum": 1,
      -        "type": "integer"
      -      },
      -      "schedule": {
      -        "description": "Step-down schedule in ascending through_month order, e.g. 5-4-3-2-1. After the last through_month the loan is open (0%).",
      -        "items": {
      -          "properties": {
      -            "pct": {
      -              "description": "Premium as a fraction of the balance, e.g. 0.05 for 5%.",
      -              "exclusiveMaximum": 1,
      -              "minimum": 0,
      -              "type": "number"
      -            },
      -            "through_month": {
      -              "description": "Last loan month in which this percentage applies.",
      -              "maximum": 9007199254740991,
      -              "minimum": 1,
      -              "type": "integer"
      -            }
      -          },
      -          "required": [
      -            "through_month",
      -            "pct"
      -          ],
      -          "type": "object"
      -        },
      -        "maxItems": 1200,
      -        "minItems": 1,
      -        "type": "array"
      -      },
      -      "type": {
      -        "const": "step_down",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "loan_month",
      -      "schedule"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "description": "Flat percentage premium.",
      -    "properties": {
      -      "pct": {
      -        "description": "Premium as a fraction of the balance, e.g. 0.02.",
      -        "exclusiveMaximum": 1,
      -        "minimum": 0,
      -        "type": "number"
      -      },
      -      "type": {
      -        "const": "fixed_pct",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "pct"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "description": "Defeasance: buy securities that replicate the remaining payments.",
      -    "properties": {
      -      "costs": {
      -        "default": 0,
      -        "description": "Stated transaction costs, USD: defeasance consultant, legal, accountant, rating agency, servicer and custodian fees.",
      -        "minimum": 0,
      -        "type": "number"
      -      },
      -      "discount_convention": {
      -        "default": "monthly",
      -        "description": "Compounding convention for the discount rate. monthly (default): monthly rate = annual ÷ 12. semiannual: annual is a bond-equivalent yield, monthly rate = (1 + annual ÷ 2)^(1/6) − 1. Lenders differ; read the note.",
      -        "enum": [
      -          "monthly",
      -          "semiannual"
      -        ],
      -        "type": "string"
      -      },
      -      "replacement_yield": {
      -        "anyOf": [
      -          {
      -            "description": "One flat annual yield for all replacement securities.",
      -            "exclusiveMaximum": 1,
      -            "minimum": 0,
      -            "type": "number"
      -          },
      -          {
      -            "description": "Yield curve as a step function: each payment uses the first point whose months ≥ its month; beyond the last point, the last rate.",
      -            "items": {
      -              "properties": {
      -                "months": {
      -                  "description": "Months from the payoff date up to and including which this yield applies; points in ascending order.",
      -                  "maximum": 9007199254740991,
      -                  "minimum": 1,
      -                  "type": "integer"
      -                },
      -                "rate": {
      -                  "description": "Annual yield on replacement securities maturing at or before that month, e.g. 0.042.",
      -                  "exclusiveMaximum": 1,
      -                  "minimum": 0,
      -                  "type": "number"
      -                }
      -              },
      -              "required": [
      -                "months",
      -                "rate"
      -              ],
      -              "type": "object"
      -            },
      -            "maxItems": 1200,
      -            "minItems": 1,
      -            "type": "array"
      -          }
      -        ],
      -        "description": "Yield on the government securities bought to fund the remaining payments: a flat annual rate, or a list of {months, rate} points."
      -      },
      -      "type": {
      -        "const": "defeasance",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "replacement_yield"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "description": "Yield maintenance.",
      +    "properties": {
      +      "basis": {
      +        "default": "pv_of_payments",
      +        "description": "pv_of_payments (default): premium = PV of the remaining scheduled payments at the discount rate − balance. rate_differential: premium = PV of (note rate − discount rate) ÷ 12 × scheduled balance for each remaining month.",
      +        "enum": [
      +          "pv_of_payments",
      +          "rate_differential"
      +        ],
      +        "type": "string"
      +      },
      +      "discount_convention": {
      +        "default": "monthly",
      +        "description": "Compounding convention for the discount rate. monthly (default): monthly rate = annual ÷ 12. semiannual: annual is a bond-equivalent yield, monthly rate = (1 + annual ÷ 2)^(1/6) − 1. Lenders differ; read the note.",
      +        "enum": [
      +          "monthly",
      +          "semiannual"
      +        ],
      +        "type": "string"
      +      },
      +      "minimum_pct": {
      +        "default": 0.01,
      +        "description": "Minimum premium as a fraction of the balance, e.g. 0.01 for a 1% floor (default). 0 for no floor. Must be less than 1.",
      +        "maximum": 1,
      +        "minimum": 0,
      +        "type": "number"
      +      },
      +      "spread_annual": {
      +        "default": 0,
      +        "description": "Spread added to the Treasury yield for discounting, e.g. 0.005 when the note says 'Treasury plus 50 basis points'. Default 0 (Treasury flat). Must be less than 1.",
      +        "maximum": 1,
      +        "minimum": 0,
      +        "type": "number"
      +      },
      +      "treasury_rate_annual": {
      +        "description": "Yield on the reference Treasury (usually the one maturing closest to the loan's maturity), e.g. 0.041. Must be less than 1.",
      +        "maximum": 1,
      +        "minimum": 0,
      +        "type": "number"
      +      },
      +      "type": {
      +        "const": "yield_maintenance",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "treasury_rate_annual"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "description": "Step-down (declining percentage) premium.",
      +    "properties": {
      +      "loan_month": {
      +        "description": "Loan month (1 = first month after origination) in which the payoff occurs.",
      +        "minimum": 1,
      +        "type": "integer"
      +      },
      +      "schedule": {
      +        "description": "Step-down schedule in ascending through_month order, e.g. 5-4-3-2-1. After the last through_month the loan is open (0%).",
      +        "items": {
      +          "properties": {
      +            "pct": {
      +              "description": "Premium as a fraction of the balance, e.g. 0.05 for 5%. Must be less than 1.",
      +              "maximum": 1,
      +              "minimum": 0,
      +              "type": "number"
      +            },
      +            "through_month": {
      +              "description": "Last loan month in which this percentage applies.",
      +              "minimum": 1,
      +              "type": "integer"
      +            }
      +          },
      +          "required": [
      +            "through_month",
      +            "pct"
      +          ],
      +          "type": "object"
      +        },
      +        "maxItems": 1200,
      +        "minItems": 1,
      +        "type": "array"
      +      },
      +      "type": {
      +        "const": "step_down",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "loan_month",
      +      "schedule"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "description": "Flat percentage premium.",
      +    "properties": {
      +      "pct": {
      +        "description": "Premium as a fraction of the balance, e.g. 0.02. Must be less than 1.",
      +        "maximum": 1,
      +        "minimum": 0,
      +        "type": "number"
      +      },
      +      "type": {
      +        "const": "fixed_pct",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "pct"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "description": "Defeasance: buy securities that replicate the remaining payments.",
      +    "properties": {
      +      "costs": {
      +        "default": 0,
      +        "description": "Stated transaction costs, USD: defeasance consultant, legal, accountant, rating agency, servicer and custodian fees.",
      +        "minimum": 0,
      +        "type": "number"
      +      },
      +      "discount_convention": {
      +        "default": "monthly",
      +        "description": "Compounding convention for the discount rate. monthly (default): monthly rate = annual ÷ 12. semiannual: annual is a bond-equivalent yield, monthly rate = (1 + annual ÷ 2)^(1/6) − 1. Lenders differ; read the note.",
      +        "enum": [
      +          "monthly",
      +          "semiannual"
      +        ],
      +        "type": "string"
      +      },
      +      "replacement_yield": {
      +        "anyOf": [
      +          {
      +            "description": "One flat annual yield for all replacement securities. Must be less than 1.",
      +            "maximum": 1,
      +            "minimum": 0,
      +            "type": "number"
      +          },
      +          {
      +            "description": "Yield curve as a step function: each payment uses the first point whose months ≥ its month; beyond the last point, the last rate.",
      +            "items": {
      +              "properties": {
      +                "months": {
      +                  "description": "Months from the payoff date up to and including which this yield applies; points in ascending order.",
      +                  "minimum": 1,
      +                  "type": "integer"
      +                },
      +                "rate": {
      +                  "description": "Annual yield on replacement securities maturing at or before that month, e.g. 0.042. Must be less than 1.",
      +                  "maximum": 1,
      +                  "minimum": 0,
      +                  "type": "number"
      +                }
      +              },
      +              "required": [
      +                "months",
      +                "rate"
      +              ],
      +              "type": "object"
      +            },
      +            "maxItems": 1200,
      +            "minItems": 1,
      +            "type": "array"
      +          }
      +        ],
      +        "description": "Yield on the government securities bought to fund the remaining payments: a flat annual rate, or a list of {months, rate} points."
      +      },
      +      "type": {
      +        "const": "defeasance",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "replacement_yield"
      +    ],
      +    "type": "object"
      +  }
      +]
  2. First observed

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already establish readOnly/idempotent/non-destructive/closed-world, so the safety bar is covered; the description adds genuinely new behavior by promising determinism, a stable formula ID (calc.prepayment_and_defeasance@1), per-step output and warnings — output characteristics an agent cannot get from annotations or a schema that has no output definition. It does not, however, say what triggers warnings or which inputs are rejected.

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?

Two dense sentences with the outputs and method list front-loaded; the second sentence on determinism/formula ID/steps/warnings is compact and load-bearing. The parenthetical explanations are long but each one corresponds to a real branch of the input union rather than padding.

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 no output schema, the description does cover the return shape (premium, total payoff, cost share, step trace, warnings) and the four premium methodologies for a fairly complex nested-union tool. What remains unstated — units, ordering constraints like amortization_months ≥ remaining_term_months, and what warnings mean — is either covered by the schema or minor for correct invocation.

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 nested union members already document spread, minimum floor, discount convention and replacement yield in detail, so the schema does the heavy lifting. The description contributes only the high-level gloss 'PV of remaining payments or rate differential, with a minimum and an explicit discounting convention', which maps to but does not deepen those fields — baseline 3 is appropriate.

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?

The description names the exact outputs (premium, total payoff, cost as a share of balance) and the exact input domain (fixed-rate amortizing or interest-only loan) and enumerates the four supported regimes: yield maintenance, step-down, flat percentage, defeasance. That is a specific verb+resource, and no sibling tool (amortization, debt sizing, IRR) overlaps with a payoff/prepayment quote.

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?

Usage is implied rather than stated: the enumeration of payoff regimes signals this is the tool for pricing an early payoff, but there is no explicit when-to-use framing, no mention of prerequisites (e.g. pulling terms from the note), and no named alternative such as calc_amortization_schedule for a full schedule rather than a payoff.

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.