@kynver-app/mcp-estimator 0.2.16 → 0.2.18
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.js +1 -14
- package/dist/sse.js +1 -9
- package/package.json +8 -5
- package/dist/index.d.ts +0 -7
- package/dist/lib/kynver-client.d.ts +0 -20
- package/dist/lib/kynver-client.js +0 -115
- package/dist/lib/mcp-sse-server.d.ts +0 -44
- package/dist/lib/mcp-sse-server.js +0 -441
- package/dist/lib/package-version.d.ts +0 -7
- package/dist/lib/package-version.js +0 -44
- package/dist/server.d.ts +0 -6
- package/dist/server.js +0 -119
- package/dist/sse.d.ts +0 -1
- package/dist/tools/catalog-tools.d.ts +0 -381
- package/dist/tools/catalog-tools.js +0 -192
- package/dist/tools/client-tools.d.ts +0 -193
- package/dist/tools/client-tools.js +0 -105
- package/dist/tools/company-tools.d.ts +0 -163
- package/dist/tools/company-tools.js +0 -98
- package/dist/tools/email-pdf-tools.d.ts +0 -51
- package/dist/tools/email-pdf-tools.js +0 -22
- package/dist/tools/estimate-tools.d.ts +0 -531
- package/dist/tools/estimate-tools.js +0 -259
- package/dist/tools/intake-tools.d.ts +0 -463
- package/dist/tools/intake-tools.js +0 -82
- package/dist/tools/photo-tools.d.ts +0 -77
- package/dist/tools/photo-tools.js +0 -51
- package/dist/tools/price-catalog-tools.d.ts +0 -96
- package/dist/tools/price-catalog-tools.js +0 -72
- package/dist/tools/remodel-deliverable-tools.d.ts +0 -1868
- package/dist/tools/remodel-deliverable-tools.js +0 -138
- package/dist/tools/remodel-estimate-tools.d.ts +0 -525
- package/dist/tools/remodel-estimate-tools.js +0 -71
- package/dist/tools/signing-tools.d.ts +0 -89
- package/dist/tools/signing-tools.js +0 -51
- package/dist/tools/stats-pdf-tools.d.ts +0 -113
- package/dist/tools/stats-pdf-tools.js +0 -73
- package/dist/tools/takeoff-tools.d.ts +0 -730
- package/dist/tools/takeoff-tools.js +0 -297
- package/dist/tools/template-tools.d.ts +0 -96
- package/dist/tools/template-tools.js +0 -70
- package/dist/tools/version-tools.d.ts +0 -46
- package/dist/tools/version-tools.js +0 -33
- package/dist/tools/vision-tools.d.ts +0 -52
- package/dist/tools/vision-tools.js +0 -42
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import * as client from "../lib/kynver-client.js";
|
|
3
|
-
const scopeSchema = z.object({
|
|
4
|
-
key: z.string(),
|
|
5
|
-
label: z.string().optional(),
|
|
6
|
-
quantity: z.number().optional(),
|
|
7
|
-
unit: z.string().optional(),
|
|
8
|
-
serviceCode: z.string().optional(),
|
|
9
|
-
budgetLump: z.number().optional(),
|
|
10
|
-
notes: z.string().optional(),
|
|
11
|
-
});
|
|
12
|
-
const buildRemodelSchema = z.object({
|
|
13
|
-
intake: z.object({
|
|
14
|
-
projectName: z.string().optional(),
|
|
15
|
-
scopes: z.array(scopeSchema),
|
|
16
|
-
alternates: z
|
|
17
|
-
.array(z.object({
|
|
18
|
-
key: z.string(),
|
|
19
|
-
label: z.string(),
|
|
20
|
-
scopeKeys: z.array(z.string()).optional(),
|
|
21
|
-
lumpAdd: z.number().optional(),
|
|
22
|
-
notes: z.string().optional(),
|
|
23
|
-
}))
|
|
24
|
-
.optional(),
|
|
25
|
-
includeStandardAlternates: z.boolean().optional(),
|
|
26
|
-
expandScopeComponents: z.boolean().optional(),
|
|
27
|
-
exclusions: z.array(z.string()).optional(),
|
|
28
|
-
assumptions: z.array(z.string()).optional(),
|
|
29
|
-
notes: z.string().optional(),
|
|
30
|
-
}),
|
|
31
|
-
takeoffRows: z
|
|
32
|
-
.array(z.object({
|
|
33
|
-
id: z.string().optional(),
|
|
34
|
-
description: z.string(),
|
|
35
|
-
quantity: z.number(),
|
|
36
|
-
unit: z.string(),
|
|
37
|
-
serviceCode: z.string().nullable().optional(),
|
|
38
|
-
materialType: z.string().nullable().optional(),
|
|
39
|
-
}))
|
|
40
|
-
.optional(),
|
|
41
|
-
overrides: z
|
|
42
|
-
.array(z.object({
|
|
43
|
-
scopeKey: z.string().optional(),
|
|
44
|
-
serviceCode: z.string().optional(),
|
|
45
|
-
description: z.string().optional(),
|
|
46
|
-
quantity: z.number().optional(),
|
|
47
|
-
unitMaterial: z.number().optional(),
|
|
48
|
-
unitLabor: z.number().optional(),
|
|
49
|
-
lumpTotal: z.number().optional(),
|
|
50
|
-
notes: z.string().optional(),
|
|
51
|
-
}))
|
|
52
|
-
.optional(),
|
|
53
|
-
pricing: z
|
|
54
|
-
.object({
|
|
55
|
-
contingencyPercent: z.number().optional(),
|
|
56
|
-
markupPercent: z.number().optional(),
|
|
57
|
-
profitPercent: z.number().optional(),
|
|
58
|
-
})
|
|
59
|
-
.optional(),
|
|
60
|
-
});
|
|
61
|
-
export const buildRemodelEstimate = {
|
|
62
|
-
name: "estimator_build_remodel_estimate",
|
|
63
|
-
description: "Build a reviewable residential remodel estimate from normalized intake scopes, optional takeoff quantities, catalog prices, and overrides. Lump room scopes (kitchen, baths) auto-expand into a per-trade breakdown of line items (demolition, cabinetry, countertops, plumbing, electrical, appliances, flooring, tile, finishes) — each with its own scope-of-work description carried in notes — so client-facing output is itemized, not a single vague lump (set intake.expandScopeComponents=false for the legacy single-line behavior). Returns line items with provenance, alternates (both baths, upstairs expansion, roof, wall moving), a default+custom assumptions list, default+custom exclusions, contingency/markup/profit breakdown, and reviewMarkdown. Pass project-specific items via intake.assumptions and intake.exclusions. Does not persist — use estimator_generate_estimate_from_takeoff or estimator_create_repair after review. Room scope keys: kitchen, bath_full, bath_half, bath_primary, bath_secondary. Trade/quantity scope keys: cabinets, drywall, paint, framing, roof, flooring, electrical_kitchen, electrical_bath. Whole-project phase scope keys: general_conditions, permits, demolition, protection, final_clean.",
|
|
64
|
-
inputSchemaZod: buildRemodelSchema,
|
|
65
|
-
execute: async (args) => {
|
|
66
|
-
if (!client.hasApiKey())
|
|
67
|
-
return client.noApiKeyMessage();
|
|
68
|
-
const data = await client.post("/estimator/estimates/build-remodel", args);
|
|
69
|
-
return JSON.stringify(data);
|
|
70
|
-
},
|
|
71
|
-
};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
declare const createSigningRequestSchema: z.ZodObject<{
|
|
3
|
-
estimateId: z.ZodString;
|
|
4
|
-
recipientEmail: z.ZodOptional<z.ZodString>;
|
|
5
|
-
recipientName: z.ZodOptional<z.ZodString>;
|
|
6
|
-
senderNote: z.ZodOptional<z.ZodString>;
|
|
7
|
-
expiresInDays: z.ZodOptional<z.ZodNumber>;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
estimateId: string;
|
|
10
|
-
recipientEmail?: string | undefined;
|
|
11
|
-
recipientName?: string | undefined;
|
|
12
|
-
senderNote?: string | undefined;
|
|
13
|
-
expiresInDays?: number | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
estimateId: string;
|
|
16
|
-
recipientEmail?: string | undefined;
|
|
17
|
-
recipientName?: string | undefined;
|
|
18
|
-
senderNote?: string | undefined;
|
|
19
|
-
expiresInDays?: number | undefined;
|
|
20
|
-
}>;
|
|
21
|
-
export declare const createSigningRequest: {
|
|
22
|
-
name: string;
|
|
23
|
-
description: string;
|
|
24
|
-
inputSchemaZod: z.ZodObject<{
|
|
25
|
-
estimateId: z.ZodString;
|
|
26
|
-
recipientEmail: z.ZodOptional<z.ZodString>;
|
|
27
|
-
recipientName: z.ZodOptional<z.ZodString>;
|
|
28
|
-
senderNote: z.ZodOptional<z.ZodString>;
|
|
29
|
-
expiresInDays: z.ZodOptional<z.ZodNumber>;
|
|
30
|
-
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
estimateId: string;
|
|
32
|
-
recipientEmail?: string | undefined;
|
|
33
|
-
recipientName?: string | undefined;
|
|
34
|
-
senderNote?: string | undefined;
|
|
35
|
-
expiresInDays?: number | undefined;
|
|
36
|
-
}, {
|
|
37
|
-
estimateId: string;
|
|
38
|
-
recipientEmail?: string | undefined;
|
|
39
|
-
recipientName?: string | undefined;
|
|
40
|
-
senderNote?: string | undefined;
|
|
41
|
-
expiresInDays?: number | undefined;
|
|
42
|
-
}>;
|
|
43
|
-
execute: (args: z.infer<typeof createSigningRequestSchema>) => Promise<string>;
|
|
44
|
-
};
|
|
45
|
-
declare const getSigningRequestsSchema: z.ZodObject<{
|
|
46
|
-
estimateId: z.ZodString;
|
|
47
|
-
}, "strip", z.ZodTypeAny, {
|
|
48
|
-
estimateId: string;
|
|
49
|
-
}, {
|
|
50
|
-
estimateId: string;
|
|
51
|
-
}>;
|
|
52
|
-
export declare const getSigningRequests: {
|
|
53
|
-
name: string;
|
|
54
|
-
description: string;
|
|
55
|
-
inputSchemaZod: z.ZodObject<{
|
|
56
|
-
estimateId: z.ZodString;
|
|
57
|
-
}, "strip", z.ZodTypeAny, {
|
|
58
|
-
estimateId: string;
|
|
59
|
-
}, {
|
|
60
|
-
estimateId: string;
|
|
61
|
-
}>;
|
|
62
|
-
execute: (args: z.infer<typeof getSigningRequestsSchema>) => Promise<string>;
|
|
63
|
-
};
|
|
64
|
-
declare const cancelSigningRequestSchema: z.ZodObject<{
|
|
65
|
-
estimateId: z.ZodString;
|
|
66
|
-
requestId: z.ZodString;
|
|
67
|
-
}, "strip", z.ZodTypeAny, {
|
|
68
|
-
estimateId: string;
|
|
69
|
-
requestId: string;
|
|
70
|
-
}, {
|
|
71
|
-
estimateId: string;
|
|
72
|
-
requestId: string;
|
|
73
|
-
}>;
|
|
74
|
-
export declare const cancelSigningRequest: {
|
|
75
|
-
name: string;
|
|
76
|
-
description: string;
|
|
77
|
-
inputSchemaZod: z.ZodObject<{
|
|
78
|
-
estimateId: z.ZodString;
|
|
79
|
-
requestId: z.ZodString;
|
|
80
|
-
}, "strip", z.ZodTypeAny, {
|
|
81
|
-
estimateId: string;
|
|
82
|
-
requestId: string;
|
|
83
|
-
}, {
|
|
84
|
-
estimateId: string;
|
|
85
|
-
requestId: string;
|
|
86
|
-
}>;
|
|
87
|
-
execute: (args: z.infer<typeof cancelSigningRequestSchema>) => Promise<string>;
|
|
88
|
-
};
|
|
89
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import * as client from "../lib/kynver-client.js";
|
|
3
|
-
const createSigningRequestSchema = z.object({
|
|
4
|
-
estimateId: z.string(),
|
|
5
|
-
recipientEmail: z.string().email().optional(),
|
|
6
|
-
recipientName: z.string().max(200).optional(),
|
|
7
|
-
senderNote: z.string().max(2000).optional(),
|
|
8
|
-
expiresInDays: z.number().int().min(1).max(365).optional(),
|
|
9
|
-
});
|
|
10
|
-
export const createSigningRequest = {
|
|
11
|
-
name: "estimator_create_signing_request",
|
|
12
|
-
description: "Create a contract signing request for an estimate. Returns a tokenized signing URL that can be shared with the client. The client can review and electronically sign the estimate at that URL. The signing request expires after expiresInDays (default 30). Does not send emails during implementation.",
|
|
13
|
-
inputSchemaZod: createSigningRequestSchema,
|
|
14
|
-
execute: async (args) => {
|
|
15
|
-
if (!client.hasApiKey())
|
|
16
|
-
return client.noApiKeyMessage();
|
|
17
|
-
const { estimateId, ...body } = args;
|
|
18
|
-
const data = await client.post(`/estimator/estimates/${estimateId}/signing-requests`, body);
|
|
19
|
-
return JSON.stringify(data);
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
const getSigningRequestsSchema = z.object({
|
|
23
|
-
estimateId: z.string(),
|
|
24
|
-
});
|
|
25
|
-
export const getSigningRequests = {
|
|
26
|
-
name: "estimator_get_signing_requests",
|
|
27
|
-
description: "List all signing requests for an estimate. Returns status (pending/signed/expired/cancelled), signing URL, recipient, and audit metadata for each request.",
|
|
28
|
-
inputSchemaZod: getSigningRequestsSchema,
|
|
29
|
-
execute: async (args) => {
|
|
30
|
-
if (!client.hasApiKey())
|
|
31
|
-
return client.noApiKeyMessage();
|
|
32
|
-
const data = await client.get(`/estimator/estimates/${args.estimateId}/signing-requests`);
|
|
33
|
-
return JSON.stringify(data);
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
const cancelSigningRequestSchema = z.object({
|
|
37
|
-
estimateId: z.string(),
|
|
38
|
-
requestId: z.string(),
|
|
39
|
-
});
|
|
40
|
-
export const cancelSigningRequest = {
|
|
41
|
-
name: "estimator_cancel_signing_request",
|
|
42
|
-
description: "Cancel a pending signing request. Cannot cancel a request that has already been signed. The signing URL will become invalid immediately.",
|
|
43
|
-
inputSchemaZod: cancelSigningRequestSchema,
|
|
44
|
-
execute: async (args) => {
|
|
45
|
-
if (!client.hasApiKey())
|
|
46
|
-
return client.noApiKeyMessage();
|
|
47
|
-
const { estimateId, requestId } = args;
|
|
48
|
-
const data = await client.patch(`/estimator/estimates/${estimateId}/signing-requests`, { requestId });
|
|
49
|
-
return JSON.stringify(data);
|
|
50
|
-
},
|
|
51
|
-
};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
declare const getStatsSchema: z.ZodObject<{
|
|
3
|
-
from: z.ZodOptional<z.ZodString>;
|
|
4
|
-
to: z.ZodOptional<z.ZodString>;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
from?: string | undefined;
|
|
7
|
-
to?: string | undefined;
|
|
8
|
-
}, {
|
|
9
|
-
from?: string | undefined;
|
|
10
|
-
to?: string | undefined;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const getStats: {
|
|
13
|
-
name: string;
|
|
14
|
-
description: string;
|
|
15
|
-
inputSchemaZod: z.ZodObject<{
|
|
16
|
-
from: z.ZodOptional<z.ZodString>;
|
|
17
|
-
to: z.ZodOptional<z.ZodString>;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
from?: string | undefined;
|
|
20
|
-
to?: string | undefined;
|
|
21
|
-
}, {
|
|
22
|
-
from?: string | undefined;
|
|
23
|
-
to?: string | undefined;
|
|
24
|
-
}>;
|
|
25
|
-
execute: (args: z.infer<typeof getStatsSchema>) => Promise<string>;
|
|
26
|
-
};
|
|
27
|
-
declare const exportPdfSchema: z.ZodObject<{
|
|
28
|
-
estimateId: z.ZodString;
|
|
29
|
-
}, "strip", z.ZodTypeAny, {
|
|
30
|
-
estimateId: string;
|
|
31
|
-
}, {
|
|
32
|
-
estimateId: string;
|
|
33
|
-
}>;
|
|
34
|
-
export declare const exportPdf: {
|
|
35
|
-
name: string;
|
|
36
|
-
description: string;
|
|
37
|
-
inputSchemaZod: z.ZodObject<{
|
|
38
|
-
estimateId: z.ZodString;
|
|
39
|
-
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
estimateId: string;
|
|
41
|
-
}, {
|
|
42
|
-
estimateId: string;
|
|
43
|
-
}>;
|
|
44
|
-
execute: (args: z.infer<typeof exportPdfSchema>) => Promise<string>;
|
|
45
|
-
};
|
|
46
|
-
declare const updateOutputConfigSchema: z.ZodObject<{
|
|
47
|
-
estimateId: z.ZodString;
|
|
48
|
-
showMaterialCost: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
-
showLaborCost: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
-
showUnitPrice: z.ZodOptional<z.ZodBoolean>;
|
|
51
|
-
showQuantity: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
-
showNotes: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
-
headerText: z.ZodOptional<z.ZodString>;
|
|
54
|
-
footerText: z.ZodOptional<z.ZodString>;
|
|
55
|
-
template: z.ZodOptional<z.ZodString>;
|
|
56
|
-
}, "strip", z.ZodTypeAny, {
|
|
57
|
-
estimateId: string;
|
|
58
|
-
showMaterialCost?: boolean | undefined;
|
|
59
|
-
showLaborCost?: boolean | undefined;
|
|
60
|
-
showUnitPrice?: boolean | undefined;
|
|
61
|
-
showQuantity?: boolean | undefined;
|
|
62
|
-
showNotes?: boolean | undefined;
|
|
63
|
-
headerText?: string | undefined;
|
|
64
|
-
footerText?: string | undefined;
|
|
65
|
-
template?: string | undefined;
|
|
66
|
-
}, {
|
|
67
|
-
estimateId: string;
|
|
68
|
-
showMaterialCost?: boolean | undefined;
|
|
69
|
-
showLaborCost?: boolean | undefined;
|
|
70
|
-
showUnitPrice?: boolean | undefined;
|
|
71
|
-
showQuantity?: boolean | undefined;
|
|
72
|
-
showNotes?: boolean | undefined;
|
|
73
|
-
headerText?: string | undefined;
|
|
74
|
-
footerText?: string | undefined;
|
|
75
|
-
template?: string | undefined;
|
|
76
|
-
}>;
|
|
77
|
-
export declare const updateOutputConfig: {
|
|
78
|
-
name: string;
|
|
79
|
-
description: string;
|
|
80
|
-
inputSchemaZod: z.ZodObject<{
|
|
81
|
-
estimateId: z.ZodString;
|
|
82
|
-
showMaterialCost: z.ZodOptional<z.ZodBoolean>;
|
|
83
|
-
showLaborCost: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
-
showUnitPrice: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
-
showQuantity: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
-
showNotes: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
-
headerText: z.ZodOptional<z.ZodString>;
|
|
88
|
-
footerText: z.ZodOptional<z.ZodString>;
|
|
89
|
-
template: z.ZodOptional<z.ZodString>;
|
|
90
|
-
}, "strip", z.ZodTypeAny, {
|
|
91
|
-
estimateId: string;
|
|
92
|
-
showMaterialCost?: boolean | undefined;
|
|
93
|
-
showLaborCost?: boolean | undefined;
|
|
94
|
-
showUnitPrice?: boolean | undefined;
|
|
95
|
-
showQuantity?: boolean | undefined;
|
|
96
|
-
showNotes?: boolean | undefined;
|
|
97
|
-
headerText?: string | undefined;
|
|
98
|
-
footerText?: string | undefined;
|
|
99
|
-
template?: string | undefined;
|
|
100
|
-
}, {
|
|
101
|
-
estimateId: string;
|
|
102
|
-
showMaterialCost?: boolean | undefined;
|
|
103
|
-
showLaborCost?: boolean | undefined;
|
|
104
|
-
showUnitPrice?: boolean | undefined;
|
|
105
|
-
showQuantity?: boolean | undefined;
|
|
106
|
-
showNotes?: boolean | undefined;
|
|
107
|
-
headerText?: string | undefined;
|
|
108
|
-
footerText?: string | undefined;
|
|
109
|
-
template?: string | undefined;
|
|
110
|
-
}>;
|
|
111
|
-
execute: (args: z.infer<typeof updateOutputConfigSchema>) => Promise<string>;
|
|
112
|
-
};
|
|
113
|
-
export {};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import * as client from "../lib/kynver-client.js";
|
|
3
|
-
// --- estimator_get_stats ---
|
|
4
|
-
const getStatsSchema = z.object({
|
|
5
|
-
from: z.string().optional(),
|
|
6
|
-
to: z.string().optional(),
|
|
7
|
-
});
|
|
8
|
-
export const getStats = {
|
|
9
|
-
name: "estimator_get_stats",
|
|
10
|
-
description: "Get aggregate statistics for the user's estimating business. Returns: total estimates count, estimates by status, total revenue (accepted estimates), average estimate value, estimates by type (replacement vs repair). Optionally filter by date range (from/to as ISO strings). Use this for dashboard data and business reporting.",
|
|
11
|
-
inputSchemaZod: getStatsSchema,
|
|
12
|
-
execute: async (args) => {
|
|
13
|
-
if (!client.hasApiKey())
|
|
14
|
-
return client.noApiKeyMessage();
|
|
15
|
-
const params = new URLSearchParams();
|
|
16
|
-
if (args.from)
|
|
17
|
-
params.set("from", args.from);
|
|
18
|
-
if (args.to)
|
|
19
|
-
params.set("to", args.to);
|
|
20
|
-
const q = params.toString();
|
|
21
|
-
const path = q ? `/estimator/stats?${q}` : "/estimator/stats";
|
|
22
|
-
const data = await client.get(path);
|
|
23
|
-
return JSON.stringify(data);
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
// --- estimator_export_pdf ---
|
|
27
|
-
const exportPdfSchema = z.object({
|
|
28
|
-
estimateId: z.string(),
|
|
29
|
-
});
|
|
30
|
-
export const exportPdf = {
|
|
31
|
-
name: "estimator_export_pdf",
|
|
32
|
-
description: "Generate a PDF document for an estimate. Returns a download URL (not the binary file). The PDF layout is controlled by the estimate's output config — use estimator_update_output_config to customize which columns, sections, and details appear. The PDF includes company branding from estimator config.",
|
|
33
|
-
inputSchemaZod: exportPdfSchema,
|
|
34
|
-
execute: async (args) => {
|
|
35
|
-
if (!client.hasApiKey())
|
|
36
|
-
return client.noApiKeyMessage();
|
|
37
|
-
// Trigger PDF generation on the server side
|
|
38
|
-
try {
|
|
39
|
-
await client.get(`/estimator/estimates/${args.estimateId}/pdf`);
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
// Even if the binary response fails to parse, the PDF was generated
|
|
43
|
-
}
|
|
44
|
-
return JSON.stringify({
|
|
45
|
-
message: "PDF generated successfully.",
|
|
46
|
-
downloadUrl: `/api/estimator/estimates/${args.estimateId}/pdf`,
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
// --- estimator_update_output_config ---
|
|
51
|
-
const updateOutputConfigSchema = z.object({
|
|
52
|
-
estimateId: z.string(),
|
|
53
|
-
showMaterialCost: z.boolean().optional(),
|
|
54
|
-
showLaborCost: z.boolean().optional(),
|
|
55
|
-
showUnitPrice: z.boolean().optional(),
|
|
56
|
-
showQuantity: z.boolean().optional(),
|
|
57
|
-
showNotes: z.boolean().optional(),
|
|
58
|
-
headerText: z.string().optional(),
|
|
59
|
-
footerText: z.string().optional(),
|
|
60
|
-
template: z.string().optional(),
|
|
61
|
-
});
|
|
62
|
-
export const updateOutputConfig = {
|
|
63
|
-
name: "estimator_update_output_config",
|
|
64
|
-
description: "Configure what appears in an estimate's PDF output. Toggle visibility of: material costs, labor costs, unit prices, quantities, line item notes. Set custom header/footer text. Choose a template style. This controls the presentation layer — the underlying estimate data is not changed.",
|
|
65
|
-
inputSchemaZod: updateOutputConfigSchema,
|
|
66
|
-
execute: async (args) => {
|
|
67
|
-
if (!client.hasApiKey())
|
|
68
|
-
return client.noApiKeyMessage();
|
|
69
|
-
const { estimateId, ...body } = args;
|
|
70
|
-
const data = await client.patch(`/estimator/estimates/${estimateId}/output-config`, body);
|
|
71
|
-
return JSON.stringify(data);
|
|
72
|
-
},
|
|
73
|
-
};
|