@kynver-app/mcp-estimator 0.1.1
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 +7 -0
- package/dist/index.js +11 -0
- package/dist/lib/kynver-client.d.ts +20 -0
- package/dist/lib/kynver-client.js +110 -0
- package/dist/lib/mcp-sse-server.d.ts +29 -0
- package/dist/lib/mcp-sse-server.js +191 -0
- package/dist/server.d.ts +6 -0
- package/dist/server.js +78 -0
- package/dist/sse.d.ts +1 -0
- package/dist/sse.js +9 -0
- package/dist/tools/catalog-tools.d.ts +387 -0
- package/dist/tools/catalog-tools.js +193 -0
- package/dist/tools/client-tools.d.ts +193 -0
- package/dist/tools/client-tools.js +105 -0
- package/dist/tools/company-tools.d.ts +163 -0
- package/dist/tools/company-tools.js +98 -0
- package/dist/tools/create-estimate.d.ts +107 -0
- package/dist/tools/create-estimate.js +64 -0
- package/dist/tools/estimate-tools.d.ts +531 -0
- package/dist/tools/estimate-tools.js +259 -0
- package/dist/tools/estimator-chat.d.ts +25 -0
- package/dist/tools/estimator-chat.js +15 -0
- package/dist/tools/get-estimate.d.ts +19 -0
- package/dist/tools/get-estimate.js +14 -0
- package/dist/tools/list-catalog.d.ts +25 -0
- package/dist/tools/list-catalog.js +22 -0
- package/dist/tools/photo-tools.d.ts +77 -0
- package/dist/tools/photo-tools.js +51 -0
- package/dist/tools/stats-pdf-tools.d.ts +113 -0
- package/dist/tools/stats-pdf-tools.js +73 -0
- package/dist/tools/template-tools.d.ts +96 -0
- package/dist/tools/template-tools.js +70 -0
- package/dist/tools/version-tools.d.ts +46 -0
- package/dist/tools/version-tools.js +33 -0
- package/dist/tools/vision-tools.d.ts +52 -0
- package/dist/tools/vision-tools.js +42 -0
- package/package.json +27 -0
- package/src/index.ts +13 -0
- package/src/lib/kynver-client.ts +136 -0
- package/src/lib/mcp-sse-server.ts +249 -0
- package/src/server.ts +101 -0
- package/src/sse.ts +10 -0
- package/src/tools/catalog-tools.ts +217 -0
- package/src/tools/client-tools.ts +114 -0
- package/src/tools/company-tools.ts +108 -0
- package/src/tools/estimate-tools.ts +281 -0
- package/src/tools/photo-tools.ts +60 -0
- package/src/tools/stats-pdf-tools.ts +80 -0
- package/src/tools/template-tools.ts +80 -0
- package/src/tools/version-tools.ts +39 -0
- package/src/tools/vision-tools.ts +48 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const createClientSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
5
|
+
title: z.ZodOptional<z.ZodString>;
|
|
6
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
7
|
+
email: z.ZodOptional<z.ZodString>;
|
|
8
|
+
address: z.ZodOptional<z.ZodString>;
|
|
9
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
name: string;
|
|
12
|
+
notes?: string | undefined;
|
|
13
|
+
companyId?: string | undefined;
|
|
14
|
+
phone?: string | undefined;
|
|
15
|
+
email?: string | undefined;
|
|
16
|
+
address?: string | undefined;
|
|
17
|
+
title?: string | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
name: string;
|
|
20
|
+
notes?: string | undefined;
|
|
21
|
+
companyId?: string | undefined;
|
|
22
|
+
phone?: string | undefined;
|
|
23
|
+
email?: string | undefined;
|
|
24
|
+
address?: string | undefined;
|
|
25
|
+
title?: string | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const createClient: {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
inputSchemaZod: z.ZodObject<{
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
33
|
+
title: z.ZodOptional<z.ZodString>;
|
|
34
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
35
|
+
email: z.ZodOptional<z.ZodString>;
|
|
36
|
+
address: z.ZodOptional<z.ZodString>;
|
|
37
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
name: string;
|
|
40
|
+
notes?: string | undefined;
|
|
41
|
+
companyId?: string | undefined;
|
|
42
|
+
phone?: string | undefined;
|
|
43
|
+
email?: string | undefined;
|
|
44
|
+
address?: string | undefined;
|
|
45
|
+
title?: string | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
name: string;
|
|
48
|
+
notes?: string | undefined;
|
|
49
|
+
companyId?: string | undefined;
|
|
50
|
+
phone?: string | undefined;
|
|
51
|
+
email?: string | undefined;
|
|
52
|
+
address?: string | undefined;
|
|
53
|
+
title?: string | undefined;
|
|
54
|
+
}>;
|
|
55
|
+
execute: (args: z.infer<typeof createClientSchema>) => Promise<string>;
|
|
56
|
+
};
|
|
57
|
+
declare const listClientsSchema: z.ZodObject<{
|
|
58
|
+
search: z.ZodOptional<z.ZodString>;
|
|
59
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
60
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
|
+
limit?: number | undefined;
|
|
64
|
+
cursor?: string | undefined;
|
|
65
|
+
companyId?: string | undefined;
|
|
66
|
+
search?: string | undefined;
|
|
67
|
+
}, {
|
|
68
|
+
limit?: number | undefined;
|
|
69
|
+
cursor?: string | undefined;
|
|
70
|
+
companyId?: string | undefined;
|
|
71
|
+
search?: string | undefined;
|
|
72
|
+
}>;
|
|
73
|
+
export declare const listClients: {
|
|
74
|
+
name: string;
|
|
75
|
+
description: string;
|
|
76
|
+
inputSchemaZod: z.ZodObject<{
|
|
77
|
+
search: z.ZodOptional<z.ZodString>;
|
|
78
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
79
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
limit?: number | undefined;
|
|
83
|
+
cursor?: string | undefined;
|
|
84
|
+
companyId?: string | undefined;
|
|
85
|
+
search?: string | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
limit?: number | undefined;
|
|
88
|
+
cursor?: string | undefined;
|
|
89
|
+
companyId?: string | undefined;
|
|
90
|
+
search?: string | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
execute: (args: z.infer<typeof listClientsSchema>) => Promise<string>;
|
|
93
|
+
};
|
|
94
|
+
declare const getClientSchema: z.ZodObject<{
|
|
95
|
+
clientId: z.ZodString;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
clientId: string;
|
|
98
|
+
}, {
|
|
99
|
+
clientId: string;
|
|
100
|
+
}>;
|
|
101
|
+
export declare const getClient: {
|
|
102
|
+
name: string;
|
|
103
|
+
description: string;
|
|
104
|
+
inputSchemaZod: z.ZodObject<{
|
|
105
|
+
clientId: z.ZodString;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
clientId: string;
|
|
108
|
+
}, {
|
|
109
|
+
clientId: string;
|
|
110
|
+
}>;
|
|
111
|
+
execute: (args: z.infer<typeof getClientSchema>) => Promise<string>;
|
|
112
|
+
};
|
|
113
|
+
declare const updateClientSchema: z.ZodObject<{
|
|
114
|
+
clientId: z.ZodString;
|
|
115
|
+
name: z.ZodOptional<z.ZodString>;
|
|
116
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
117
|
+
title: z.ZodOptional<z.ZodString>;
|
|
118
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
119
|
+
email: z.ZodOptional<z.ZodString>;
|
|
120
|
+
address: z.ZodOptional<z.ZodString>;
|
|
121
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
clientId: string;
|
|
124
|
+
name?: string | undefined;
|
|
125
|
+
notes?: string | undefined;
|
|
126
|
+
companyId?: string | undefined;
|
|
127
|
+
phone?: string | undefined;
|
|
128
|
+
email?: string | undefined;
|
|
129
|
+
address?: string | undefined;
|
|
130
|
+
title?: string | undefined;
|
|
131
|
+
}, {
|
|
132
|
+
clientId: string;
|
|
133
|
+
name?: string | undefined;
|
|
134
|
+
notes?: string | undefined;
|
|
135
|
+
companyId?: string | undefined;
|
|
136
|
+
phone?: string | undefined;
|
|
137
|
+
email?: string | undefined;
|
|
138
|
+
address?: string | undefined;
|
|
139
|
+
title?: string | undefined;
|
|
140
|
+
}>;
|
|
141
|
+
export declare const updateClient: {
|
|
142
|
+
name: string;
|
|
143
|
+
description: string;
|
|
144
|
+
inputSchemaZod: z.ZodObject<{
|
|
145
|
+
clientId: z.ZodString;
|
|
146
|
+
name: z.ZodOptional<z.ZodString>;
|
|
147
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
148
|
+
title: z.ZodOptional<z.ZodString>;
|
|
149
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
150
|
+
email: z.ZodOptional<z.ZodString>;
|
|
151
|
+
address: z.ZodOptional<z.ZodString>;
|
|
152
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, "strip", z.ZodTypeAny, {
|
|
154
|
+
clientId: string;
|
|
155
|
+
name?: string | undefined;
|
|
156
|
+
notes?: string | undefined;
|
|
157
|
+
companyId?: string | undefined;
|
|
158
|
+
phone?: string | undefined;
|
|
159
|
+
email?: string | undefined;
|
|
160
|
+
address?: string | undefined;
|
|
161
|
+
title?: string | undefined;
|
|
162
|
+
}, {
|
|
163
|
+
clientId: string;
|
|
164
|
+
name?: string | undefined;
|
|
165
|
+
notes?: string | undefined;
|
|
166
|
+
companyId?: string | undefined;
|
|
167
|
+
phone?: string | undefined;
|
|
168
|
+
email?: string | undefined;
|
|
169
|
+
address?: string | undefined;
|
|
170
|
+
title?: string | undefined;
|
|
171
|
+
}>;
|
|
172
|
+
execute: (args: z.infer<typeof updateClientSchema>) => Promise<string>;
|
|
173
|
+
};
|
|
174
|
+
declare const deleteClientSchema: z.ZodObject<{
|
|
175
|
+
clientId: z.ZodString;
|
|
176
|
+
}, "strip", z.ZodTypeAny, {
|
|
177
|
+
clientId: string;
|
|
178
|
+
}, {
|
|
179
|
+
clientId: string;
|
|
180
|
+
}>;
|
|
181
|
+
export declare const deleteClient: {
|
|
182
|
+
name: string;
|
|
183
|
+
description: string;
|
|
184
|
+
inputSchemaZod: z.ZodObject<{
|
|
185
|
+
clientId: z.ZodString;
|
|
186
|
+
}, "strip", z.ZodTypeAny, {
|
|
187
|
+
clientId: string;
|
|
188
|
+
}, {
|
|
189
|
+
clientId: string;
|
|
190
|
+
}>;
|
|
191
|
+
execute: (args: z.infer<typeof deleteClientSchema>) => Promise<string>;
|
|
192
|
+
};
|
|
193
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as client from "../lib/kynver-client.js";
|
|
3
|
+
// --- estimator_create_client ---
|
|
4
|
+
const createClientSchema = z.object({
|
|
5
|
+
name: z.string(),
|
|
6
|
+
companyId: z.string().optional(),
|
|
7
|
+
title: z.string().optional(),
|
|
8
|
+
phone: z.string().optional(),
|
|
9
|
+
email: z.string().optional(),
|
|
10
|
+
address: z.string().optional(),
|
|
11
|
+
notes: z.string().optional(),
|
|
12
|
+
});
|
|
13
|
+
export const createClient = {
|
|
14
|
+
name: "estimator_create_client",
|
|
15
|
+
description: "Create a new client (individual person) in the client book. Clients can optionally belong to a company (pass companyId). Include contact details: name (required), title, phone, email, address, and notes. The client can then be linked to estimates via their clientId.",
|
|
16
|
+
inputSchemaZod: createClientSchema,
|
|
17
|
+
execute: async (args) => {
|
|
18
|
+
if (!client.hasApiKey())
|
|
19
|
+
return client.noApiKeyMessage();
|
|
20
|
+
const data = await client.post("/estimator/clients", args);
|
|
21
|
+
return JSON.stringify(data);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
// --- estimator_list_clients ---
|
|
25
|
+
const listClientsSchema = z.object({
|
|
26
|
+
search: z.string().optional(),
|
|
27
|
+
companyId: z.string().optional(),
|
|
28
|
+
limit: z.number().optional(),
|
|
29
|
+
cursor: z.string().optional(),
|
|
30
|
+
});
|
|
31
|
+
export const listClients = {
|
|
32
|
+
name: "estimator_list_clients",
|
|
33
|
+
description: "Search and list clients in the client book. Use the search param to find clients by name, phone, or email. Filter by companyId to see all contacts at a specific company. Returns client details with linked company info. Always search here before creating a new client to avoid duplicates.",
|
|
34
|
+
inputSchemaZod: listClientsSchema,
|
|
35
|
+
execute: async (args) => {
|
|
36
|
+
if (!client.hasApiKey())
|
|
37
|
+
return client.noApiKeyMessage();
|
|
38
|
+
const params = new URLSearchParams();
|
|
39
|
+
if (args.search)
|
|
40
|
+
params.set("search", args.search);
|
|
41
|
+
if (args.companyId)
|
|
42
|
+
params.set("companyId", args.companyId);
|
|
43
|
+
if (args.limit != null)
|
|
44
|
+
params.set("limit", String(args.limit));
|
|
45
|
+
if (args.cursor)
|
|
46
|
+
params.set("cursor", args.cursor);
|
|
47
|
+
const q = params.toString();
|
|
48
|
+
const path = q ? `/estimator/clients?${q}` : "/estimator/clients";
|
|
49
|
+
const data = await client.get(path);
|
|
50
|
+
return JSON.stringify(data);
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
// --- estimator_get_client ---
|
|
54
|
+
const getClientSchema = z.object({
|
|
55
|
+
clientId: z.string(),
|
|
56
|
+
});
|
|
57
|
+
export const getClient = {
|
|
58
|
+
name: "estimator_get_client",
|
|
59
|
+
description: "Get a specific client's full details including their company info and a summary of linked estimates (recent 10). Use this to see a client's estimate history before creating new ones.",
|
|
60
|
+
inputSchemaZod: getClientSchema,
|
|
61
|
+
execute: async (args) => {
|
|
62
|
+
if (!client.hasApiKey())
|
|
63
|
+
return client.noApiKeyMessage();
|
|
64
|
+
const data = await client.get(`/estimator/clients/${args.clientId}`);
|
|
65
|
+
return JSON.stringify(data);
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
// --- estimator_update_client ---
|
|
69
|
+
const updateClientSchema = z.object({
|
|
70
|
+
clientId: z.string(),
|
|
71
|
+
name: z.string().optional(),
|
|
72
|
+
companyId: z.string().optional(),
|
|
73
|
+
title: z.string().optional(),
|
|
74
|
+
phone: z.string().optional(),
|
|
75
|
+
email: z.string().optional(),
|
|
76
|
+
address: z.string().optional(),
|
|
77
|
+
notes: z.string().optional(),
|
|
78
|
+
});
|
|
79
|
+
export const updateClient = {
|
|
80
|
+
name: "estimator_update_client",
|
|
81
|
+
description: "Update a client's contact details. Pass the clientId and any fields to change: name, title, phone, email, address, notes, or companyId (to move them to a different company).",
|
|
82
|
+
inputSchemaZod: updateClientSchema,
|
|
83
|
+
execute: async (args) => {
|
|
84
|
+
if (!client.hasApiKey())
|
|
85
|
+
return client.noApiKeyMessage();
|
|
86
|
+
const { clientId, ...body } = args;
|
|
87
|
+
const data = await client.patch(`/estimator/clients/${clientId}`, body);
|
|
88
|
+
return JSON.stringify(data);
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
// --- estimator_delete_client ---
|
|
92
|
+
const deleteClientSchema = z.object({
|
|
93
|
+
clientId: z.string(),
|
|
94
|
+
});
|
|
95
|
+
export const deleteClient = {
|
|
96
|
+
name: "estimator_delete_client",
|
|
97
|
+
description: "Soft-delete a client from the client book. The client's data is preserved but hidden from searches. Existing estimates linked to this client are not affected.",
|
|
98
|
+
inputSchemaZod: deleteClientSchema,
|
|
99
|
+
execute: async (args) => {
|
|
100
|
+
if (!client.hasApiKey())
|
|
101
|
+
return client.noApiKeyMessage();
|
|
102
|
+
const data = await client.del(`/estimator/clients/${args.clientId}`);
|
|
103
|
+
return JSON.stringify(data);
|
|
104
|
+
},
|
|
105
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const createCompanySchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
5
|
+
email: z.ZodOptional<z.ZodString>;
|
|
6
|
+
address: z.ZodOptional<z.ZodString>;
|
|
7
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
name: string;
|
|
10
|
+
notes?: string | undefined;
|
|
11
|
+
phone?: string | undefined;
|
|
12
|
+
email?: string | undefined;
|
|
13
|
+
address?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
name: string;
|
|
16
|
+
notes?: string | undefined;
|
|
17
|
+
phone?: string | undefined;
|
|
18
|
+
email?: string | undefined;
|
|
19
|
+
address?: string | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const createCompany: {
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
inputSchemaZod: z.ZodObject<{
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
27
|
+
email: z.ZodOptional<z.ZodString>;
|
|
28
|
+
address: z.ZodOptional<z.ZodString>;
|
|
29
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
name: string;
|
|
32
|
+
notes?: string | undefined;
|
|
33
|
+
phone?: string | undefined;
|
|
34
|
+
email?: string | undefined;
|
|
35
|
+
address?: string | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
name: string;
|
|
38
|
+
notes?: string | undefined;
|
|
39
|
+
phone?: string | undefined;
|
|
40
|
+
email?: string | undefined;
|
|
41
|
+
address?: string | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
execute: (args: z.infer<typeof createCompanySchema>) => Promise<string>;
|
|
44
|
+
};
|
|
45
|
+
declare const listCompaniesSchema: z.ZodObject<{
|
|
46
|
+
search: z.ZodOptional<z.ZodString>;
|
|
47
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
limit?: number | undefined;
|
|
51
|
+
cursor?: string | undefined;
|
|
52
|
+
search?: string | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
limit?: number | undefined;
|
|
55
|
+
cursor?: string | undefined;
|
|
56
|
+
search?: string | undefined;
|
|
57
|
+
}>;
|
|
58
|
+
export declare const listCompanies: {
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
inputSchemaZod: z.ZodObject<{
|
|
62
|
+
search: z.ZodOptional<z.ZodString>;
|
|
63
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
limit?: number | undefined;
|
|
67
|
+
cursor?: string | undefined;
|
|
68
|
+
search?: string | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
limit?: number | undefined;
|
|
71
|
+
cursor?: string | undefined;
|
|
72
|
+
search?: string | undefined;
|
|
73
|
+
}>;
|
|
74
|
+
execute: (args: z.infer<typeof listCompaniesSchema>) => Promise<string>;
|
|
75
|
+
};
|
|
76
|
+
declare const getCompanySchema: z.ZodObject<{
|
|
77
|
+
companyId: z.ZodString;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
companyId: string;
|
|
80
|
+
}, {
|
|
81
|
+
companyId: string;
|
|
82
|
+
}>;
|
|
83
|
+
export declare const getCompany: {
|
|
84
|
+
name: string;
|
|
85
|
+
description: string;
|
|
86
|
+
inputSchemaZod: z.ZodObject<{
|
|
87
|
+
companyId: z.ZodString;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
companyId: string;
|
|
90
|
+
}, {
|
|
91
|
+
companyId: string;
|
|
92
|
+
}>;
|
|
93
|
+
execute: (args: z.infer<typeof getCompanySchema>) => Promise<string>;
|
|
94
|
+
};
|
|
95
|
+
declare const updateCompanySchema: z.ZodObject<{
|
|
96
|
+
companyId: z.ZodString;
|
|
97
|
+
name: z.ZodOptional<z.ZodString>;
|
|
98
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
99
|
+
email: z.ZodOptional<z.ZodString>;
|
|
100
|
+
address: z.ZodOptional<z.ZodString>;
|
|
101
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
companyId: string;
|
|
104
|
+
name?: string | undefined;
|
|
105
|
+
notes?: string | undefined;
|
|
106
|
+
phone?: string | undefined;
|
|
107
|
+
email?: string | undefined;
|
|
108
|
+
address?: string | undefined;
|
|
109
|
+
}, {
|
|
110
|
+
companyId: string;
|
|
111
|
+
name?: string | undefined;
|
|
112
|
+
notes?: string | undefined;
|
|
113
|
+
phone?: string | undefined;
|
|
114
|
+
email?: string | undefined;
|
|
115
|
+
address?: string | undefined;
|
|
116
|
+
}>;
|
|
117
|
+
export declare const updateCompany: {
|
|
118
|
+
name: string;
|
|
119
|
+
description: string;
|
|
120
|
+
inputSchemaZod: z.ZodObject<{
|
|
121
|
+
companyId: z.ZodString;
|
|
122
|
+
name: z.ZodOptional<z.ZodString>;
|
|
123
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
124
|
+
email: z.ZodOptional<z.ZodString>;
|
|
125
|
+
address: z.ZodOptional<z.ZodString>;
|
|
126
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, "strip", z.ZodTypeAny, {
|
|
128
|
+
companyId: string;
|
|
129
|
+
name?: string | undefined;
|
|
130
|
+
notes?: string | undefined;
|
|
131
|
+
phone?: string | undefined;
|
|
132
|
+
email?: string | undefined;
|
|
133
|
+
address?: string | undefined;
|
|
134
|
+
}, {
|
|
135
|
+
companyId: string;
|
|
136
|
+
name?: string | undefined;
|
|
137
|
+
notes?: string | undefined;
|
|
138
|
+
phone?: string | undefined;
|
|
139
|
+
email?: string | undefined;
|
|
140
|
+
address?: string | undefined;
|
|
141
|
+
}>;
|
|
142
|
+
execute: (args: z.infer<typeof updateCompanySchema>) => Promise<string>;
|
|
143
|
+
};
|
|
144
|
+
declare const deleteCompanySchema: z.ZodObject<{
|
|
145
|
+
companyId: z.ZodString;
|
|
146
|
+
}, "strip", z.ZodTypeAny, {
|
|
147
|
+
companyId: string;
|
|
148
|
+
}, {
|
|
149
|
+
companyId: string;
|
|
150
|
+
}>;
|
|
151
|
+
export declare const deleteCompany: {
|
|
152
|
+
name: string;
|
|
153
|
+
description: string;
|
|
154
|
+
inputSchemaZod: z.ZodObject<{
|
|
155
|
+
companyId: z.ZodString;
|
|
156
|
+
}, "strip", z.ZodTypeAny, {
|
|
157
|
+
companyId: string;
|
|
158
|
+
}, {
|
|
159
|
+
companyId: string;
|
|
160
|
+
}>;
|
|
161
|
+
execute: (args: z.infer<typeof deleteCompanySchema>) => Promise<string>;
|
|
162
|
+
};
|
|
163
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as client from "../lib/kynver-client.js";
|
|
3
|
+
// --- estimator_create_company ---
|
|
4
|
+
const createCompanySchema = z.object({
|
|
5
|
+
name: z.string(),
|
|
6
|
+
phone: z.string().optional(),
|
|
7
|
+
email: z.string().optional(),
|
|
8
|
+
address: z.string().optional(),
|
|
9
|
+
notes: z.string().optional(),
|
|
10
|
+
});
|
|
11
|
+
export const createCompany = {
|
|
12
|
+
name: "estimator_create_company",
|
|
13
|
+
description: "Create a new company in the client book. Companies group clients (contacts) together. Include: name (required), phone, email, address, and notes. After creating, you can add clients to the company using estimator_create_client with the companyId.",
|
|
14
|
+
inputSchemaZod: createCompanySchema,
|
|
15
|
+
execute: async (args) => {
|
|
16
|
+
if (!client.hasApiKey())
|
|
17
|
+
return client.noApiKeyMessage();
|
|
18
|
+
const data = await client.post("/estimator/companies", args);
|
|
19
|
+
return JSON.stringify(data);
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
// --- estimator_list_companies ---
|
|
23
|
+
const listCompaniesSchema = z.object({
|
|
24
|
+
search: z.string().optional(),
|
|
25
|
+
limit: z.number().optional(),
|
|
26
|
+
cursor: z.string().optional(),
|
|
27
|
+
});
|
|
28
|
+
export const listCompanies = {
|
|
29
|
+
name: "estimator_list_companies",
|
|
30
|
+
description: "Search and list companies in the client book. Use the search param to find companies by name. Returns company details with a count of contacts and estimates. Always search here before creating a new company to avoid duplicates.",
|
|
31
|
+
inputSchemaZod: listCompaniesSchema,
|
|
32
|
+
execute: async (args) => {
|
|
33
|
+
if (!client.hasApiKey())
|
|
34
|
+
return client.noApiKeyMessage();
|
|
35
|
+
const params = new URLSearchParams();
|
|
36
|
+
if (args.search)
|
|
37
|
+
params.set("search", args.search);
|
|
38
|
+
if (args.limit != null)
|
|
39
|
+
params.set("limit", String(args.limit));
|
|
40
|
+
if (args.cursor)
|
|
41
|
+
params.set("cursor", args.cursor);
|
|
42
|
+
const q = params.toString();
|
|
43
|
+
const path = q ? `/estimator/companies?${q}` : "/estimator/companies";
|
|
44
|
+
const data = await client.get(path);
|
|
45
|
+
return JSON.stringify(data);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
// --- estimator_get_company ---
|
|
49
|
+
const getCompanySchema = z.object({
|
|
50
|
+
companyId: z.string(),
|
|
51
|
+
});
|
|
52
|
+
export const getCompany = {
|
|
53
|
+
name: "estimator_get_company",
|
|
54
|
+
description: "Get a specific company's full details including all its client contacts and a summary of linked estimates.",
|
|
55
|
+
inputSchemaZod: getCompanySchema,
|
|
56
|
+
execute: async (args) => {
|
|
57
|
+
if (!client.hasApiKey())
|
|
58
|
+
return client.noApiKeyMessage();
|
|
59
|
+
const data = await client.get(`/estimator/companies/${args.companyId}`);
|
|
60
|
+
return JSON.stringify(data);
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
// --- estimator_update_company ---
|
|
64
|
+
const updateCompanySchema = z.object({
|
|
65
|
+
companyId: z.string(),
|
|
66
|
+
name: z.string().optional(),
|
|
67
|
+
phone: z.string().optional(),
|
|
68
|
+
email: z.string().optional(),
|
|
69
|
+
address: z.string().optional(),
|
|
70
|
+
notes: z.string().optional(),
|
|
71
|
+
});
|
|
72
|
+
export const updateCompany = {
|
|
73
|
+
name: "estimator_update_company",
|
|
74
|
+
description: "Update a company's details. Pass the companyId and any fields to change: name, phone, email, address, or notes.",
|
|
75
|
+
inputSchemaZod: updateCompanySchema,
|
|
76
|
+
execute: async (args) => {
|
|
77
|
+
if (!client.hasApiKey())
|
|
78
|
+
return client.noApiKeyMessage();
|
|
79
|
+
const { companyId, ...body } = args;
|
|
80
|
+
const data = await client.patch(`/estimator/companies/${companyId}`, body);
|
|
81
|
+
return JSON.stringify(data);
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
// --- estimator_delete_company ---
|
|
85
|
+
const deleteCompanySchema = z.object({
|
|
86
|
+
companyId: z.string(),
|
|
87
|
+
});
|
|
88
|
+
export const deleteCompany = {
|
|
89
|
+
name: "estimator_delete_company",
|
|
90
|
+
description: "Soft-delete a company from the client book. The company's data is preserved but hidden. Clients belonging to this company are NOT deleted — they become unlinked.",
|
|
91
|
+
inputSchemaZod: deleteCompanySchema,
|
|
92
|
+
execute: async (args) => {
|
|
93
|
+
if (!client.hasApiKey())
|
|
94
|
+
return client.noApiKeyMessage();
|
|
95
|
+
const data = await client.del(`/estimator/companies/${args.companyId}`);
|
|
96
|
+
return JSON.stringify(data);
|
|
97
|
+
},
|
|
98
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const inputSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodEnum<["replacement", "repair_service"]>;
|
|
4
|
+
projectName: z.ZodString;
|
|
5
|
+
roofMaterial: z.ZodOptional<z.ZodString>;
|
|
6
|
+
footprintSqFt: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
pitch: z.ZodOptional<z.ZodString>;
|
|
8
|
+
layers: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
ridgeLengthFt: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
eavesFt: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
lineItems: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12
|
+
serviceCode: z.ZodString;
|
|
13
|
+
materialType: z.ZodOptional<z.ZodString>;
|
|
14
|
+
quantity: z.ZodNumber;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
serviceCode: string;
|
|
17
|
+
quantity: number;
|
|
18
|
+
materialType?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
serviceCode: string;
|
|
21
|
+
quantity: number;
|
|
22
|
+
materialType?: string | undefined;
|
|
23
|
+
}>, "many">>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
type: "replacement" | "repair_service";
|
|
26
|
+
projectName: string;
|
|
27
|
+
roofMaterial?: string | undefined;
|
|
28
|
+
footprintSqFt?: number | undefined;
|
|
29
|
+
pitch?: string | undefined;
|
|
30
|
+
layers?: number | undefined;
|
|
31
|
+
ridgeLengthFt?: number | undefined;
|
|
32
|
+
eavesFt?: number | undefined;
|
|
33
|
+
lineItems?: {
|
|
34
|
+
serviceCode: string;
|
|
35
|
+
quantity: number;
|
|
36
|
+
materialType?: string | undefined;
|
|
37
|
+
}[] | undefined;
|
|
38
|
+
}, {
|
|
39
|
+
type: "replacement" | "repair_service";
|
|
40
|
+
projectName: string;
|
|
41
|
+
roofMaterial?: string | undefined;
|
|
42
|
+
footprintSqFt?: number | undefined;
|
|
43
|
+
pitch?: string | undefined;
|
|
44
|
+
layers?: number | undefined;
|
|
45
|
+
ridgeLengthFt?: number | undefined;
|
|
46
|
+
eavesFt?: number | undefined;
|
|
47
|
+
lineItems?: {
|
|
48
|
+
serviceCode: string;
|
|
49
|
+
quantity: number;
|
|
50
|
+
materialType?: string | undefined;
|
|
51
|
+
}[] | undefined;
|
|
52
|
+
}>;
|
|
53
|
+
export declare const name = "estimator_create_estimate";
|
|
54
|
+
export declare const description = "Create a roofing estimate. For replacement: provide dimensions and material. For repair: provide service items with quantities.";
|
|
55
|
+
export declare const inputSchemaZod: z.ZodObject<{
|
|
56
|
+
type: z.ZodEnum<["replacement", "repair_service"]>;
|
|
57
|
+
projectName: z.ZodString;
|
|
58
|
+
roofMaterial: z.ZodOptional<z.ZodString>;
|
|
59
|
+
footprintSqFt: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
pitch: z.ZodOptional<z.ZodString>;
|
|
61
|
+
layers: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
ridgeLengthFt: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
eavesFt: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
lineItems: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
65
|
+
serviceCode: z.ZodString;
|
|
66
|
+
materialType: z.ZodOptional<z.ZodString>;
|
|
67
|
+
quantity: z.ZodNumber;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
serviceCode: string;
|
|
70
|
+
quantity: number;
|
|
71
|
+
materialType?: string | undefined;
|
|
72
|
+
}, {
|
|
73
|
+
serviceCode: string;
|
|
74
|
+
quantity: number;
|
|
75
|
+
materialType?: string | undefined;
|
|
76
|
+
}>, "many">>;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
type: "replacement" | "repair_service";
|
|
79
|
+
projectName: string;
|
|
80
|
+
roofMaterial?: string | undefined;
|
|
81
|
+
footprintSqFt?: number | undefined;
|
|
82
|
+
pitch?: string | undefined;
|
|
83
|
+
layers?: number | undefined;
|
|
84
|
+
ridgeLengthFt?: number | undefined;
|
|
85
|
+
eavesFt?: number | undefined;
|
|
86
|
+
lineItems?: {
|
|
87
|
+
serviceCode: string;
|
|
88
|
+
quantity: number;
|
|
89
|
+
materialType?: string | undefined;
|
|
90
|
+
}[] | undefined;
|
|
91
|
+
}, {
|
|
92
|
+
type: "replacement" | "repair_service";
|
|
93
|
+
projectName: string;
|
|
94
|
+
roofMaterial?: string | undefined;
|
|
95
|
+
footprintSqFt?: number | undefined;
|
|
96
|
+
pitch?: string | undefined;
|
|
97
|
+
layers?: number | undefined;
|
|
98
|
+
ridgeLengthFt?: number | undefined;
|
|
99
|
+
eavesFt?: number | undefined;
|
|
100
|
+
lineItems?: {
|
|
101
|
+
serviceCode: string;
|
|
102
|
+
quantity: number;
|
|
103
|
+
materialType?: string | undefined;
|
|
104
|
+
}[] | undefined;
|
|
105
|
+
}>;
|
|
106
|
+
export declare function execute(args: z.infer<typeof inputSchema>): Promise<string>;
|
|
107
|
+
export {};
|