Skip to main content
Glama

calculate_state_taxes

Calculate state income tax amounts for California, New York, Texas, and Florida based on taxable income and filing status.

Instructions

Calculate state income tax for supported states

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filingStatusNosingle
stateYesState abbreviation
taxableIncomeYes

Implementation Reference

  • Core handler function that implements the state tax calculation logic using predefined progressive tax brackets for supported states (CA, NY, TX, FL). Called by the TypeScript wrapper.
    def calculate_state_taxes(self, state: str, taxable_income: float, filing_status: str = 'single') -> Dict: """Calculate state income tax (simplified)""" # This would need to be expanded for all states state_rates = { 'CA': { 'single': [(10099, 0.01), (23942, 0.02), (37788, 0.04), (52455, 0.06), (66295, 0.08), (338639, 0.093), (406364, 0.103), (677278, 0.113), (float('inf'), 0.123)], 'married_filing_jointly': [(20198, 0.01), (47884, 0.02), (75576, 0.04), (104910, 0.06), (132590, 0.08), (677278, 0.093), (812728, 0.103), (1354556, 0.113), (float('inf'), 0.123)] }, 'NY': { 'single': [(8500, 0.04), (11700, 0.045), (13900, 0.0525), (21400, 0.059), (80650, 0.0645), (215400, 0.0665), (1077550, 0.0685), (float('inf'), 0.0882)], 'married_filing_jointly': [(17150, 0.04), (23600, 0.045), (27900, 0.0525), (43000, 0.059), (161550, 0.0645), (323200, 0.0665), (2155350, 0.0685), (float('inf'), 0.0882)] }, 'TX': { 'single': [(float('inf'), 0.0)], # No state income tax 'married_filing_jointly': [(float('inf'), 0.0)] }, 'FL': { 'single': [(float('inf'), 0.0)], # No state income tax 'married_filing_jointly': [(float('inf'), 0.0)] } } if state not in state_rates: return {'error': f'State {state} tax rates not available'} brackets = state_rates[state].get(filing_status, state_rates[state]['single']) tax_owed = 0 remaining_income = taxable_income prev_threshold = 0 for threshold, rate in brackets: if remaining_income <= 0: break taxable_at_rate = min(remaining_income, threshold - prev_threshold) tax_owed += taxable_at_rate * rate remaining_income -= taxable_at_rate prev_threshold = threshold return { 'state': state, 'taxable_income': taxable_income, 'state_tax': round(tax_owed, 2), 'effective_rate': round(tax_owed / taxable_income * 100, 2) if taxable_income > 0 else 0 }
  • Input schema defining parameters: state (enum: CA, NY, TX, FL), taxableIncome (required), filingStatus (default: single).
    inputSchema: { type: "object", properties: { state: { type: "string", enum: ["CA", "NY", "TX", "FL"], description: "State abbreviation" }, taxableIncome: { type: "number" }, filingStatus: { type: "string", enum: ["single", "married_filing_jointly"], default: "single" } }, required: ["state", "taxableIncome"] },
  • Tool registration in taxTools array, including name, description, schema, and handler that proxies to Python TaxCalculator.calculate_state_taxes via pythonBridge.
    { name: "calculate_state_taxes", description: "Calculate state income tax for supported states", inputSchema: { type: "object", properties: { state: { type: "string", enum: ["CA", "NY", "TX", "FL"], description: "State abbreviation" }, taxableIncome: { type: "number" }, filingStatus: { type: "string", enum: ["single", "married_filing_jointly"], default: "single" } }, required: ["state", "taxableIncome"] }, handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'tax_calculations', function: 'TaxCalculator.calculate_state_taxes', args: [args.state, args.taxableIncome, args.filingStatus || 'single'] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },
  • src/index.ts:32-44 (registration)
    Main tool registry where taxTools (including calculate_state_taxes) is spread into allTools array, used for MCP server tool listing and calling.
    const allTools = [ ...excelTools, ...financialTools, ...rentalTools, ...expenseTools, ...reportingTools, ...cashFlowTools, ...taxTools, ...analyticsTools, ...chartTools, ...complianceTools, ...propertyTools, ];

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/jeremycharlesgillespie/excel-mcp'

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