Skip to main content
Glama
dma9527

irs-taxpayer-mcp

by dma9527

analyze_mortgage_tax_benefit

Calculate whether itemizing mortgage interest and property taxes yields greater tax savings than taking the standard deduction.

Instructions

Analyze the tax benefit of mortgage interest deduction and property taxes. Compares itemizing with mortgage vs taking the standard deduction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taxYearYesTax year
filingStatusYes
grossIncomeYes
mortgageInterestYesAnnual mortgage interest paid
propertyTaxesYesAnnual property taxes paid
stateIncomeTaxesNoState/local income taxes paid
otherItemizedNoOther itemized deductions (charity, medical, etc.)
mortgageBalanceNoCurrent mortgage balance
interestRateNoMortgage interest rate (e.g., 0.065 for 6.5%)

Implementation Reference

  • Main handler function for analyze_mortgage_tax_benefit tool. Calculates tax benefit of mortgage interest deduction and property taxes, compares itemizing vs standard deduction, and provides recommendations based on SALT cap and tax savings.
    async (params) => {
      const stateIncome = params.stateIncomeTaxes ?? 0;
      const saltTotal = stateIncome + params.propertyTaxes;
      const saltCapAmount = getSaltCap(params.taxYear, params.filingStatus, params.grossIncome);
      const saltCapped = Math.min(saltTotal, saltCapAmount);
      const otherItemized = params.otherItemized ?? 0;
      const totalItemized = params.mortgageInterest + saltCapped + otherItemized;
    
      // With itemizing
      const withItemized = calculateTax({
        taxYear: params.taxYear,
        filingStatus: params.filingStatus,
        grossIncome: params.grossIncome,
        itemizedDeductions: totalItemized,
      });
    
      // With standard deduction
      const withStandard = calculateTax({
        taxYear: params.taxYear,
        filingStatus: params.filingStatus,
        grossIncome: params.grossIncome,
      });
    
      const savings = withStandard.totalFederalTax - withItemized.totalFederalTax;
      const recommendation = savings > 0 ? "itemize" : "standard";
    
      const lines = [
        `## Mortgage Tax Benefit Analysis — TY${params.taxYear}`,
        "",
        `### Itemized Deduction Breakdown`,
        `| Deduction | Amount | Notes |`,
        `|-----------|--------|-------|`,
        `| Mortgage Interest | $${fmt(params.mortgageInterest)} | On up to $750K debt |`,
        `| Property Taxes | $${fmt(params.propertyTaxes)} | Part of SALT |`,
        stateIncome > 0 ? `| State Income Taxes | $${fmt(stateIncome)} | Part of SALT |` : "",
        `| SALT (capped) | $${fmt(saltCapped)} | cap: $${fmt(saltCapAmount)} |`,
        saltTotal > saltCapped ? `| SALT lost to cap | $${fmt(saltTotal - saltCapped)} | Not deductible |` : "",
        otherItemized > 0 ? `| Other Itemized | $${fmt(otherItemized)} | |` : "",
        `| **Total Itemized** | **$${fmt(totalItemized)}** | |`,
        "",
        `### Comparison`,
        `| Scenario | Deduction | Federal Tax | Effective Rate |`,
        `|----------|-----------|-------------|---------------|`,
        `| Standard | $${fmt(withStandard.deductionAmount)} | $${fmt(withStandard.totalFederalTax)} | ${(withStandard.effectiveRate * 100).toFixed(2)}% |`,
        `| Itemized | $${fmt(totalItemized)} | $${fmt(withItemized.totalFederalTax)} | ${(withItemized.effectiveRate * 100).toFixed(2)}% |`,
        "",
        savings > 0
          ? `💡 **Recommendation**: Itemize — saves $${fmt(savings)}/year over standard deduction.`
          : `💡 **Recommendation**: Take the standard deduction — it's $${fmt(Math.abs(savings))} better than itemizing.`,
      ];
    
      if (params.mortgageBalance && params.interestRate) {
        const monthlyPayment = (params.mortgageBalance * (params.interestRate / 12)) /
          (1 - Math.pow(1 + params.interestRate / 12, -360));
        lines.push(
          "",
          `### Mortgage Info`,
          `| Detail | Value |`,
          `|--------|-------|`,
          `| Balance | $${fmt(params.mortgageBalance)} |`,
          `| Rate | ${(params.interestRate * 100).toFixed(2)}% |`,
          `| Est. Monthly Payment (30yr) | $${fmt(Math.round(monthlyPayment))} |`,
        );
      }
    
      lines.push(
        "",
        `> ⚠️ Simplified analysis. Does not account for AMT or state-specific rules.`,
      );
    
      return { content: [{ type: "text", text: lines.filter(Boolean).join("\n") }] };
    }
  • Tool registration using server.tool() with name 'analyze_mortgage_tax_benefit', description, Zod schema definition, and async handler function.
    server.tool(
      "analyze_mortgage_tax_benefit",
      "Analyze the tax benefit of mortgage interest deduction and property taxes. " +
      "Compares itemizing with mortgage vs taking the standard deduction.",
      {
        taxYear: z.number().describe("Tax year"),
        filingStatus: FilingStatusEnum,
        grossIncome: z.number().min(0),
        mortgageInterest: z.number().min(0).describe("Annual mortgage interest paid"),
        propertyTaxes: z.number().min(0).describe("Annual property taxes paid"),
        stateIncomeTaxes: z.number().min(0).optional().describe("State/local income taxes paid"),
        otherItemized: z.number().min(0).optional().describe("Other itemized deductions (charity, medical, etc.)"),
        mortgageBalance: z.number().min(0).optional().describe("Current mortgage balance"),
        interestRate: z.number().min(0).optional().describe("Mortgage interest rate (e.g., 0.065 for 6.5%)"),
      },
      async (params) => {
        const stateIncome = params.stateIncomeTaxes ?? 0;
        const saltTotal = stateIncome + params.propertyTaxes;
        const saltCapAmount = getSaltCap(params.taxYear, params.filingStatus, params.grossIncome);
        const saltCapped = Math.min(saltTotal, saltCapAmount);
        const otherItemized = params.otherItemized ?? 0;
        const totalItemized = params.mortgageInterest + saltCapped + otherItemized;
    
        // With itemizing
        const withItemized = calculateTax({
          taxYear: params.taxYear,
          filingStatus: params.filingStatus,
          grossIncome: params.grossIncome,
          itemizedDeductions: totalItemized,
        });
    
        // With standard deduction
        const withStandard = calculateTax({
          taxYear: params.taxYear,
          filingStatus: params.filingStatus,
          grossIncome: params.grossIncome,
        });
    
        const savings = withStandard.totalFederalTax - withItemized.totalFederalTax;
        const recommendation = savings > 0 ? "itemize" : "standard";
    
        const lines = [
          `## Mortgage Tax Benefit Analysis — TY${params.taxYear}`,
          "",
          `### Itemized Deduction Breakdown`,
          `| Deduction | Amount | Notes |`,
          `|-----------|--------|-------|`,
          `| Mortgage Interest | $${fmt(params.mortgageInterest)} | On up to $750K debt |`,
          `| Property Taxes | $${fmt(params.propertyTaxes)} | Part of SALT |`,
          stateIncome > 0 ? `| State Income Taxes | $${fmt(stateIncome)} | Part of SALT |` : "",
          `| SALT (capped) | $${fmt(saltCapped)} | cap: $${fmt(saltCapAmount)} |`,
          saltTotal > saltCapped ? `| SALT lost to cap | $${fmt(saltTotal - saltCapped)} | Not deductible |` : "",
          otherItemized > 0 ? `| Other Itemized | $${fmt(otherItemized)} | |` : "",
          `| **Total Itemized** | **$${fmt(totalItemized)}** | |`,
          "",
          `### Comparison`,
          `| Scenario | Deduction | Federal Tax | Effective Rate |`,
          `|----------|-----------|-------------|---------------|`,
          `| Standard | $${fmt(withStandard.deductionAmount)} | $${fmt(withStandard.totalFederalTax)} | ${(withStandard.effectiveRate * 100).toFixed(2)}% |`,
          `| Itemized | $${fmt(totalItemized)} | $${fmt(withItemized.totalFederalTax)} | ${(withItemized.effectiveRate * 100).toFixed(2)}% |`,
          "",
          savings > 0
            ? `💡 **Recommendation**: Itemize — saves $${fmt(savings)}/year over standard deduction.`
            : `💡 **Recommendation**: Take the standard deduction — it's $${fmt(Math.abs(savings))} better than itemizing.`,
        ];
    
        if (params.mortgageBalance && params.interestRate) {
          const monthlyPayment = (params.mortgageBalance * (params.interestRate / 12)) /
            (1 - Math.pow(1 + params.interestRate / 12, -360));
          lines.push(
            "",
            `### Mortgage Info`,
            `| Detail | Value |`,
            `|--------|-------|`,
            `| Balance | $${fmt(params.mortgageBalance)} |`,
            `| Rate | ${(params.interestRate * 100).toFixed(2)}% |`,
            `| Est. Monthly Payment (30yr) | $${fmt(Math.round(monthlyPayment))} |`,
          );
        }
    
        lines.push(
          "",
          `> ⚠️ Simplified analysis. Does not account for AMT or state-specific rules.`,
        );
    
        return { content: [{ type: "text", text: lines.filter(Boolean).join("\n") }] };
      }
    );
  • Zod input schema defining parameters for the mortgage tax benefit analysis tool including taxYear, filingStatus, grossIncome, mortgageInterest, propertyTaxes, stateIncomeTaxes, otherItemized, mortgageBalance, and interestRate.
    {
      taxYear: z.number().describe("Tax year"),
      filingStatus: FilingStatusEnum,
      grossIncome: z.number().min(0),
      mortgageInterest: z.number().min(0).describe("Annual mortgage interest paid"),
      propertyTaxes: z.number().min(0).describe("Annual property taxes paid"),
      stateIncomeTaxes: z.number().min(0).optional().describe("State/local income taxes paid"),
      otherItemized: z.number().min(0).optional().describe("Other itemized deductions (charity, medical, etc.)"),
      mortgageBalance: z.number().min(0).optional().describe("Current mortgage balance"),
      interestRate: z.number().min(0).optional().describe("Mortgage interest rate (e.g., 0.065 for 6.5%)"),
    },
  • getSaltCap helper function that calculates the effective SALT deduction cap based on tax year, filing status, and AGI. Used by the mortgage tax benefit analyzer to cap state and local tax deductions.
    export function getSaltCap(
      taxYear: number,
      filingStatus: FilingStatus,
      agi: number
    ): number {
      const data = TAX_DATA[taxYear];
      if (!data) return 10000;
    
      const cap = data.saltCap;
      if (filingStatus === "married_filing_separately") return cap.mfs;
    
      if (cap.enhancedCap && cap.enhancedAgiThreshold) {
        if (agi <= cap.enhancedAgiThreshold) return cap.enhancedCap;
        // Phase down: for every $1K over threshold, reduce by $1K (simplified)
        const excess = agi - cap.enhancedAgiThreshold;
        const reduction = Math.min(excess, cap.enhancedCap - cap.base);
        return Math.max(cap.base, cap.enhancedCap - reduction);
      }
    
      return cap.base;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe how it behaves: no information about computational approach, assumptions made, accuracy limitations, whether it's a simulation or calculation, what the output format might be, or error conditions. For a complex tax analysis tool with 9 parameters, this is a significant gap.

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?

The description is appropriately concise at two sentences. The first sentence establishes the core purpose, and the second adds important comparative context. There's no wasted language, though it could be slightly more front-loaded by mentioning the comparison aspect earlier.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tax analysis tool with 9 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the analysis produces (comparison results, recommendations, numerical outputs), how the comparison is presented, what assumptions are made about tax laws, or how state/local taxes factor in. The description alone is insufficient for an agent to understand what to expect from invoking this tool.

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 78% (7 of 9 parameters have descriptions), so the baseline is 3. The description adds minimal value beyond the schema: it mentions mortgage interest deduction and property taxes (which map to two parameters) but doesn't explain relationships between parameters (e.g., how mortgageBalance and interestRate relate to mortgageInterest) or provide context about how these inputs drive the comparison analysis.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: analyzing tax benefits of mortgage interest deduction and property taxes, with a comparison between itemizing and standard deduction. It uses specific verbs ('analyze', 'compares') and identifies the resources (mortgage interest, property taxes). However, it doesn't explicitly differentiate from sibling tools like 'standard_vs_itemized' or 'compare_filing_statuses' which might have overlapping functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'standard_vs_itemized' (which appears to cover similar ground) or 'calculate_federal_tax' (which might incorporate this analysis). There's no indication of prerequisites, limitations, or appropriate contexts for use beyond the basic function stated.

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

Install Server

Other Tools

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/dma9527/irs-taxpayer-mcp'

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