depreciation_straight_line
Calculate straight-line depreciation schedules for assets by entering cost, salvage value, and useful life to determine annual depreciation expense.
Instructions
Calculate straight-line depreciation schedule
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cost | Yes | ||
| salvageValue | Yes | ||
| usefulLife | Yes | Useful life in years |
Implementation Reference
- src/tools/financial-tools.ts:188-215 (registration)Registration of the 'depreciation_straight_line' tool, including input schema, description, and handler function that calls the Python implementation via pythonBridge.{ name: "depreciation_straight_line", description: "Calculate straight-line depreciation schedule", inputSchema: { type: "object", properties: { cost: { type: "number" }, salvageValue: { type: "number" }, usefulLife: { type: "number", description: "Useful life in years" } }, required: ["cost", "salvageValue", "usefulLife"] }, handler: async (args: any): Promise<ToolResult> => { try { const result = await pythonBridge.callPythonFunction({ module: 'financial_calculations', function: 'DepreciationCalculator.straight_line', args: [args.cost, args.salvageValue, args.usefulLife] }); return result; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },
- Core implementation of straight-line depreciation calculation in Python's DepreciationCalculator class, computing annual depreciation and returning schedule as a list.def straight_line(cost: float, salvage_value: float, useful_life: int) -> List[float]: """Calculate straight-line depreciation""" annual_depreciation = (cost - salvage_value) / useful_life return [annual_depreciation] * useful_life
- src/tools/financial-tools.ts:191-199 (schema)Input schema defining parameters for the tool: cost, salvageValue, usefulLife.inputSchema: { type: "object", properties: { cost: { type: "number" }, salvageValue: { type: "number" }, usefulLife: { type: "number", description: "Useful life in years" } }, required: ["cost", "salvageValue", "usefulLife"] },