@markcolabs/mcp 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +9 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +52 -285
- package/dist/index.js.map +1 -1
- package/package.json +7 -12
- package/LICENSE-API.md +0 -111
- package/dist/disclaimers/ymyl.d.ts +0 -16
- package/dist/disclaimers/ymyl.d.ts.map +0 -1
- package/dist/disclaimers/ymyl.js +0 -20
- package/dist/disclaimers/ymyl.js.map +0 -1
- package/dist/engines/compoundInterest.d.ts +0 -75
- package/dist/engines/compoundInterest.d.ts.map +0 -1
- package/dist/engines/compoundInterest.js +0 -74
- package/dist/engines/compoundInterest.js.map +0 -1
- package/dist/engines/data/federalTax.d.ts +0 -47
- package/dist/engines/data/federalTax.d.ts.map +0 -1
- package/dist/engines/data/federalTax.js +0 -111
- package/dist/engines/data/federalTax.js.map +0 -1
- package/dist/engines/data/irs2026.d.ts +0 -137
- package/dist/engines/data/irs2026.d.ts.map +0 -1
- package/dist/engines/data/irs2026.js +0 -113
- package/dist/engines/data/irs2026.js.map +0 -1
- package/dist/engines/data/rmd2026.d.ts +0 -59
- package/dist/engines/data/rmd2026.d.ts.map +0 -1
- package/dist/engines/data/rmd2026.js +0 -75
- package/dist/engines/data/rmd2026.js.map +0 -1
- package/dist/engines/data/ssa.d.ts +0 -39
- package/dist/engines/data/ssa.d.ts.map +0 -1
- package/dist/engines/data/ssa.js +0 -55
- package/dist/engines/data/ssa.js.map +0 -1
- package/dist/engines/data/stateTax2026.d.ts +0 -114
- package/dist/engines/data/stateTax2026.d.ts.map +0 -1
- package/dist/engines/data/stateTax2026.js +0 -348
- package/dist/engines/data/stateTax2026.js.map +0 -1
- package/dist/engines/hsa.d.ts +0 -110
- package/dist/engines/hsa.d.ts.map +0 -1
- package/dist/engines/hsa.js +0 -83
- package/dist/engines/hsa.js.map +0 -1
- package/dist/engines/ira.d.ts +0 -115
- package/dist/engines/ira.d.ts.map +0 -1
- package/dist/engines/ira.js +0 -127
- package/dist/engines/ira.js.map +0 -1
- package/dist/engines/mortgage.d.ts +0 -70
- package/dist/engines/mortgage.d.ts.map +0 -1
- package/dist/engines/mortgage.js +0 -60
- package/dist/engines/mortgage.js.map +0 -1
- package/dist/engines/paycheck.d.ts +0 -128
- package/dist/engines/paycheck.d.ts.map +0 -1
- package/dist/engines/paycheck.js +0 -142
- package/dist/engines/paycheck.js.map +0 -1
- package/dist/engines/retirement401k.d.ts +0 -109
- package/dist/engines/retirement401k.d.ts.map +0 -1
- package/dist/engines/retirement401k.js +0 -130
- package/dist/engines/retirement401k.js.map +0 -1
- package/dist/engines/rmd.d.ts +0 -107
- package/dist/engines/rmd.d.ts.map +0 -1
- package/dist/engines/rmd.js +0 -109
- package/dist/engines/rmd.js.map +0 -1
- package/dist/engines/rothConversion.d.ts +0 -124
- package/dist/engines/rothConversion.d.ts.map +0 -1
- package/dist/engines/rothConversion.js +0 -145
- package/dist/engines/rothConversion.js.map +0 -1
- package/dist/engines/socialSecurity.d.ts +0 -63
- package/dist/engines/socialSecurity.d.ts.map +0 -1
- package/dist/engines/socialSecurity.js +0 -139
- package/dist/engines/socialSecurity.js.map +0 -1
- package/dist/envelope.d.ts +0 -76
- package/dist/envelope.d.ts.map +0 -1
- package/dist/envelope.js +0 -34
- package/dist/envelope.js.map +0 -1
- package/dist/shared/bounds.d.ts +0 -133
- package/dist/shared/bounds.d.ts.map +0 -1
- package/dist/shared/bounds.js +0 -206
- package/dist/shared/bounds.js.map +0 -1
- package/dist/tools/compoundInterest.d.ts +0 -48
- package/dist/tools/compoundInterest.d.ts.map +0 -1
- package/dist/tools/compoundInterest.js +0 -107
- package/dist/tools/compoundInterest.js.map +0 -1
- package/dist/tools/hsa.d.ts +0 -58
- package/dist/tools/hsa.d.ts.map +0 -1
- package/dist/tools/hsa.js +0 -129
- package/dist/tools/hsa.js.map +0 -1
- package/dist/tools/ira.d.ts +0 -55
- package/dist/tools/ira.d.ts.map +0 -1
- package/dist/tools/ira.js +0 -117
- package/dist/tools/ira.js.map +0 -1
- package/dist/tools/mortgage.d.ts +0 -51
- package/dist/tools/mortgage.d.ts.map +0 -1
- package/dist/tools/mortgage.js +0 -112
- package/dist/tools/mortgage.js.map +0 -1
- package/dist/tools/paycheck.d.ts +0 -61
- package/dist/tools/paycheck.d.ts.map +0 -1
- package/dist/tools/paycheck.js +0 -135
- package/dist/tools/paycheck.js.map +0 -1
- package/dist/tools/retirement401k.d.ts +0 -85
- package/dist/tools/retirement401k.d.ts.map +0 -1
- package/dist/tools/retirement401k.js +0 -141
- package/dist/tools/retirement401k.js.map +0 -1
- package/dist/tools/rmd.d.ts +0 -60
- package/dist/tools/rmd.d.ts.map +0 -1
- package/dist/tools/rmd.js +0 -130
- package/dist/tools/rmd.js.map +0 -1
- package/dist/tools/rothConversion.d.ts +0 -66
- package/dist/tools/rothConversion.d.ts.map +0 -1
- package/dist/tools/rothConversion.js +0 -141
- package/dist/tools/rothConversion.js.map +0 -1
- package/dist/tools/socialSecurity.d.ts +0 -51
- package/dist/tools/socialSecurity.d.ts.map +0 -1
- package/dist/tools/socialSecurity.js +0 -117
- package/dist/tools/socialSecurity.js.map +0 -1
- package/dist/util/zod-to-json-schema.d.ts +0 -28
- package/dist/util/zod-to-json-schema.d.ts.map +0 -1
- package/dist/util/zod-to-json-schema.js +0 -98
- package/dist/util/zod-to-json-schema.js.map +0 -1
package/dist/tools/hsa.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP tool wrapper for `dc.calculator.hsa.contributionLimit`.
|
|
3
|
-
*
|
|
4
|
-
* Per ADR-0039 § 1: tool name locked.
|
|
5
|
-
* Per ADR-0039 § 2: Zod input with bounds from shared/bounds.ts; enum for
|
|
6
|
-
* coverage tier; rate as whole-number percent.
|
|
7
|
-
* Per ADR-0039 § 3: returns ToolResult<HsaContributionLimitResult>.
|
|
8
|
-
* Per ADR-0039 § 4: errors funnel through ToolError.
|
|
9
|
-
*
|
|
10
|
-
* Scope per S141 Wave 1B: contribution-LIMIT and employer-reduction math
|
|
11
|
-
* only. Detailed federal/state/FICA tax-savings breakdown is a future tool
|
|
12
|
-
* (`dc.calculator.hsa.taxSavingsBreakdown`).
|
|
13
|
-
*/
|
|
14
|
-
import { z } from "zod";
|
|
15
|
-
import { type HsaContributionLimitResult } from "../engines/hsa.js";
|
|
16
|
-
import { type ToolResult, type ToolError } from "../envelope.js";
|
|
17
|
-
/** Locked tool name per ADR-0039 § 1. */
|
|
18
|
-
export declare const TOOL_NAME = "dc.calculator.hsa.contributionLimit";
|
|
19
|
-
/**
|
|
20
|
-
* Zod input schema. Bounds come from shared/bounds.ts. Coverage tier uses
|
|
21
|
-
* IRS-canonical names (`"self-only"` and `"family"`) per Rev. Proc. 2025-19.
|
|
22
|
-
*/
|
|
23
|
-
export declare const HsaContributionLimitInputSchema: z.ZodObject<{
|
|
24
|
-
age: z.ZodNumber;
|
|
25
|
-
coverageTier: z.ZodEnum<["self-only", "family"]>;
|
|
26
|
-
employerContribution: z.ZodOptional<z.ZodNumber>;
|
|
27
|
-
estimatedMarginalRatePercent: z.ZodOptional<z.ZodNumber>;
|
|
28
|
-
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
age: number;
|
|
30
|
-
coverageTier: "self-only" | "family";
|
|
31
|
-
employerContribution?: number | undefined;
|
|
32
|
-
estimatedMarginalRatePercent?: number | undefined;
|
|
33
|
-
}, {
|
|
34
|
-
age: number;
|
|
35
|
-
coverageTier: "self-only" | "family";
|
|
36
|
-
employerContribution?: number | undefined;
|
|
37
|
-
estimatedMarginalRatePercent?: number | undefined;
|
|
38
|
-
}>;
|
|
39
|
-
export type HsaContributionLimitToolInput = z.infer<typeof HsaContributionLimitInputSchema>;
|
|
40
|
-
/** Tool description used in mcp.tools/list. */
|
|
41
|
-
export declare const TOOL_DESCRIPTION: string;
|
|
42
|
-
/**
|
|
43
|
-
* Execute the tool. Validation + engine call wrapped in the standard envelope.
|
|
44
|
-
*
|
|
45
|
-
* Tagged-union return:
|
|
46
|
-
* { ok: true, value: ToolResult<...> }
|
|
47
|
-
* { ok: false, error: ToolError }
|
|
48
|
-
*
|
|
49
|
-
* The MCP SDK adapter at src/index.ts maps `ok=false` to `isError: true`.
|
|
50
|
-
*/
|
|
51
|
-
export declare function execute(rawInput: unknown): {
|
|
52
|
-
ok: true;
|
|
53
|
-
value: ToolResult<HsaContributionLimitResult>;
|
|
54
|
-
} | {
|
|
55
|
-
ok: false;
|
|
56
|
-
error: ToolError;
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=hsa.d.ts.map
|
package/dist/tools/hsa.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hsa.d.ts","sourceRoot":"","sources":["../../src/tools/hsa.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AAExB,yCAAyC;AACzC,eAAO,MAAM,SAAS,wCAAwC,CAAC;AAQ/D;;;GAGG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;EA8B1C,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,+BAA+B,CACvC,CAAC;AAEF,+CAA+C;AAC/C,eAAO,MAAM,gBAAgB,QAYiD,CAAC;AAE/E;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CACrB,QAAQ,EAAE,OAAO,GAEf;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC,0BAA0B,CAAC,CAAA;CAAE,GAC3D;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CA0DlC"}
|
package/dist/tools/hsa.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP tool wrapper for `dc.calculator.hsa.contributionLimit`.
|
|
3
|
-
*
|
|
4
|
-
* Per ADR-0039 § 1: tool name locked.
|
|
5
|
-
* Per ADR-0039 § 2: Zod input with bounds from shared/bounds.ts; enum for
|
|
6
|
-
* coverage tier; rate as whole-number percent.
|
|
7
|
-
* Per ADR-0039 § 3: returns ToolResult<HsaContributionLimitResult>.
|
|
8
|
-
* Per ADR-0039 § 4: errors funnel through ToolError.
|
|
9
|
-
*
|
|
10
|
-
* Scope per S141 Wave 1B: contribution-LIMIT and employer-reduction math
|
|
11
|
-
* only. Detailed federal/state/FICA tax-savings breakdown is a future tool
|
|
12
|
-
* (`dc.calculator.hsa.taxSavingsBreakdown`).
|
|
13
|
-
*/
|
|
14
|
-
import { z } from "zod";
|
|
15
|
-
import { contributionLimit, ENGINE_VERSION, } from "../engines/hsa.js";
|
|
16
|
-
import { HSA_BOUNDS, HSA_COVERAGE_TIER } from "../shared/bounds.js";
|
|
17
|
-
import { YMYL_DISCLAIMER } from "../disclaimers/ymyl.js";
|
|
18
|
-
import { makeResult, makeError, } from "../envelope.js";
|
|
19
|
-
/** Locked tool name per ADR-0039 § 1. */
|
|
20
|
-
export const TOOL_NAME = "dc.calculator.hsa.contributionLimit";
|
|
21
|
-
/** Methodology pointer — ADR-0039 § 3. */
|
|
22
|
-
const METHODOLOGY = {
|
|
23
|
-
url: "https://www.digitalcalculator.info/hsa-calculator/",
|
|
24
|
-
version: "2026-05-27",
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Zod input schema. Bounds come from shared/bounds.ts. Coverage tier uses
|
|
28
|
-
* IRS-canonical names (`"self-only"` and `"family"`) per Rev. Proc. 2025-19.
|
|
29
|
-
*/
|
|
30
|
-
export const HsaContributionLimitInputSchema = z.object({
|
|
31
|
-
age: z
|
|
32
|
-
.number()
|
|
33
|
-
.int()
|
|
34
|
-
.min(HSA_BOUNDS.MIN_AGE)
|
|
35
|
-
.max(HSA_BOUNDS.MAX_AGE)
|
|
36
|
-
.describe("Current age. Age >= 55 enables the statutory $1,000 HSA catch-up (IRC §223(b)(3)(B), not inflation-indexed)."),
|
|
37
|
-
coverageTier: z
|
|
38
|
-
.enum(HSA_COVERAGE_TIER)
|
|
39
|
-
.describe("HDHP coverage tier: 'self-only' (IRS canonical name; ≈ site spelling 'individual') or 'family'."),
|
|
40
|
-
employerContribution: z
|
|
41
|
-
.number()
|
|
42
|
-
.min(HSA_BOUNDS.MIN_EMPLOYER_CONTRIBUTION)
|
|
43
|
-
.max(HSA_BOUNDS.MAX_EMPLOYER_CONTRIBUTION)
|
|
44
|
-
.optional()
|
|
45
|
-
.describe("Optional annual employer HSA contribution, USD. Reduces the employee's eligible payroll-deduction room dollar-for-dollar because the IRS §223(b) limit is a TOTAL annual limit across all funding sources. Defaults to 0."),
|
|
46
|
-
estimatedMarginalRatePercent: z
|
|
47
|
-
.number()
|
|
48
|
-
.min(HSA_BOUNDS.MIN_MARGINAL_RATE_PERCENT)
|
|
49
|
-
.max(HSA_BOUNDS.MAX_MARGINAL_RATE_PERCENT)
|
|
50
|
-
.optional()
|
|
51
|
-
.describe("Optional estimated marginal tax rate, whole-number percent (e.g., 22 for 22%). When provided, the tool returns payrollDeductionTaxSavings = employeeMaxRemaining * (rate / 100). Treated as a combined federal+state+FICA proxy for v1; a detailed 3-component breakdown is a future tool."),
|
|
52
|
-
});
|
|
53
|
-
/** Tool description used in mcp.tools/list. */
|
|
54
|
-
export const TOOL_DESCRIPTION = "Compute the user's annual HSA contribution limit for 2026 given age, HDHP " +
|
|
55
|
-
"coverage tier (self-only or family), and optional employer contribution. " +
|
|
56
|
-
"Applies the IRS Rev. Proc. 2025-19 limits ($4,400 self-only, $8,750 family) " +
|
|
57
|
-
"plus the statutory $1,000 catch-up for age 55+ (IRC §223(b)(3)(B)). " +
|
|
58
|
-
"Employer contributions reduce the employee's eligible payroll-deduction " +
|
|
59
|
-
"room dollar-for-dollar (the IRS limit is a TOTAL annual limit across all " +
|
|
60
|
-
"sources). Optionally returns payrollDeductionTaxSavings when an estimated " +
|
|
61
|
-
"marginal tax rate is provided (combined fed+state+FICA proxy). Returns " +
|
|
62
|
-
"{ contributionLimit, catchUpEligible, catchUpAmount, totalContributionLimit, " +
|
|
63
|
-
"employerContribution, employeeMaxRemaining, payrollDeductionTaxSavings, meta }. " +
|
|
64
|
-
"SCOPE: contribution-limit math only — long-term growth projection and " +
|
|
65
|
-
"detailed federal/state/FICA tax-savings breakdown are out of scope for v1.";
|
|
66
|
-
/**
|
|
67
|
-
* Execute the tool. Validation + engine call wrapped in the standard envelope.
|
|
68
|
-
*
|
|
69
|
-
* Tagged-union return:
|
|
70
|
-
* { ok: true, value: ToolResult<...> }
|
|
71
|
-
* { ok: false, error: ToolError }
|
|
72
|
-
*
|
|
73
|
-
* The MCP SDK adapter at src/index.ts maps `ok=false` to `isError: true`.
|
|
74
|
-
*/
|
|
75
|
-
export function execute(rawInput) {
|
|
76
|
-
const parsed = HsaContributionLimitInputSchema.safeParse(rawInput);
|
|
77
|
-
if (!parsed.success) {
|
|
78
|
-
const first = parsed.error.issues[0];
|
|
79
|
-
return {
|
|
80
|
-
ok: false,
|
|
81
|
-
error: makeError({
|
|
82
|
-
code: "INPUT_VALIDATION",
|
|
83
|
-
message: first?.message ?? "Invalid input.",
|
|
84
|
-
field: first?.path.join(".") || undefined,
|
|
85
|
-
retriable: false,
|
|
86
|
-
}),
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
const input = parsed.data;
|
|
90
|
-
let payload;
|
|
91
|
-
try {
|
|
92
|
-
payload = contributionLimit(input);
|
|
93
|
-
}
|
|
94
|
-
catch (err) {
|
|
95
|
-
return {
|
|
96
|
-
ok: false,
|
|
97
|
-
error: makeError({
|
|
98
|
-
code: "INTERNAL",
|
|
99
|
-
message: "Engine error computing HSA contribution limit.",
|
|
100
|
-
retriable: false,
|
|
101
|
-
}),
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
if (!Number.isFinite(payload.contributionLimit) ||
|
|
105
|
-
!Number.isFinite(payload.catchUpAmount) ||
|
|
106
|
-
!Number.isFinite(payload.totalContributionLimit) ||
|
|
107
|
-
!Number.isFinite(payload.employerContribution) ||
|
|
108
|
-
!Number.isFinite(payload.employeeMaxRemaining) ||
|
|
109
|
-
!Number.isFinite(payload.payrollDeductionTaxSavings)) {
|
|
110
|
-
return {
|
|
111
|
-
ok: false,
|
|
112
|
-
error: makeError({
|
|
113
|
-
code: "INTERNAL",
|
|
114
|
-
message: "HSA contribution-limit engine produced a non-finite result.",
|
|
115
|
-
retriable: false,
|
|
116
|
-
}),
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
ok: true,
|
|
121
|
-
value: makeResult({
|
|
122
|
-
result: payload,
|
|
123
|
-
methodology: METHODOLOGY,
|
|
124
|
-
engineVersion: ENGINE_VERSION,
|
|
125
|
-
disclaimer: YMYL_DISCLAIMER,
|
|
126
|
-
}),
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=hsa.js.map
|
package/dist/tools/hsa.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hsa.js","sourceRoot":"","sources":["../../src/tools/hsa.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,UAAU,EACV,SAAS,GAGV,MAAM,gBAAgB,CAAC;AAExB,yCAA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AAS,CAAC;gBACf,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,6DAA6D;gBACtE,SAAS,EAAE,KAAK;aACjB,CAAC;SACH,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,KAAK,EAAE,UAAU,CAAC;YAChB,MAAM,EAAE,OAAO;YACf,WAAW,EAAE,WAAW;YACxB,aAAa,EAAE,cAAc;YAC7B,UAAU,EAAE,eAAe;SAC5B,CAAC;KACH,CAAC;AACJ,CAAC"}
|
package/dist/tools/ira.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP tool wrapper for `dc.calculator.ira.contributionLimit`.
|
|
3
|
-
*
|
|
4
|
-
* Per ADR-0039 § 1: tool name locked.
|
|
5
|
-
* Per ADR-0039 § 2: Zod input with bounds from shared/bounds.ts; enums for
|
|
6
|
-
* filing-status + IRA type; MAGI as USD.
|
|
7
|
-
* Per ADR-0039 § 3: returns ToolResult<IraContributionLimitResult>.
|
|
8
|
-
* Per ADR-0039 § 4: errors funnel through ToolError.
|
|
9
|
-
*/
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
import { type IraContributionLimitResult } from "../engines/ira.js";
|
|
12
|
-
import { type ToolResult, type ToolError } from "../envelope.js";
|
|
13
|
-
/** Locked tool name per ADR-0039 § 1. */
|
|
14
|
-
export declare const TOOL_NAME = "dc.calculator.ira.contributionLimit";
|
|
15
|
-
/**
|
|
16
|
-
* Zod input schema. Bounds come from shared/bounds.ts so engine and schema
|
|
17
|
-
* cannot drift. Filing status + IRA type are enums (z.enum is more strict
|
|
18
|
-
* than a free string).
|
|
19
|
-
*/
|
|
20
|
-
export declare const IraContributionLimitInputSchema: z.ZodObject<{
|
|
21
|
-
age: z.ZodNumber;
|
|
22
|
-
filingStatus: z.ZodEnum<["single", "marriedFilingJointly", "marriedFilingSeparately", "headOfHousehold"]>;
|
|
23
|
-
magi: z.ZodNumber;
|
|
24
|
-
type: z.ZodEnum<["traditional", "roth"]>;
|
|
25
|
-
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
type: "traditional" | "roth";
|
|
27
|
-
age: number;
|
|
28
|
-
filingStatus: "single" | "headOfHousehold" | "marriedFilingJointly" | "marriedFilingSeparately";
|
|
29
|
-
magi: number;
|
|
30
|
-
}, {
|
|
31
|
-
type: "traditional" | "roth";
|
|
32
|
-
age: number;
|
|
33
|
-
filingStatus: "single" | "headOfHousehold" | "marriedFilingJointly" | "marriedFilingSeparately";
|
|
34
|
-
magi: number;
|
|
35
|
-
}>;
|
|
36
|
-
export type IraContributionLimitToolInput = z.infer<typeof IraContributionLimitInputSchema>;
|
|
37
|
-
/** Tool description used in mcp.tools/list. */
|
|
38
|
-
export declare const TOOL_DESCRIPTION: string;
|
|
39
|
-
/**
|
|
40
|
-
* Execute the tool. Validation + engine call wrapped in the standard envelope.
|
|
41
|
-
*
|
|
42
|
-
* Tagged-union return:
|
|
43
|
-
* { ok: true, value: ToolResult<...> }
|
|
44
|
-
* { ok: false, error: ToolError }
|
|
45
|
-
*
|
|
46
|
-
* The MCP SDK adapter at src/index.ts maps `ok=false` to `isError: true`.
|
|
47
|
-
*/
|
|
48
|
-
export declare function execute(rawInput: unknown): {
|
|
49
|
-
ok: true;
|
|
50
|
-
value: ToolResult<IraContributionLimitResult>;
|
|
51
|
-
} | {
|
|
52
|
-
ok: false;
|
|
53
|
-
error: ToolError;
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=ira.d.ts.map
|
package/dist/tools/ira.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ira.d.ts","sourceRoot":"","sources":["../../src/tools/ira.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AAExB,yCAAyC;AACzC,eAAO,MAAM,SAAS,wCAAwC,CAAC;AAQ/D;;;;GAIG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;EA0B1C,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,+BAA+B,CACvC,CAAC;AAEF,+CAA+C;AAC/C,eAAO,MAAM,gBAAgB,QAQU,CAAC;AAExC;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CACrB,QAAQ,EAAE,OAAO,GAEf;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC,0BAA0B,CAAC,CAAA;CAAE,GAC3D;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAyDlC"}
|
package/dist/tools/ira.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP tool wrapper for `dc.calculator.ira.contributionLimit`.
|
|
3
|
-
*
|
|
4
|
-
* Per ADR-0039 § 1: tool name locked.
|
|
5
|
-
* Per ADR-0039 § 2: Zod input with bounds from shared/bounds.ts; enums for
|
|
6
|
-
* filing-status + IRA type; MAGI as USD.
|
|
7
|
-
* Per ADR-0039 § 3: returns ToolResult<IraContributionLimitResult>.
|
|
8
|
-
* Per ADR-0039 § 4: errors funnel through ToolError.
|
|
9
|
-
*/
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
import { contributionLimit, ENGINE_VERSION, } from "../engines/ira.js";
|
|
12
|
-
import { IRA_BOUNDS, IRA_FILING_STATUS, IRA_TYPES, } from "../shared/bounds.js";
|
|
13
|
-
import { YMYL_DISCLAIMER } from "../disclaimers/ymyl.js";
|
|
14
|
-
import { makeResult, makeError, } from "../envelope.js";
|
|
15
|
-
/** Locked tool name per ADR-0039 § 1. */
|
|
16
|
-
export const TOOL_NAME = "dc.calculator.ira.contributionLimit";
|
|
17
|
-
/** Methodology pointer — ADR-0039 § 3. */
|
|
18
|
-
const METHODOLOGY = {
|
|
19
|
-
url: "https://www.digitalcalculator.info/ira-calculator/",
|
|
20
|
-
version: "2026-05-27",
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Zod input schema. Bounds come from shared/bounds.ts so engine and schema
|
|
24
|
-
* cannot drift. Filing status + IRA type are enums (z.enum is more strict
|
|
25
|
-
* than a free string).
|
|
26
|
-
*/
|
|
27
|
-
export const IraContributionLimitInputSchema = z.object({
|
|
28
|
-
age: z
|
|
29
|
-
.number()
|
|
30
|
-
.int()
|
|
31
|
-
.min(IRA_BOUNDS.MIN_AGE)
|
|
32
|
-
.max(IRA_BOUNDS.MAX_AGE)
|
|
33
|
-
.describe("Current age. Age >= 50 enables the IRA catch-up contribution ($1,100 for 2026)."),
|
|
34
|
-
filingStatus: z
|
|
35
|
-
.enum(IRA_FILING_STATUS)
|
|
36
|
-
.describe("Federal filing status: single | marriedFilingJointly | marriedFilingSeparately | headOfHousehold."),
|
|
37
|
-
magi: z
|
|
38
|
-
.number()
|
|
39
|
-
.min(IRA_BOUNDS.MIN_MAGI)
|
|
40
|
-
.max(IRA_BOUNDS.MAX_MAGI)
|
|
41
|
-
.describe("Modified Adjusted Gross Income (MAGI), USD. Drives Roth contribution phase-out and the Traditional IRA deduction-phase-out signal."),
|
|
42
|
-
type: z
|
|
43
|
-
.enum(IRA_TYPES)
|
|
44
|
-
.describe("IRA type: 'traditional' (contribution limit is not MAGI-gated; deduction phase-out reported separately) or 'roth' (contribution itself is MAGI-phased)."),
|
|
45
|
-
});
|
|
46
|
-
/** Tool description used in mcp.tools/list. */
|
|
47
|
-
export const TOOL_DESCRIPTION = "Compute the user's eligible IRA contribution for 2026 given age, filing " +
|
|
48
|
-
"status, MAGI, and IRA type. Applies the IRS catch-up amount for age >= 50 " +
|
|
49
|
-
"and the Roth IRA MAGI phase-out per IRC §408A(c)(3). For Traditional, " +
|
|
50
|
-
"always returns the full contribution limit (Traditional contributions are " +
|
|
51
|
-
"not MAGI-gated — only the deductibility is, surfaced as " +
|
|
52
|
-
"`traditionalDeductionStatus`). Returns { eligibleContribution, " +
|
|
53
|
-
"traditionalCap, rothCap, catchUp, phaseOutReduction, catchUpEligible, " +
|
|
54
|
-
"traditionalDeductionStatus, meta }.";
|
|
55
|
-
/**
|
|
56
|
-
* Execute the tool. Validation + engine call wrapped in the standard envelope.
|
|
57
|
-
*
|
|
58
|
-
* Tagged-union return:
|
|
59
|
-
* { ok: true, value: ToolResult<...> }
|
|
60
|
-
* { ok: false, error: ToolError }
|
|
61
|
-
*
|
|
62
|
-
* The MCP SDK adapter at src/index.ts maps `ok=false` to `isError: true`.
|
|
63
|
-
*/
|
|
64
|
-
export function execute(rawInput) {
|
|
65
|
-
const parsed = IraContributionLimitInputSchema.safeParse(rawInput);
|
|
66
|
-
if (!parsed.success) {
|
|
67
|
-
const first = parsed.error.issues[0];
|
|
68
|
-
return {
|
|
69
|
-
ok: false,
|
|
70
|
-
error: makeError({
|
|
71
|
-
code: "INPUT_VALIDATION",
|
|
72
|
-
message: first?.message ?? "Invalid input.",
|
|
73
|
-
field: first?.path.join(".") || undefined,
|
|
74
|
-
retriable: false,
|
|
75
|
-
}),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
const input = parsed.data;
|
|
79
|
-
let payload;
|
|
80
|
-
try {
|
|
81
|
-
payload = contributionLimit(input);
|
|
82
|
-
}
|
|
83
|
-
catch (err) {
|
|
84
|
-
return {
|
|
85
|
-
ok: false,
|
|
86
|
-
error: makeError({
|
|
87
|
-
code: "INTERNAL",
|
|
88
|
-
message: "Engine error computing IRA contribution limit.",
|
|
89
|
-
retriable: false,
|
|
90
|
-
}),
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
if (!Number.isFinite(payload.eligibleContribution) ||
|
|
94
|
-
!Number.isFinite(payload.traditionalCap) ||
|
|
95
|
-
!Number.isFinite(payload.rothCap) ||
|
|
96
|
-
!Number.isFinite(payload.catchUp) ||
|
|
97
|
-
!Number.isFinite(payload.phaseOutReduction)) {
|
|
98
|
-
return {
|
|
99
|
-
ok: false,
|
|
100
|
-
error: makeError({
|
|
101
|
-
code: "INTERNAL",
|
|
102
|
-
message: "IRA contribution-limit engine produced a non-finite result.",
|
|
103
|
-
retriable: false,
|
|
104
|
-
}),
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
ok: true,
|
|
109
|
-
value: makeResult({
|
|
110
|
-
result: payload,
|
|
111
|
-
methodology: METHODOLOGY,
|
|
112
|
-
engineVersion: ENGINE_VERSION,
|
|
113
|
-
disclaimer: YMYL_DISCLAIMER,
|
|
114
|
-
}),
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=ira.js.map
|
package/dist/tools/ira.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ira.js","sourceRoot":"","sources":["../../src/tools/ira.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,SAAS,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,UAAU,EACV,SAAS,GAGV,MAAM,gBAAgB,CAAC;AAExB,yCAAyC;AACzC,MAAM,CAAC,MAAM,SAAS,GAAG,qCAAqC,CAAC;AAE/D,0CAA0C;AAC1C,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,oDAAoD;IACzD,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,GAAG,EAAE,CAAC;SACH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0039 § 2: Zod input schema with bounds from shared/bounds.ts.
|
|
6
|
-
* Per ADR-0039 § 3: returns ToolResult<MortgageMonthlyPaymentResult>.
|
|
7
|
-
* Per ADR-0039 § 4: failures funnel through ToolError; tools never throw.
|
|
8
|
-
*/
|
|
9
|
-
import { z } from "zod";
|
|
10
|
-
import { type MortgageMonthlyPaymentResult } from "../engines/mortgage.js";
|
|
11
|
-
import { type ToolResult, type ToolError } from "../envelope.js";
|
|
12
|
-
/** Locked tool name per ADR-0039 § 1. */
|
|
13
|
-
export declare const TOOL_NAME = "dc.calculator.mortgage.monthlyPayment";
|
|
14
|
-
/**
|
|
15
|
-
* Zod input schema. Bounds come from shared/bounds.ts so engine and schema cannot drift.
|
|
16
|
-
*/
|
|
17
|
-
export declare const MortgageMonthlyPaymentInputSchema: z.ZodObject<{
|
|
18
|
-
principal: z.ZodNumber;
|
|
19
|
-
annualRatePercent: z.ZodNumber;
|
|
20
|
-
termYears: z.ZodNumber;
|
|
21
|
-
}, "strip", z.ZodTypeAny, {
|
|
22
|
-
principal: number;
|
|
23
|
-
annualRatePercent: number;
|
|
24
|
-
termYears: number;
|
|
25
|
-
}, {
|
|
26
|
-
principal: number;
|
|
27
|
-
annualRatePercent: number;
|
|
28
|
-
termYears: number;
|
|
29
|
-
}>;
|
|
30
|
-
export type MortgageMonthlyPaymentToolInput = z.infer<typeof MortgageMonthlyPaymentInputSchema>;
|
|
31
|
-
/**
|
|
32
|
-
* Tool description used in mcp.tools/list.
|
|
33
|
-
*/
|
|
34
|
-
export declare const TOOL_DESCRIPTION: string;
|
|
35
|
-
/**
|
|
36
|
-
* Execute the tool. Validation + engine call wrapped in the standard envelope.
|
|
37
|
-
*
|
|
38
|
-
* Returns a tagged union:
|
|
39
|
-
* { ok: true, value: ToolResult<...> }
|
|
40
|
-
* { ok: false, error: ToolError }
|
|
41
|
-
*
|
|
42
|
-
* The MCP SDK adapter at src/index.ts maps `ok=false` to `isError: true`.
|
|
43
|
-
*/
|
|
44
|
-
export declare function execute(rawInput: unknown): {
|
|
45
|
-
ok: true;
|
|
46
|
-
value: ToolResult<MortgageMonthlyPaymentResult>;
|
|
47
|
-
} | {
|
|
48
|
-
ok: false;
|
|
49
|
-
error: ToolError;
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=mortgage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mortgage.d.ts","sourceRoot":"","sources":["../../src/tools/mortgage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,4BAA4B,EAClC,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AAExB,yCAAyC;AACzC,eAAO,MAAM,SAAS,0CAA0C,CAAC;AAQjE;;GAEG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;EAiB5C,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,iCAAiC,CACzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAIoB,CAAC;AAElD;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CACrB,QAAQ,EAAE,OAAO,GAEf;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC,4BAA4B,CAAC,CAAA;CAAE,GAC7D;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CA0DlC"}
|
package/dist/tools/mortgage.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP tool wrapper for `dc.calculator.mortgage.monthlyPayment`.
|
|
3
|
-
*
|
|
4
|
-
* Per ADR-0039 § 1: tool name is locked.
|
|
5
|
-
* Per ADR-0039 § 2: Zod input schema with bounds from shared/bounds.ts.
|
|
6
|
-
* Per ADR-0039 § 3: returns ToolResult<MortgageMonthlyPaymentResult>.
|
|
7
|
-
* Per ADR-0039 § 4: failures funnel through ToolError; tools never throw.
|
|
8
|
-
*/
|
|
9
|
-
import { z } from "zod";
|
|
10
|
-
import { monthlyPayment, ENGINE_VERSION, } from "../engines/mortgage.js";
|
|
11
|
-
import { MORTGAGE_BOUNDS } from "../shared/bounds.js";
|
|
12
|
-
import { YMYL_DISCLAIMER } from "../disclaimers/ymyl.js";
|
|
13
|
-
import { makeResult, makeError, } from "../envelope.js";
|
|
14
|
-
/** Locked tool name per ADR-0039 § 1. */
|
|
15
|
-
export const TOOL_NAME = "dc.calculator.mortgage.monthlyPayment";
|
|
16
|
-
/** Methodology pointer — ADR-0039 § 3 (URL is calculator HTML page until .md companion lands). */
|
|
17
|
-
const METHODOLOGY = {
|
|
18
|
-
url: "https://www.digitalcalculator.info/mortgage-calculator/",
|
|
19
|
-
version: "2026-05-09",
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Zod input schema. Bounds come from shared/bounds.ts so engine and schema cannot drift.
|
|
23
|
-
*/
|
|
24
|
-
export const MortgageMonthlyPaymentInputSchema = z.object({
|
|
25
|
-
principal: z
|
|
26
|
-
.number()
|
|
27
|
-
.min(MORTGAGE_BOUNDS.MIN_PRINCIPAL)
|
|
28
|
-
.max(MORTGAGE_BOUNDS.MAX_PRINCIPAL)
|
|
29
|
-
.describe("Loan principal in USD."),
|
|
30
|
-
annualRatePercent: z
|
|
31
|
-
.number()
|
|
32
|
-
.min(MORTGAGE_BOUNDS.MIN_RATE_PERCENT)
|
|
33
|
-
.max(MORTGAGE_BOUNDS.MAX_RATE_PERCENT)
|
|
34
|
-
.describe("Annual interest rate as whole-number percent (e.g., 6.5 for 6.5%)."),
|
|
35
|
-
termYears: z
|
|
36
|
-
.number()
|
|
37
|
-
.int()
|
|
38
|
-
.min(MORTGAGE_BOUNDS.MIN_TERM_YEARS)
|
|
39
|
-
.max(MORTGAGE_BOUNDS.MAX_TERM_YEARS)
|
|
40
|
-
.describe("Loan term in whole years."),
|
|
41
|
-
});
|
|
42
|
-
/**
|
|
43
|
-
* Tool description used in mcp.tools/list.
|
|
44
|
-
*/
|
|
45
|
-
export const TOOL_DESCRIPTION = "Compute the monthly principal & interest payment, total interest paid, and " +
|
|
46
|
-
"total amount paid over the life of a fixed-rate mortgage. Inputs are in USD; " +
|
|
47
|
-
"rate is a whole-number percent. Returns a structured payload with " +
|
|
48
|
-
"{ monthlyPayment, totalInterest, totalPaid }.";
|
|
49
|
-
/**
|
|
50
|
-
* Execute the tool. Validation + engine call wrapped in the standard envelope.
|
|
51
|
-
*
|
|
52
|
-
* Returns a tagged union:
|
|
53
|
-
* { ok: true, value: ToolResult<...> }
|
|
54
|
-
* { ok: false, error: ToolError }
|
|
55
|
-
*
|
|
56
|
-
* The MCP SDK adapter at src/index.ts maps `ok=false` to `isError: true`.
|
|
57
|
-
*/
|
|
58
|
-
export function execute(rawInput) {
|
|
59
|
-
// Validation.
|
|
60
|
-
const parsed = MortgageMonthlyPaymentInputSchema.safeParse(rawInput);
|
|
61
|
-
if (!parsed.success) {
|
|
62
|
-
const first = parsed.error.issues[0];
|
|
63
|
-
return {
|
|
64
|
-
ok: false,
|
|
65
|
-
error: makeError({
|
|
66
|
-
code: "INPUT_VALIDATION",
|
|
67
|
-
message: first?.message ?? "Invalid input.",
|
|
68
|
-
field: first?.path.join(".") || undefined,
|
|
69
|
-
retriable: false,
|
|
70
|
-
}),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
const input = parsed.data;
|
|
74
|
-
// Compute (engine is pure; wrap in try/catch defensively for INTERNAL bucket).
|
|
75
|
-
let payload;
|
|
76
|
-
try {
|
|
77
|
-
payload = monthlyPayment(input);
|
|
78
|
-
}
|
|
79
|
-
catch (err) {
|
|
80
|
-
return {
|
|
81
|
-
ok: false,
|
|
82
|
-
error: makeError({
|
|
83
|
-
code: "INTERNAL",
|
|
84
|
-
message: "Engine error computing mortgage monthly payment.",
|
|
85
|
-
retriable: false,
|
|
86
|
-
}),
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
// Sanity check: NaN or non-finite results are an internal failure.
|
|
90
|
-
if (!Number.isFinite(payload.monthlyPayment) ||
|
|
91
|
-
!Number.isFinite(payload.totalInterest) ||
|
|
92
|
-
!Number.isFinite(payload.totalPaid)) {
|
|
93
|
-
return {
|
|
94
|
-
ok: false,
|
|
95
|
-
error: makeError({
|
|
96
|
-
code: "INTERNAL",
|
|
97
|
-
message: "Mortgage engine produced a non-finite result.",
|
|
98
|
-
retriable: false,
|
|
99
|
-
}),
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
ok: true,
|
|
104
|
-
value: makeResult({
|
|
105
|
-
result: payload,
|
|
106
|
-
methodology: METHODOLOGY,
|
|
107
|
-
engineVersion: ENGINE_VERSION,
|
|
108
|
-
disclaimer: YMYL_DISCLAIMER,
|
|
109
|
-
}),
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
//# sourceMappingURL=mortgage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mortgage.js","sourceRoot":"","sources":["../../src/tools/mortgage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,cAAc,GAEf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,UAAU,EACV,SAAS,GAGV,MAAM,gBAAgB,CAAC;AAExB,yCAAyC;AACzC,MAAM,CAAC,MAAM,SAAS,GAAG,uCAAuC,CAAC;AAEjE,kGAAkG;AAClG,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,yDAAyD;IAC9D,OAAO,EAAE,YAAY;CAC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AAC;SACH,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;IAE1B,+EAA+E;IAC/E,IAAI,OAAqC,CAAC;IAC1C,IAAI,CAAC;QACH,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,SAAS,CAAC;gBACf,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,kDAAkD;gBAC3D,SAAS,EAAE,KAAK;aACjB,CAAC;SACH,CAAC;IACJ,CAAC;IAED,mEAAmE;IACnE,IACE,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC;QACxC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC;QACvC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,EACnC,CAAC;QACD,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,SAAS,CAAC;gBACf,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,+CAA+C;gBACxD,SAAS,EAAE,KAAK;aACjB,CAAC;SACH,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,KAAK,EAAE,UAAU,CAAC;YAChB,MAAM,EAAE,OAAO;YACf,WAAW,EAAE,WAAW;YACxB,aAAa,EAAE,cAAc;YAC7B,UAAU,EAAE,eAAe;SAC5B,CAAC;KACH,CAAC;AACJ,CAAC"}
|
package/dist/tools/paycheck.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP tool wrapper for `dc.calculator.paycheck.netPay`.
|
|
3
|
-
*
|
|
4
|
-
* Per ADR-0039 § 1: tool name is locked.
|
|
5
|
-
* Per ADR-0039 § 2: Zod input schema with bounds from shared/bounds.ts.
|
|
6
|
-
* Per ADR-0039 § 3: returns ToolResult<PaycheckNetPayResult>.
|
|
7
|
-
* Per ADR-0039 § 4: failures funnel through ToolError; tools never throw.
|
|
8
|
-
*
|
|
9
|
-
* v0.3.0 (S141 Item #5):
|
|
10
|
-
* - MCP-AUDIT-011 fix: state-aware tax via Tax Foundation 2026 effective
|
|
11
|
-
* rates (was flat 5%).
|
|
12
|
-
* - MCP-AUDIT-012 fix: Additional Medicare 0.9% uses FICA wages base
|
|
13
|
-
* (gross − pre-tax cafeteria-plan deductions), not raw gross.
|
|
14
|
-
*
|
|
15
|
-
* YMYL note: state withholding varies by state. v0.3.0 returns $0 for the 9
|
|
16
|
-
* no-income-tax states and an effective-rate lookup (4 income tiers, Tax
|
|
17
|
-
* Foundation source) for all other states + DC. Per-state full-bracket
|
|
18
|
-
* simulation, SDI, and local-tax piggybacks (NYC, PA municipal EIT, etc.)
|
|
19
|
-
* are NOT modeled; callers needing precision should use the full site
|
|
20
|
-
* calculator at the methodology link.
|
|
21
|
-
*/
|
|
22
|
-
import { z } from "zod";
|
|
23
|
-
import { type PaycheckNetPayResult } from "../engines/paycheck.js";
|
|
24
|
-
import { type ToolResult, type ToolError } from "../envelope.js";
|
|
25
|
-
/** Locked tool name per ADR-0039 § 1. */
|
|
26
|
-
export declare const TOOL_NAME = "dc.calculator.paycheck.netPay";
|
|
27
|
-
export declare const PaycheckNetPayInputSchema: z.ZodObject<{
|
|
28
|
-
grossAnnualSalary: z.ZodNumber;
|
|
29
|
-
payFrequency: z.ZodEnum<["quarterly" | "monthly" | "weekly" | "biweekly" | "semimonthly" | "annual", ...("quarterly" | "monthly" | "weekly" | "biweekly" | "semimonthly" | "annual")[]]>;
|
|
30
|
-
federalFilingStatus: z.ZodEnum<["single" | "married" | "marriedSeparate" | "headOfHousehold", ...("single" | "married" | "marriedSeparate" | "headOfHousehold")[]]>;
|
|
31
|
-
state: z.ZodString;
|
|
32
|
-
dependents: z.ZodDefault<z.ZodNumber>;
|
|
33
|
-
preTaxDeductionsAnnual: z.ZodNumber;
|
|
34
|
-
postTaxDeductionsAnnual: z.ZodNumber;
|
|
35
|
-
}, "strip", z.ZodTypeAny, {
|
|
36
|
-
grossAnnualSalary: number;
|
|
37
|
-
payFrequency: "quarterly" | "monthly" | "weekly" | "biweekly" | "semimonthly" | "annual";
|
|
38
|
-
federalFilingStatus: "single" | "married" | "marriedSeparate" | "headOfHousehold";
|
|
39
|
-
state: string;
|
|
40
|
-
preTaxDeductionsAnnual: number;
|
|
41
|
-
postTaxDeductionsAnnual: number;
|
|
42
|
-
dependents: number;
|
|
43
|
-
}, {
|
|
44
|
-
grossAnnualSalary: number;
|
|
45
|
-
payFrequency: "quarterly" | "monthly" | "weekly" | "biweekly" | "semimonthly" | "annual";
|
|
46
|
-
federalFilingStatus: "single" | "married" | "marriedSeparate" | "headOfHousehold";
|
|
47
|
-
state: string;
|
|
48
|
-
preTaxDeductionsAnnual: number;
|
|
49
|
-
postTaxDeductionsAnnual: number;
|
|
50
|
-
dependents?: number | undefined;
|
|
51
|
-
}>;
|
|
52
|
-
export type PaycheckNetPayToolInput = z.infer<typeof PaycheckNetPayInputSchema>;
|
|
53
|
-
export declare const TOOL_DESCRIPTION: string;
|
|
54
|
-
export declare function execute(rawInput: unknown): {
|
|
55
|
-
ok: true;
|
|
56
|
-
value: ToolResult<PaycheckNetPayResult>;
|
|
57
|
-
} | {
|
|
58
|
-
ok: false;
|
|
59
|
-
error: ToolError;
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=paycheck.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paycheck.d.ts","sourceRoot":"","sources":["../../src/tools/paycheck.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AAExB,yCAAyC;AACzC,eAAO,MAAM,SAAS,kCAAkC,CAAC;AAoBzD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;EAgDpC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAEhF,eAAO,MAAM,gBAAgB,QAS2C,CAAC;AAEzE,wBAAgB,OAAO,CACrB,QAAQ,EAAE,OAAO,GAEf;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC,oBAAoB,CAAC,CAAA;CAAE,GACrD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAuDlC"}
|