business_deductions_analysis
Analyze business expenses to determine allowable tax deductions based on entity type, helping identify eligible write-offs for accurate tax filing.
Instructions
Analyze allowable business deductions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entityType | Yes | ||
| expenses | Yes |
Implementation Reference
- src/tools/tax-tools.ts:192-231 (registration)Registration of the 'business_deductions_analysis' tool in the taxTools array, including schema and proxy handler that calls Python.{ name: "business_deductions_analysis", description: "Analyze allowable business deductions", inputSchema: { type: "object", properties: { expenses: { type: "array", items: { type: "object", properties: { category: { type: "string" }, amount: { type: "number" }, description: { type: "string" } } } }, entityType: { type: "string", enum: ["Sole Proprietorship", "Partnership", "S Corporation", "C Corporation", "LLC"] } }, required: ["expenses", "entityType"] }, handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'tax_calculations', function: 'TaxCalculator.calculate_business_deductions', args: [args.expenses, args.entityType] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },
- src/python/tax_calculations.py:212-254 (handler)Core handler function in Python that executes the business deductions analysis, categorizing expenses, applying limits (e.g., 50% for meals), and returning deductible totals.def calculate_business_deductions(self, expenses: List[Dict], entity_type: TaxEntityType) -> Dict: """Calculate allowable business deductions""" deductible_expenses = {} non_deductible = [] # Categorize expenses and apply limits for expense in expenses: category = expense.get('category', '') amount = expense.get('amount', 0) description = expense.get('description', '') if category in ['Meals & Entertainment']: # 50% limit on meals deductible_amount = amount * 0.5 deductible_expenses[category] = deductible_expenses.get(category, 0) + deductible_amount non_deductible.append({ 'expense': description, 'total': amount, 'deductible': deductible_amount, 'reason': '50% limit on business meals' }) elif category in ['Travel']: # Check for personal vs business travel deductible_expenses[category] = deductible_expenses.get(category, 0) + amount elif category in ['Home Office']: # Simplified home office deduction if entity_type == TaxEntityType.SOLE_PROPRIETORSHIP: # Can use simplified method or actual expense method deductible_expenses[category] = deductible_expenses.get(category, 0) + amount else: # Different rules for other entities deductible_expenses[category] = deductible_expenses.get(category, 0) + amount else: deductible_expenses[category] = deductible_expenses.get(category, 0) + amount total_deductions = sum(deductible_expenses.values()) return { 'deductible_expenses': deductible_expenses, 'total_deductions': round(total_deductions, 2), 'non_deductible_items': non_deductible, 'entity_type': entity_type.value }
- src/index.ts:32-44 (registration)Main registration where taxTools (containing business_deductions_analysis) is spread into the allTools array used by the MCP server for tool listing and execution.const allTools = [ ...excelTools, ...financialTools, ...rentalTools, ...expenseTools, ...reportingTools, ...cashFlowTools, ...taxTools, ...analyticsTools, ...chartTools, ...complianceTools, ...propertyTools, ];
- src/tools/tax-tools.ts:195-215 (schema)Input schema defining the structure for expenses (array of category, amount, description) and entityType enum.inputSchema: { type: "object", properties: { expenses: { type: "array", items: { type: "object", properties: { category: { type: "string" }, amount: { type: "number" }, description: { type: "string" } } } }, entityType: { type: "string", enum: ["Sole Proprietorship", "Partnership", "S Corporation", "C Corporation", "LLC"] } }, required: ["expenses", "entityType"] },