Skip to main content
Glama

calculate_self_employment_tax

Calculate Social Security and Medicare taxes for self-employed individuals based on net earnings to determine tax obligations.

Instructions

Calculate self-employment tax (Social Security and Medicare)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
netEarningsYesNet earnings from self-employment

Implementation Reference

  • Core implementation of the self-employment tax calculation in the TaxCalculator class, handling Social Security (12.4% up to wage base), Medicare (2.9%), and additional Medicare (0.9% over threshold), with 92.35% SE earnings adjustment and 50% deductibility.
    def calculate_self_employment_tax(self, net_earnings: float) -> Dict[str, float]: """Calculate self-employment tax (Social Security and Medicare)""" if net_earnings <= 0: return {'se_tax': 0, 'social_security': 0, 'medicare': 0} # 2024 rates and limits ss_wage_base = 160200 # Social Security wage base ss_rate = 0.124 # 12.4% medicare_rate = 0.029 # 2.9% additional_medicare_rate = 0.009 # Additional 0.9% on high earners additional_medicare_threshold = 200000 # Calculate SE earnings (92.35% of net earnings) se_earnings = net_earnings * 0.9235 # Social Security tax ss_taxable = min(se_earnings, ss_wage_base) ss_tax = ss_taxable * ss_rate # Medicare tax medicare_tax = se_earnings * medicare_rate # Additional Medicare tax additional_medicare = 0 if se_earnings > additional_medicare_threshold: additional_medicare = (se_earnings - additional_medicare_threshold) * additional_medicare_rate total_se_tax = ss_tax + medicare_tax + additional_medicare return { 'se_earnings': round(se_earnings, 2), 'social_security_tax': round(ss_tax, 2), 'medicare_tax': round(medicare_tax, 2), 'additional_medicare_tax': round(additional_medicare, 2), 'total_se_tax': round(total_se_tax, 2), 'deductible_portion': round(total_se_tax * 0.5, 2) # 50% deductible }
  • Registers the MCP tool 'calculate_self_employment_tax' in the taxTools array, including input schema for netEarnings, description, and a handler that invokes the Python TaxCalculator.calculate_self_employment_tax via PythonBridge.
    { name: "calculate_self_employment_tax", description: "Calculate self-employment tax (Social Security and Medicare)", inputSchema: { type: "object", properties: { netEarnings: { type: "number", description: "Net earnings from self-employment" } }, required: ["netEarnings"] }, handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'tax_calculations', function: 'TaxCalculator.calculate_self_employment_tax', args: [args.netEarnings] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },
  • Input schema defining the required 'netEarnings' parameter as a number for the calculate_self_employment_tax tool.
    inputSchema: { type: "object", properties: { netEarnings: { type: "number", description: "Net earnings from self-employment" } }, required: ["netEarnings"] },
  • TypeScript handler function for the tool that proxies the call to the Python implementation via pythonBridge, handling errors and returning ToolResult.
    handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'tax_calculations', function: 'TaxCalculator.calculate_self_employment_tax', args: [args.netEarnings] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }

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