Gated government loan program router. Step 1 classifies the conforming loan limit and surfaces the target program (VA, FHA, Conventional) into the output payload. A §21.4 fork gate then routes VA loans to the VA funding fee and residual income calculator (statutory table 38 USC §3729 + VA Pamphlet 26-7 Ch.4 residual income by region/family size). All other programs route to the FHA MIP eligibility and cost calculator (HUD Handbook 4000.1 UFMIP 1.75% + annual MIP grid from ML 2023-05). Both branches are reachable; the gate is a total function with mandatory default.
loan_program (VA / FHA / Conventional / USDA) from input into the output payload. The §21.4 gate reads /loan_program to route: VA to the VA benefit calculator, all others to FHA MIP calculation.check_conforming_loan_limit{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "check_conforming_loan_limit",
"arguments": {
"loan_amount": 420000,
"units": 1,
"state": "TX",
"loan_program": "VA"
}
},
"id": 1
}
compute_va_funding_fee_residual{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "compute_va_funding_fee_residual",
"arguments": {
"base_loan_amount": 420000,
"down_payment_pct": 5.0,
"loan_purpose": "purchase",
"va_use_type": "first",
"funding_fee_exempt": false,
"family_size": 3,
"state": "TX",
"dti_pct": 38.0,
"gross_monthly_income": 8500,
"monthly_shelter_expenses": 2200
}
},
"id": 2
}
compute_fha_mip_eligibility{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "compute_fha_mip_eligibility",
"arguments": {
"base_loan_amount": 420000,
"ltv_pct": 96.5,
"term_years": 30,
"fico_score": 640,
"front_end_dti_pct": 28.5,
"back_end_dti_pct": 41.0,
"loan_purpose": "purchase"
}
},
"id": 2
}