@markcolabs/mcp 0.1.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/README.md +263 -0
- package/dist/disclaimers/ymyl.d.ts +16 -0
- package/dist/disclaimers/ymyl.d.ts.map +1 -0
- package/dist/disclaimers/ymyl.js +20 -0
- package/dist/disclaimers/ymyl.js.map +1 -0
- package/dist/engines/compoundInterest.d.ts +73 -0
- package/dist/engines/compoundInterest.d.ts.map +1 -0
- package/dist/engines/compoundInterest.js +72 -0
- package/dist/engines/compoundInterest.js.map +1 -0
- package/dist/engines/data/federalTax.d.ts +47 -0
- package/dist/engines/data/federalTax.d.ts.map +1 -0
- package/dist/engines/data/federalTax.js +111 -0
- package/dist/engines/data/federalTax.js.map +1 -0
- package/dist/engines/data/irs2026.d.ts +30 -0
- package/dist/engines/data/irs2026.d.ts.map +1 -0
- package/dist/engines/data/irs2026.js +30 -0
- package/dist/engines/data/irs2026.js.map +1 -0
- package/dist/engines/data/ssa.d.ts +39 -0
- package/dist/engines/data/ssa.d.ts.map +1 -0
- package/dist/engines/data/ssa.js +55 -0
- package/dist/engines/data/ssa.js.map +1 -0
- package/dist/engines/mortgage.d.ts +69 -0
- package/dist/engines/mortgage.d.ts.map +1 -0
- package/dist/engines/mortgage.js +59 -0
- package/dist/engines/mortgage.js.map +1 -0
- package/dist/engines/paycheck.d.ts +89 -0
- package/dist/engines/paycheck.d.ts.map +1 -0
- package/dist/engines/paycheck.js +109 -0
- package/dist/engines/paycheck.js.map +1 -0
- package/dist/engines/retirement401k.d.ts +105 -0
- package/dist/engines/retirement401k.d.ts.map +1 -0
- package/dist/engines/retirement401k.js +126 -0
- package/dist/engines/retirement401k.js.map +1 -0
- package/dist/engines/socialSecurity.d.ts +59 -0
- package/dist/engines/socialSecurity.d.ts.map +1 -0
- package/dist/engines/socialSecurity.js +135 -0
- package/dist/engines/socialSecurity.js.map +1 -0
- package/dist/envelope.d.ts +76 -0
- package/dist/envelope.d.ts.map +1 -0
- package/dist/envelope.js +34 -0
- package/dist/envelope.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +197 -0
- package/dist/index.js.map +1 -0
- package/dist/shared/bounds.d.ts +83 -0
- package/dist/shared/bounds.d.ts.map +1 -0
- package/dist/shared/bounds.js +121 -0
- package/dist/shared/bounds.js.map +1 -0
- package/dist/tools/compoundInterest.d.ts +48 -0
- package/dist/tools/compoundInterest.d.ts.map +1 -0
- package/dist/tools/compoundInterest.js +107 -0
- package/dist/tools/compoundInterest.js.map +1 -0
- package/dist/tools/mortgage.d.ts +51 -0
- package/dist/tools/mortgage.d.ts.map +1 -0
- package/dist/tools/mortgage.js +112 -0
- package/dist/tools/mortgage.js.map +1 -0
- package/dist/tools/paycheck.d.ts +54 -0
- package/dist/tools/paycheck.d.ts.map +1 -0
- package/dist/tools/paycheck.js +122 -0
- package/dist/tools/paycheck.js.map +1 -0
- package/dist/tools/retirement401k.d.ts +85 -0
- package/dist/tools/retirement401k.d.ts.map +1 -0
- package/dist/tools/retirement401k.js +141 -0
- package/dist/tools/retirement401k.js.map +1 -0
- package/dist/tools/socialSecurity.d.ts +51 -0
- package/dist/tools/socialSecurity.d.ts.map +1 -0
- package/dist/tools/socialSecurity.js +117 -0
- package/dist/tools/socialSecurity.js.map +1 -0
- package/dist/util/zod-to-json-schema.d.ts +28 -0
- package/dist/util/zod-to-json-schema.d.ts.map +1 -0
- package/dist/util/zod-to-json-schema.js +98 -0
- package/dist/util/zod-to-json-schema.js.map +1 -0
- package/package.json +53 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @markcolabs/mcp — MCP server entrypoint.
|
|
4
|
+
*
|
|
5
|
+
* Sprint 136 v0.1.0 (per ADR-0039). Registers:
|
|
6
|
+
* - 5 tools:
|
|
7
|
+
* dc.calculator.mortgage.monthlyPayment (S135 Item 5)
|
|
8
|
+
* dc.calculator.compoundInterest.futureValue (S135 Item 5)
|
|
9
|
+
* dc.calculator.401k.projection (S136 Item 3)
|
|
10
|
+
* dc.calculator.socialSecurity.estimate (S136 Item 3)
|
|
11
|
+
* dc.calculator.paycheck.netPay (S136 Item 3)
|
|
12
|
+
* - 1 resource: dc://disclaimers/ymyl (canonical YMYL disclaimer)
|
|
13
|
+
*
|
|
14
|
+
* Transport: stdio (default for local MCP clients).
|
|
15
|
+
*
|
|
16
|
+
* S136 hits O5-KR1 5-tool target. Post-S136: methodology resources
|
|
17
|
+
* (dc://methodologies/*) and the `plan-retirement` prompt template (O5-KR2).
|
|
18
|
+
*/
|
|
19
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
20
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
21
|
+
import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
22
|
+
import { zodToJsonSchema } from "./util/zod-to-json-schema.js";
|
|
23
|
+
import * as mortgageTool from "./tools/mortgage.js";
|
|
24
|
+
import * as compoundInterestTool from "./tools/compoundInterest.js";
|
|
25
|
+
import * as retirement401kTool from "./tools/retirement401k.js";
|
|
26
|
+
import * as socialSecurityTool from "./tools/socialSecurity.js";
|
|
27
|
+
import * as paycheckTool from "./tools/paycheck.js";
|
|
28
|
+
import { YMYL_DISCLAIMER, YMYL_DISCLAIMER_URI, } from "./disclaimers/ymyl.js";
|
|
29
|
+
// Re-export the tool execute functions and engines so consumers (and parity
|
|
30
|
+
// tests) can import them directly without spinning up the MCP transport.
|
|
31
|
+
export { execute as executeMortgageTool } from "./tools/mortgage.js";
|
|
32
|
+
export { execute as executeCompoundInterestTool } from "./tools/compoundInterest.js";
|
|
33
|
+
export { execute as executeRetirement401kTool } from "./tools/retirement401k.js";
|
|
34
|
+
export { execute as executeSocialSecurityTool } from "./tools/socialSecurity.js";
|
|
35
|
+
export { execute as executePaycheckTool } from "./tools/paycheck.js";
|
|
36
|
+
export * as mortgageEngine from "./engines/mortgage.js";
|
|
37
|
+
export * as compoundInterestEngine from "./engines/compoundInterest.js";
|
|
38
|
+
export * as retirement401kEngine from "./engines/retirement401k.js";
|
|
39
|
+
export * as socialSecurityEngine from "./engines/socialSecurity.js";
|
|
40
|
+
export * as paycheckEngine from "./engines/paycheck.js";
|
|
41
|
+
export * from "./envelope.js";
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// Server setup
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
const server = new Server({
|
|
46
|
+
name: "@markcolabs/mcp",
|
|
47
|
+
version: "0.1.0",
|
|
48
|
+
}, {
|
|
49
|
+
capabilities: {
|
|
50
|
+
tools: {},
|
|
51
|
+
resources: {},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// tools/list
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
58
|
+
return {
|
|
59
|
+
tools: [
|
|
60
|
+
{
|
|
61
|
+
name: mortgageTool.TOOL_NAME,
|
|
62
|
+
description: mortgageTool.TOOL_DESCRIPTION,
|
|
63
|
+
inputSchema: zodToJsonSchema(mortgageTool.MortgageMonthlyPaymentInputSchema),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: compoundInterestTool.TOOL_NAME,
|
|
67
|
+
description: compoundInterestTool.TOOL_DESCRIPTION,
|
|
68
|
+
inputSchema: zodToJsonSchema(compoundInterestTool.CompoundInterestFutureValueInputSchema),
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: retirement401kTool.TOOL_NAME,
|
|
72
|
+
description: retirement401kTool.TOOL_DESCRIPTION,
|
|
73
|
+
inputSchema: zodToJsonSchema(retirement401kTool.Retirement401kProjectionInputSchema),
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: socialSecurityTool.TOOL_NAME,
|
|
77
|
+
description: socialSecurityTool.TOOL_DESCRIPTION,
|
|
78
|
+
inputSchema: zodToJsonSchema(socialSecurityTool.SocialSecurityEstimateInputSchema),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: paycheckTool.TOOL_NAME,
|
|
82
|
+
description: paycheckTool.TOOL_DESCRIPTION,
|
|
83
|
+
inputSchema: zodToJsonSchema(paycheckTool.PaycheckNetPayInputSchema),
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// tools/call
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
92
|
+
const { name, arguments: args } = request.params;
|
|
93
|
+
let result;
|
|
94
|
+
switch (name) {
|
|
95
|
+
case mortgageTool.TOOL_NAME:
|
|
96
|
+
result = mortgageTool.execute(args);
|
|
97
|
+
break;
|
|
98
|
+
case compoundInterestTool.TOOL_NAME:
|
|
99
|
+
result = compoundInterestTool.execute(args);
|
|
100
|
+
break;
|
|
101
|
+
case retirement401kTool.TOOL_NAME:
|
|
102
|
+
result = retirement401kTool.execute(args);
|
|
103
|
+
break;
|
|
104
|
+
case socialSecurityTool.TOOL_NAME:
|
|
105
|
+
result = socialSecurityTool.execute(args);
|
|
106
|
+
break;
|
|
107
|
+
case paycheckTool.TOOL_NAME:
|
|
108
|
+
result = paycheckTool.execute(args);
|
|
109
|
+
break;
|
|
110
|
+
default:
|
|
111
|
+
return {
|
|
112
|
+
isError: true,
|
|
113
|
+
content: [
|
|
114
|
+
{
|
|
115
|
+
type: "text",
|
|
116
|
+
text: JSON.stringify({
|
|
117
|
+
error: {
|
|
118
|
+
code: "INPUT_VALIDATION",
|
|
119
|
+
message: `Unknown tool: ${name}`,
|
|
120
|
+
retriable: false,
|
|
121
|
+
},
|
|
122
|
+
}),
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (result.ok) {
|
|
128
|
+
return {
|
|
129
|
+
content: [
|
|
130
|
+
{
|
|
131
|
+
type: "text",
|
|
132
|
+
text: JSON.stringify(result.value, null, 2),
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
isError: true,
|
|
139
|
+
content: [
|
|
140
|
+
{
|
|
141
|
+
type: "text",
|
|
142
|
+
text: JSON.stringify(result.error),
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
// resources/list — exposes the canonical YMYL disclaimer (O5-KR2 stub)
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
151
|
+
return {
|
|
152
|
+
resources: [
|
|
153
|
+
{
|
|
154
|
+
uri: YMYL_DISCLAIMER_URI,
|
|
155
|
+
name: "Canonical YMYL Disclaimer",
|
|
156
|
+
description: "Single source of truth for the YMYL disclaimer string returned in every tool response.",
|
|
157
|
+
mimeType: "text/plain",
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
163
|
+
const { uri } = request.params;
|
|
164
|
+
if (uri === YMYL_DISCLAIMER_URI) {
|
|
165
|
+
return {
|
|
166
|
+
contents: [
|
|
167
|
+
{
|
|
168
|
+
uri,
|
|
169
|
+
mimeType: "text/plain",
|
|
170
|
+
text: YMYL_DISCLAIMER,
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
throw new Error(`Unknown resource: ${uri}`);
|
|
176
|
+
});
|
|
177
|
+
// ---------------------------------------------------------------------------
|
|
178
|
+
// Boot — only run when invoked directly (not when imported by tests).
|
|
179
|
+
// ---------------------------------------------------------------------------
|
|
180
|
+
async function main() {
|
|
181
|
+
const transport = new StdioServerTransport();
|
|
182
|
+
await server.connect(transport);
|
|
183
|
+
// eslint-disable-next-line no-console
|
|
184
|
+
console.error("[@markcolabs/mcp] v0.1.0 ready (stdio) — 5 tools registered.");
|
|
185
|
+
}
|
|
186
|
+
// Run only when invoked as a binary, not when imported by parity tests.
|
|
187
|
+
const isDirect = import.meta.url === `file://${process.argv[1]}` ||
|
|
188
|
+
process.argv[1]?.endsWith("dist/index.js") ||
|
|
189
|
+
process.argv[1]?.endsWith("dist\\index.js");
|
|
190
|
+
if (isDirect) {
|
|
191
|
+
main().catch((err) => {
|
|
192
|
+
// eslint-disable-next-line no-console
|
|
193
|
+
console.error("[@markcolabs/mcp] fatal:", err);
|
|
194
|
+
process.exit(1);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,eA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ds match the constants already defined in the source
|
|
5
|
+
* calculator JS (e.g., MAX_HOME_PRICE = 100000000 from mortgage-calculator.js).
|
|
6
|
+
* Bounds are imported from a shared bounds.ts module so engine and schema cannot drift."
|
|
7
|
+
*
|
|
8
|
+
* If the site calculator constants change, update both surfaces in lockstep.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MORTGAGE_BOUNDS: {
|
|
11
|
+
readonly MIN_PRINCIPAL: 0;
|
|
12
|
+
readonly MAX_PRINCIPAL: 100000000;
|
|
13
|
+
readonly MIN_RATE_PERCENT: 0;
|
|
14
|
+
readonly MAX_RATE_PERCENT: 30;
|
|
15
|
+
readonly MIN_TERM_YEARS: 1;
|
|
16
|
+
readonly MAX_TERM_YEARS: 50;
|
|
17
|
+
};
|
|
18
|
+
export declare const COMPOUND_INTEREST_BOUNDS: {
|
|
19
|
+
readonly MIN_PRINCIPAL: 0;
|
|
20
|
+
readonly MAX_PRINCIPAL: 100000000;
|
|
21
|
+
readonly MIN_RATE_PERCENT: 0;
|
|
22
|
+
readonly MAX_RATE_PERCENT: 50;
|
|
23
|
+
readonly MIN_YEARS: 0;
|
|
24
|
+
readonly MAX_YEARS: 100;
|
|
25
|
+
readonly MIN_MONTHLY_CONTRIBUTION: 0;
|
|
26
|
+
readonly MAX_MONTHLY_CONTRIBUTION: 1000000;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Allowed compounding-frequency labels and their per-year period counts.
|
|
30
|
+
* Matches the site calculator's compoundFrequency input options.
|
|
31
|
+
*/
|
|
32
|
+
export declare const COMPOUNDING_FREQUENCY: Record<"annually" | "semiannually" | "quarterly" | "monthly" | "daily", number>;
|
|
33
|
+
export type CompoundingFrequencyLabel = keyof typeof COMPOUNDING_FREQUENCY;
|
|
34
|
+
export declare const RETIREMENT_401K_BOUNDS: {
|
|
35
|
+
readonly MIN_CURRENT_BALANCE: 0;
|
|
36
|
+
readonly MAX_CURRENT_BALANCE: 100000000;
|
|
37
|
+
readonly MIN_ANNUAL_SALARY: 0;
|
|
38
|
+
readonly MAX_ANNUAL_SALARY: 100000000;
|
|
39
|
+
readonly MIN_CONTRIBUTION_PERCENT: 0;
|
|
40
|
+
readonly MAX_CONTRIBUTION_PERCENT: 100;
|
|
41
|
+
readonly MIN_EMPLOYER_MATCH_PERCENT: 0;
|
|
42
|
+
readonly MAX_EMPLOYER_MATCH_PERCENT: 100;
|
|
43
|
+
readonly MIN_EMPLOYER_MATCH_LIMIT_PERCENT: 0;
|
|
44
|
+
readonly MAX_EMPLOYER_MATCH_LIMIT_PERCENT: 100;
|
|
45
|
+
readonly MIN_SALARY_GROWTH_PERCENT: 0;
|
|
46
|
+
readonly MAX_SALARY_GROWTH_PERCENT: 20;
|
|
47
|
+
readonly MIN_RETURN_PERCENT: 0;
|
|
48
|
+
readonly MAX_RETURN_PERCENT: 20;
|
|
49
|
+
readonly MIN_AGE: 18;
|
|
50
|
+
readonly MAX_AGE: 100;
|
|
51
|
+
};
|
|
52
|
+
export declare const SOCIAL_SECURITY_BOUNDS: {
|
|
53
|
+
readonly MIN_BIRTH_YEAR: 1943;
|
|
54
|
+
readonly MAX_BIRTH_YEAR: 2004;
|
|
55
|
+
readonly MIN_CURRENT_EARNINGS: 0;
|
|
56
|
+
readonly MAX_CURRENT_EARNINGS: 1000000;
|
|
57
|
+
readonly MIN_CLAIM_AGE: 62;
|
|
58
|
+
readonly MAX_CLAIM_AGE: 70;
|
|
59
|
+
readonly MIN_LIFE_EXPECTANCY: 62;
|
|
60
|
+
readonly MAX_LIFE_EXPECTANCY: 120;
|
|
61
|
+
readonly MIN_YEARS_WORKED: 0;
|
|
62
|
+
readonly MAX_YEARS_WORKED: 50;
|
|
63
|
+
};
|
|
64
|
+
export declare const PAYCHECK_BOUNDS: {
|
|
65
|
+
readonly MIN_GROSS_ANNUAL_SALARY: 0;
|
|
66
|
+
readonly MAX_GROSS_ANNUAL_SALARY: 10000000;
|
|
67
|
+
readonly MIN_DEPENDENTS: 0;
|
|
68
|
+
readonly MAX_DEPENDENTS: 20;
|
|
69
|
+
readonly MIN_PRETAX_DEDUCTIONS: 0;
|
|
70
|
+
readonly MAX_PRETAX_DEDUCTIONS: 1000000;
|
|
71
|
+
readonly MIN_POSTTAX_DEDUCTIONS: 0;
|
|
72
|
+
readonly MAX_POSTTAX_DEDUCTIONS: 1000000;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Allowed paycheck pay-frequency labels. Mirrors site PAY_PERIODS keys
|
|
76
|
+
* (excluding hourly, which is computed differently and out of scope for v1).
|
|
77
|
+
*/
|
|
78
|
+
export declare const PAYCHECK_PAY_FREQUENCY: Record<"weekly" | "biweekly" | "semimonthly" | "monthly" | "quarterly" | "annual", number>;
|
|
79
|
+
export type PaycheckPayFrequencyLabel = keyof typeof PAYCHECK_PAY_FREQUENCY;
|
|
80
|
+
/** Federal filing-status enum (camelCase, matches paycheck engine). */
|
|
81
|
+
export declare const FEDERAL_FILING_STATUS: readonly ["single", "married", "marriedSeparate", "headOfHousehold"];
|
|
82
|
+
export type FederalFilingStatusLabel = (typeof FEDERAL_FILING_STATUS)[number];
|
|
83
|
+
//# sourceMappingURL=bounds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounds.d.ts","sourceRoot":"","sources":["../../src/shared/bounds.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,eAAO,MAAM,eAAe;;;;;;;CAOlB,CAAC;AAKX,eAAO,MAAM,wBAAwB;;;;;;;;;CAS3B,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CACxC,UAAU,GAAG,cAAc,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,EAC/D,MAAM,CAOP,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAQ3E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;CAiBzB,CAAC;AASX,eAAO,MAAM,sBAAsB;;;;;;;;;;;CAWzB,CAAC;AAMX,eAAO,MAAM,eAAe;;;;;;;;;CASlB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CACzC,QAAQ,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,EAC1E,MAAM,CAQP,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,MAAM,OAAO,sBAAsB,CAAC;AAE5E,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,sEAKxB,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Numeric bounds shared between Zod schemas and engines.
|
|
3
|
+
*
|
|
4
|
+
* Per ADR-0039 § 2: "Bounds match the constants already defined in the source
|
|
5
|
+
* calculator JS (e.g., MAX_HOME_PRICE = 100000000 from mortgage-calculator.js).
|
|
6
|
+
* Bounds are imported from a shared bounds.ts module so engine and schema cannot drift."
|
|
7
|
+
*
|
|
8
|
+
* If the site calculator constants change, update both surfaces in lockstep.
|
|
9
|
+
*/
|
|
10
|
+
// -----------------------------------------------------------------------------
|
|
11
|
+
// Mortgage calculator bounds
|
|
12
|
+
// -----------------------------------------------------------------------------
|
|
13
|
+
export const MORTGAGE_BOUNDS = {
|
|
14
|
+
MIN_PRINCIPAL: 0,
|
|
15
|
+
MAX_PRINCIPAL: 100_000_000,
|
|
16
|
+
MIN_RATE_PERCENT: 0,
|
|
17
|
+
MAX_RATE_PERCENT: 30,
|
|
18
|
+
MIN_TERM_YEARS: 1,
|
|
19
|
+
MAX_TERM_YEARS: 50,
|
|
20
|
+
};
|
|
21
|
+
// -----------------------------------------------------------------------------
|
|
22
|
+
// Compound-interest calculator bounds
|
|
23
|
+
// -----------------------------------------------------------------------------
|
|
24
|
+
export const COMPOUND_INTEREST_BOUNDS = {
|
|
25
|
+
MIN_PRINCIPAL: 0,
|
|
26
|
+
MAX_PRINCIPAL: 100_000_000,
|
|
27
|
+
MIN_RATE_PERCENT: 0,
|
|
28
|
+
MAX_RATE_PERCENT: 50,
|
|
29
|
+
MIN_YEARS: 0,
|
|
30
|
+
MAX_YEARS: 100,
|
|
31
|
+
MIN_MONTHLY_CONTRIBUTION: 0,
|
|
32
|
+
MAX_MONTHLY_CONTRIBUTION: 1_000_000,
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Allowed compounding-frequency labels and their per-year period counts.
|
|
36
|
+
* Matches the site calculator's compoundFrequency input options.
|
|
37
|
+
*/
|
|
38
|
+
export const COMPOUNDING_FREQUENCY = {
|
|
39
|
+
annually: 1,
|
|
40
|
+
semiannually: 2,
|
|
41
|
+
quarterly: 4,
|
|
42
|
+
monthly: 12,
|
|
43
|
+
daily: 365,
|
|
44
|
+
};
|
|
45
|
+
// -----------------------------------------------------------------------------
|
|
46
|
+
// 401(k) projection bounds (S136)
|
|
47
|
+
// -----------------------------------------------------------------------------
|
|
48
|
+
// Mirrors the site 401k calculator's form ranges (see formFields config in
|
|
49
|
+
// site/src/pages/401k-retirement-calculator/401k-retirement-calculator.js).
|
|
50
|
+
// `MAX_RETURN_PERCENT` matches MAX_EXPECTED_RETURN constant in that file.
|
|
51
|
+
export const RETIREMENT_401K_BOUNDS = {
|
|
52
|
+
MIN_CURRENT_BALANCE: 0,
|
|
53
|
+
MAX_CURRENT_BALANCE: 100_000_000,
|
|
54
|
+
MIN_ANNUAL_SALARY: 0,
|
|
55
|
+
MAX_ANNUAL_SALARY: 100_000_000,
|
|
56
|
+
MIN_CONTRIBUTION_PERCENT: 0,
|
|
57
|
+
MAX_CONTRIBUTION_PERCENT: 100,
|
|
58
|
+
MIN_EMPLOYER_MATCH_PERCENT: 0,
|
|
59
|
+
MAX_EMPLOYER_MATCH_PERCENT: 100,
|
|
60
|
+
MIN_EMPLOYER_MATCH_LIMIT_PERCENT: 0,
|
|
61
|
+
MAX_EMPLOYER_MATCH_LIMIT_PERCENT: 100,
|
|
62
|
+
MIN_SALARY_GROWTH_PERCENT: 0,
|
|
63
|
+
MAX_SALARY_GROWTH_PERCENT: 20,
|
|
64
|
+
MIN_RETURN_PERCENT: 0,
|
|
65
|
+
MAX_RETURN_PERCENT: 20,
|
|
66
|
+
MIN_AGE: 18,
|
|
67
|
+
MAX_AGE: 100,
|
|
68
|
+
};
|
|
69
|
+
// -----------------------------------------------------------------------------
|
|
70
|
+
// Social Security estimate bounds (S136)
|
|
71
|
+
// -----------------------------------------------------------------------------
|
|
72
|
+
// Mirrors site/src/pages/social-security-calculator form ranges.
|
|
73
|
+
// Birth year range matches site min/max (1943..2004) — anyone outside that
|
|
74
|
+
// range can't realistically use 2014+ bend points or hasn't been born yet.
|
|
75
|
+
// Claim age 62-70 is the SSA-allowed claiming window.
|
|
76
|
+
export const SOCIAL_SECURITY_BOUNDS = {
|
|
77
|
+
MIN_BIRTH_YEAR: 1943,
|
|
78
|
+
MAX_BIRTH_YEAR: 2004,
|
|
79
|
+
MIN_CURRENT_EARNINGS: 0,
|
|
80
|
+
MAX_CURRENT_EARNINGS: 1_000_000,
|
|
81
|
+
MIN_CLAIM_AGE: 62,
|
|
82
|
+
MAX_CLAIM_AGE: 70,
|
|
83
|
+
MIN_LIFE_EXPECTANCY: 62,
|
|
84
|
+
MAX_LIFE_EXPECTANCY: 120,
|
|
85
|
+
MIN_YEARS_WORKED: 0,
|
|
86
|
+
MAX_YEARS_WORKED: 50,
|
|
87
|
+
};
|
|
88
|
+
// -----------------------------------------------------------------------------
|
|
89
|
+
// Paycheck net-pay bounds (S136)
|
|
90
|
+
// -----------------------------------------------------------------------------
|
|
91
|
+
// Mirrors site/src/pages/paycheck-calculator form ranges + IRS reasonable caps.
|
|
92
|
+
export const PAYCHECK_BOUNDS = {
|
|
93
|
+
MIN_GROSS_ANNUAL_SALARY: 0,
|
|
94
|
+
MAX_GROSS_ANNUAL_SALARY: 10_000_000,
|
|
95
|
+
MIN_DEPENDENTS: 0,
|
|
96
|
+
MAX_DEPENDENTS: 20,
|
|
97
|
+
MIN_PRETAX_DEDUCTIONS: 0,
|
|
98
|
+
MAX_PRETAX_DEDUCTIONS: 1_000_000,
|
|
99
|
+
MIN_POSTTAX_DEDUCTIONS: 0,
|
|
100
|
+
MAX_POSTTAX_DEDUCTIONS: 1_000_000,
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Allowed paycheck pay-frequency labels. Mirrors site PAY_PERIODS keys
|
|
104
|
+
* (excluding hourly, which is computed differently and out of scope for v1).
|
|
105
|
+
*/
|
|
106
|
+
export const PAYCHECK_PAY_FREQUENCY = {
|
|
107
|
+
weekly: 52,
|
|
108
|
+
biweekly: 26,
|
|
109
|
+
semimonthly: 24,
|
|
110
|
+
monthly: 12,
|
|
111
|
+
quarterly: 4,
|
|
112
|
+
annual: 1,
|
|
113
|
+
};
|
|
114
|
+
/** Federal filing-status enum (camelCase, matches paycheck engine). */
|
|
115
|
+
export const FEDERAL_FILING_STATUS = [
|
|
116
|
+
"single",
|
|
117
|
+
"married",
|
|
118
|
+
"marriedSeparate",
|
|
119
|
+
"headOfHousehold",
|
|
120
|
+
];
|
|
121
|
+
//# sourceMappingURL=bounds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounds.js","sourceRoot":"","sources":["../../src/shared/bounds.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,gFAAgF;AAChF,6BAA6B;AAC7B,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,WAAW;IAC1B,gBAAgB,EAAE,CAAC;IACnB,gBAAgB,EAAE,EAAE;IACpB,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,EAAE;CACV,CAAC;AAEX,gFAAgF;AAChF,sCAAsC;AACtC,gFAAgF;AAChF,MAAM,CAAC,MAAM,wBAAwB,GAAG;I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ACjB,aAAa,EAAE,EAAE;IACjB,mBAAmB,EAAE,EAAE;IACvB,mBAAmB,EAAE,GAAG;IACxB,gBAAgB,EAAE,CAAC;IACnB,gBAAgB,EAAE,EAAE;CACZ,CAAC;AAEX,gFAAgF;AAChF,iCAAiC;AACjC,gFAAgF;AAChF,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,uBAAuB,EAAE,CAAC;IAC1B,uBAAuB,EAAE,UAAU;IACnC,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,EAAE;IAClB,qBAAqB,EAAE,CAAC;IACxB,qBAAqB,EAAE,SAAS;IAChC,sBAAsB,EAAE,CAAC;IACzB,sBAAsB,EAAE,SAAS;CACzB,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAG/B;IACF,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,CAAC;IACZ,MAAM,EAAE,CAAC;CACV,CAAC;AAIF,uEAAuE;AACvE,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,QAAQ;IACR,SAAS;IACT,iBAAiB;IACjB,iBAAiB;CACT,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool wrapper for `dc.calculator.compoundInterest.futureValue`.
|
|
3
|
+
*
|
|
4
|
+
* Per ADR-0039 § 1: tool name locked.
|
|
5
|
+
* Per ADR-0039 § 2: Zod input with bounds from shared/bounds.ts; rate as Percent.
|
|
6
|
+
* Per ADR-0039 § 3: returns ToolResult<CompoundInterestFutureValueResult>.
|
|
7
|
+
* Per ADR-0039 § 4: errors funnel through ToolError.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { type CompoundInterestFutureValueResult } from "../engines/compoundInterest.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.compoundInterest.futureValue";
|
|
14
|
+
/**
|
|
15
|
+
* Zod input schema. `compoundingFrequency` is an enum of the supported labels.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CompoundInterestFutureValueInputSchema: z.ZodObject<{
|
|
18
|
+
principal: z.ZodNumber;
|
|
19
|
+
annualRatePercent: z.ZodNumber;
|
|
20
|
+
years: z.ZodNumber;
|
|
21
|
+
compoundingFrequency: z.ZodEnum<["annually" | "semiannually" | "quarterly" | "monthly" | "daily", ...("annually" | "semiannually" | "quarterly" | "monthly" | "daily")[]]>;
|
|
22
|
+
monthlyContribution: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
principal: number;
|
|
25
|
+
annualRatePercent: number;
|
|
26
|
+
years: number;
|
|
27
|
+
compoundingFrequency: "annually" | "semiannually" | "quarterly" | "monthly" | "daily";
|
|
28
|
+
monthlyContribution?: number | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
principal: number;
|
|
31
|
+
annualRatePercent: number;
|
|
32
|
+
years: number;
|
|
33
|
+
compoundingFrequency: "annually" | "semiannually" | "quarterly" | "monthly" | "daily";
|
|
34
|
+
monthlyContribution?: number | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
export type CompoundInterestFutureValueToolInput = z.infer<typeof CompoundInterestFutureValueInputSchema>;
|
|
37
|
+
export declare const TOOL_DESCRIPTION: string;
|
|
38
|
+
/**
|
|
39
|
+
* Execute the tool. Tagged-union return; SDK adapter maps to MCP isError.
|
|
40
|
+
*/
|
|
41
|
+
export declare function execute(rawInput: unknown): {
|
|
42
|
+
ok: true;
|
|
43
|
+
value: ToolResult<CompoundInterestFutureValueResult>;
|
|
44
|
+
} | {
|
|
45
|
+
ok: false;
|
|
46
|
+
error: ToolError;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=compoundInterest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compoundInterest.d.ts","sourceRoot":"","sources":["../../src/tools/compoundInterest.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,iCAAiC,EACvC,MAAM,gCAAgC,CAAC;AAMxC,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AAExB,yCAAyC;AACzC,eAAO,MAAM,SAAS,+CAA+C,CAAC;AAYtE;;GAEG;AACH,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;EA2BjD,CAAC;AAEH,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,sCAAsC,CAC9C,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAGyD,CAAC;AAEvF;;GAEG;AACH,wBAAgB,OAAO,CACrB,QAAQ,EAAE,OAAO,GAEf;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC,iCAAiC,CAAC,CAAA;CAAE,GAClE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAuDlC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool wrapper for `dc.calculator.compoundInterest.futureValue`.
|
|
3
|
+
*
|
|
4
|
+
* Per ADR-0039 § 1: tool name locked.
|
|
5
|
+
* Per ADR-0039 § 2: Zod input with bounds from shared/bounds.ts; rate as Percent.
|
|
6
|
+
* Per ADR-0039 § 3: returns ToolResult<CompoundInterestFutureValueResult>.
|
|
7
|
+
* Per ADR-0039 § 4: errors funnel through ToolError.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { futureValue, ENGINE_VERSION, } from "../engines/compoundInterest.js";
|
|
11
|
+
import { COMPOUND_INTEREST_BOUNDS, COMPOUNDING_FREQUENCY, } 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.compoundInterest.futureValue";
|
|
16
|
+
const METHODOLOGY = {
|
|
17
|
+
url: "https://www.digitalcalculator.info/compound-interest-calculator/",
|
|
18
|
+
version: "2026-05-09",
|
|
19
|
+
};
|
|
20
|
+
const FREQUENCY_LABELS = Object.keys(COMPOUNDING_FREQUENCY);
|
|
21
|
+
/**
|
|
22
|
+
* Zod input schema. `compoundingFrequency` is an enum of the supported labels.
|
|
23
|
+
*/
|
|
24
|
+
export const CompoundInterestFutureValueInputSchema = z.object({
|
|
25
|
+
principal: z
|
|
26
|
+
.number()
|
|
27
|
+
.min(COMPOUND_INTEREST_BOUNDS.MIN_PRINCIPAL)
|
|
28
|
+
.max(COMPOUND_INTEREST_BOUNDS.MAX_PRINCIPAL)
|
|
29
|
+
.describe("Initial principal in USD."),
|
|
30
|
+
annualRatePercent: z
|
|
31
|
+
.number()
|
|
32
|
+
.min(COMPOUND_INTEREST_BOUNDS.MIN_RATE_PERCENT)
|
|
33
|
+
.max(COMPOUND_INTEREST_BOUNDS.MAX_RATE_PERCENT)
|
|
34
|
+
.describe("Annual interest rate as whole-number percent (e.g., 7 for 7%)."),
|
|
35
|
+
years: z
|
|
36
|
+
.number()
|
|
37
|
+
.min(COMPOUND_INTEREST_BOUNDS.MIN_YEARS)
|
|
38
|
+
.max(COMPOUND_INTEREST_BOUNDS.MAX_YEARS)
|
|
39
|
+
.describe("Investment period in years."),
|
|
40
|
+
compoundingFrequency: z
|
|
41
|
+
.enum(FREQUENCY_LABELS)
|
|
42
|
+
.describe("How often interest compounds: annually | semiannually | quarterly | monthly | daily."),
|
|
43
|
+
monthlyContribution: z
|
|
44
|
+
.number()
|
|
45
|
+
.min(COMPOUND_INTEREST_BOUNDS.MIN_MONTHLY_CONTRIBUTION)
|
|
46
|
+
.max(COMPOUND_INTEREST_BOUNDS.MAX_MONTHLY_CONTRIBUTION)
|
|
47
|
+
.optional()
|
|
48
|
+
.describe("Optional monthly contribution in USD. Defaults to 0."),
|
|
49
|
+
});
|
|
50
|
+
export const TOOL_DESCRIPTION = "Project the future value of an initial principal with optional regular monthly " +
|
|
51
|
+
"contributions, compounding at the chosen frequency. Inputs are in USD; rate is a " +
|
|
52
|
+
"whole-number percent. Returns { futureValue, totalContributions, interestEarned }.";
|
|
53
|
+
/**
|
|
54
|
+
* Execute the tool. Tagged-union return; SDK adapter maps to MCP isError.
|
|
55
|
+
*/
|
|
56
|
+
export function execute(rawInput) {
|
|
57
|
+
const parsed = CompoundInterestFutureValueInputSchema.safeParse(rawInput);
|
|
58
|
+
if (!parsed.success) {
|
|
59
|
+
const first = parsed.error.issues[0];
|
|
60
|
+
return {
|
|
61
|
+
ok: false,
|
|
62
|
+
error: makeError({
|
|
63
|
+
code: "INPUT_VALIDATION",
|
|
64
|
+
message: first?.message ?? "Invalid input.",
|
|
65
|
+
field: first?.path.join(".") || undefined,
|
|
66
|
+
retriable: false,
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const input = parsed.data;
|
|
71
|
+
let payload;
|
|
72
|
+
try {
|
|
73
|
+
payload = futureValue(input);
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
return {
|
|
77
|
+
ok: false,
|
|
78
|
+
error: makeError({
|
|
79
|
+
code: "INTERNAL",
|
|
80
|
+
message: "Engine error computing compound-interest future value.",
|
|
81
|
+
retriable: false,
|
|
82
|
+
}),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (!Number.isFinite(payload.futureValue) ||
|
|
86
|
+
!Number.isFinite(payload.totalContributions) ||
|
|
87
|
+
!Number.isFinite(payload.interestEarned)) {
|
|
88
|
+
return {
|
|
89
|
+
ok: false,
|
|
90
|
+
error: makeError({
|
|
91
|
+
code: "INTERNAL",
|
|
92
|
+
message: "Compound-interest engine produced a non-finite result.",
|
|
93
|
+
retriable: false,
|
|
94
|
+
}),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
ok: true,
|
|
99
|
+
value: makeResult({
|
|
100
|
+
result: payload,
|
|
101
|
+
methodology: METHODOLOGY,
|
|
102
|
+
engineVersion: ENGINE_VERSION,
|
|
103
|
+
disclaimer: YMYL_DISCLAIMER,
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=compoundInterest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compoundInterest.js","sourceRoot":"","sources":["../../src/tools/compoundInterest.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,cAAc,GAEf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,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,4CAA4C,CAAC;AAEtE,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,kEAAkE;IACvE,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAGzD,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,wBAAwB,CAAC,aAAa,CAAC;SAC3C,GAAG,CAA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AG,CAAC,IAAI,SAAS;gBACzC,SAAS,EAAE,KAAK;aACjB,CAAC;SACH,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;IAE1B,IAAI,OAA0C,CAAC;IAC/C,IAAI,CAAC;QACH,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,SAAS,CAAC;gBACf,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,wDAAwD;gBACjE,SAAS,EAAE,KAAK;aACjB,CAAC;SACH,CAAC;IACJ,CAAC;IAED,IACE,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC;QACrC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC;QAC5C,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,EACxC,CAAC;QACD,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,SAAS,CAAC;gBACf,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,wDAAwD;gBACjE,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"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 { 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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|