업종 간 내용연수·상각 비교
compare_industry_lifeCompare standard useful lives and cumulative depreciation for the same asset across industries. Input asset type, cost, and industry codes to see year 1 and year 5 depreciation differences.
Instructions
동일 자산·취득가에 대해 업종별 표준 내용연수 및 1년차·5년 누적 상각(비교용)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| asset_type | Yes | ||
| cost | Yes | ||
| industry_codes | Yes | ||
| method | No |
Implementation Reference
- src/utils/compareIndustry.ts:21-63 (handler)Core handler function that compares useful life and depreciation across industries. Iterates over industry_codes, resolves useful life via resolveUsefulLife, computes depreciation schedule via calcDepreciationSchedule, and returns 1st-year and 5-year cumulative depreciation for each industry.
export function compareIndustryLifeCore(input: { asset_type: AssetType; cost: number; industry_codes: KsicCode[]; method?: DepreciationMethod; }): IndustryComparisonOutput { const { asset_type, cost, industry_codes, method } = input; if (industry_codes.length === 0) { throw new Error("industry_codes에 최소 1개 업종코드가 필요합니다."); } const comparison: IndustryComparisonOutput["comparison"] = []; for (const industry_code of industry_codes) { const resolved = resolveUsefulLife({ asset_type, industry_code }); let m: DepreciationMethod = method ?? resolved.default_method; if (m === "declining" && getDecliningRate(resolved.standard_life) == null) { m = "straight"; } const schedule = calcDepreciationSchedule({ asset_name: "comparison", cost, acquired_date: "2026-01-01", method: m, useful_life_years: resolved.standard_life, }); const y1 = schedule.annual_schedule.find((r) => r.year === 2026)?.depreciation ?? 0; let total5 = 0; for (let y = 2026; y <= 2030; y++) { total5 += schedule.annual_schedule.find((r) => r.year === y)?.depreciation ?? 0; } comparison.push({ industry_code, industry_name: KSIC_NAMES[industry_code] ?? industry_code, useful_life: resolved.standard_life, method: m, annual_depreciation_yr1: Math.round(y1 * 1e6) / 1e6, total_5yr_depreciation: Math.round(total5 * 1e6) / 1e6, applicable_table: resolved.applicable_table, }); } return { asset_type, cost, comparison }; } - src/utils/compareIndustry.ts:7-19 (schema)Output type definition IndustryComparisonOutput: includes asset_type, cost, and an array of per-industry comparison items (industry_code, industry_name, useful_life, method, annual_depreciation_yr1, total_5yr_depreciation, applicable_table).
export interface IndustryComparisonOutput { asset_type: AssetType; cost: number; comparison: { industry_code: KsicCode; industry_name: string; useful_life: number; method: DepreciationMethod; annual_depreciation_yr1: number; total_5yr_depreciation: number; applicable_table: "annex5" | "annex6"; }[]; } - src/index.ts:245-274 (registration)Registers the 'compare_industry_life' tool on the McpServer with inputSchema (asset_type, cost, industry_codes, optional method) and a handler that validates codes then delegates to compareIndustryLifeCore.
server.registerTool( "compare_industry_life", { title: "업종 간 내용연수·상각 비교", description: "동일 자산·취득가에 대해 업종별 표준 내용연수 및 1년차·5년 누적 상각(비교용)", inputSchema: { asset_type: z.enum(ASSET_ENUM), cost: z.number(), industry_codes: z.array(z.string()).min(1), method: z.enum(METHOD_ENUM).optional(), }, }, async (input) => { try { const codes = input.industry_codes.filter(isKsicCode); if (codes.length !== input.industry_codes.length) { return toolError(`industry_codes 검증 실패. 사용 가능: ${listKsicCodes().join(", ")}`); } const out = compareIndustryLifeCore({ asset_type: input.asset_type as AssetType, cost: input.cost, industry_codes: codes, method: input.method as DepreciationMethod | undefined, }); return { content: [{ type: "text", text: jsonText(out) }] }; } catch (e) { return toolError(e instanceof Error ? e.message : String(e)); } }, ); - src/index.ts:250-255 (schema)Input schema definition for the tool using Zod: asset_type (enum), cost (number), industry_codes (array of strings, min 1), optional method (enum).
inputSchema: { asset_type: z.enum(ASSET_ENUM), cost: z.number(), industry_codes: z.array(z.string()).min(1), method: z.enum(METHOD_ENUM).optional(), }, - src/utils/compareIndustry.ts:1-20 (helper)Imports used by compareIndustryLifeCore: resolveUsefulLife, calcDepreciationSchedule, types, KSIC_NAMES mapping, and getDecliningRate.
import { resolveUsefulLife } from "./resolveUsefulLife.js"; import { calcDepreciationSchedule } from "./schedule.js"; import type { AssetType, DepreciationMethod, KsicCode } from "../types/index.js"; import { KSIC_NAMES } from "../data/ksicMapping.js"; import { getDecliningRate } from "../data/decliningRates.js"; export interface IndustryComparisonOutput { asset_type: AssetType; cost: number; comparison: { industry_code: KsicCode; industry_name: string; useful_life: number; method: DepreciationMethod; annual_depreciation_yr1: number; total_5yr_depreciation: number; applicable_table: "annex5" | "annex6"; }[]; }