nexup-mcp-server 1.0.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.

Potentially problematic release.


This version of nexup-mcp-server might be problematic. Click here for more details.

Files changed (66) hide show
  1. package/README.md +41 -0
  2. package/dist/client/auth.d.ts +6 -0
  3. package/dist/client/auth.d.ts.map +1 -0
  4. package/dist/client/auth.js +14 -0
  5. package/dist/client/auth.js.map +1 -0
  6. package/dist/client/http-client.d.ts +33 -0
  7. package/dist/client/http-client.d.ts.map +1 -0
  8. package/dist/client/http-client.js +149 -0
  9. package/dist/client/http-client.js.map +1 -0
  10. package/dist/config.d.ts +7 -0
  11. package/dist/config.d.ts.map +1 -0
  12. package/dist/config.js +19 -0
  13. package/dist/config.js.map +1 -0
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +108 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/resources/crm-resources.d.ts +8 -0
  19. package/dist/resources/crm-resources.d.ts.map +1 -0
  20. package/dist/resources/crm-resources.js +501 -0
  21. package/dist/resources/crm-resources.js.map +1 -0
  22. package/dist/resources/index.d.ts +2 -0
  23. package/dist/resources/index.d.ts.map +1 -0
  24. package/dist/resources/index.js +2 -0
  25. package/dist/resources/index.js.map +1 -0
  26. package/dist/tools/customers.d.ts +221 -0
  27. package/dist/tools/customers.d.ts.map +1 -0
  28. package/dist/tools/customers.js +207 -0
  29. package/dist/tools/customers.js.map +1 -0
  30. package/dist/tools/index.d.ts +883 -0
  31. package/dist/tools/index.d.ts.map +1 -0
  32. package/dist/tools/index.js +38 -0
  33. package/dist/tools/index.js.map +1 -0
  34. package/dist/tools/notifications.d.ts +16 -0
  35. package/dist/tools/notifications.d.ts.map +1 -0
  36. package/dist/tools/notifications.js +47 -0
  37. package/dist/tools/notifications.js.map +1 -0
  38. package/dist/tools/prospects.d.ts +478 -0
  39. package/dist/tools/prospects.d.ts.map +1 -0
  40. package/dist/tools/prospects.js +336 -0
  41. package/dist/tools/prospects.js.map +1 -0
  42. package/dist/tools/tickets.d.ts +83 -0
  43. package/dist/tools/tickets.d.ts.map +1 -0
  44. package/dist/tools/tickets.js +171 -0
  45. package/dist/tools/tickets.js.map +1 -0
  46. package/dist/tools/transcripts.d.ts +97 -0
  47. package/dist/tools/transcripts.d.ts.map +1 -0
  48. package/dist/tools/transcripts.js +188 -0
  49. package/dist/tools/transcripts.js.map +1 -0
  50. package/dist/utils/errors.d.ts +9 -0
  51. package/dist/utils/errors.d.ts.map +1 -0
  52. package/dist/utils/errors.js +28 -0
  53. package/dist/utils/errors.js.map +1 -0
  54. package/dist/utils/formatters.d.ts +5 -0
  55. package/dist/utils/formatters.d.ts.map +1 -0
  56. package/dist/utils/formatters.js +21 -0
  57. package/dist/utils/formatters.js.map +1 -0
  58. package/dist/utils/logger.d.ts +4 -0
  59. package/dist/utils/logger.d.ts.map +1 -0
  60. package/dist/utils/logger.js +43 -0
  61. package/dist/utils/logger.js.map +1 -0
  62. package/dist/validation/schemas.d.ts +424 -0
  63. package/dist/validation/schemas.d.ts.map +1 -0
  64. package/dist/validation/schemas.js +114 -0
  65. package/dist/validation/schemas.js.map +1 -0
  66. package/package.json +34 -0
@@ -0,0 +1,336 @@
1
+ import { httpClient } from '../client/http-client.js';
2
+ import { logToolCall } from '../utils/logger.js';
3
+ import { formatError } from '../utils/errors.js';
4
+ import { createProspectSchema, updateProspectSchema, createContactSchema, recordTouchpointSchema, createProspectWithContactSchema, } from '../validation/schemas.js';
5
+ export const prospectTools = [
6
+ {
7
+ name: 'list_prospects',
8
+ description: 'List and search prospects (companies) in the CRM. Can filter by company name, status, priority, or owner.',
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ search: { type: 'string', description: 'Search by company name, industry, or contact name/email (optional)' },
13
+ status: { type: 'string', enum: ['new', 'contacted', 'qualified', 'interested', 'unresponsive', 'lost', 'converted'], description: 'Filter by status (optional)' },
14
+ priority: { type: 'string', enum: ['low', 'medium', 'high'], description: 'Filter by priority (optional)' },
15
+ owner: { type: 'string', description: 'Filter by owner (optional)' },
16
+ },
17
+ required: [],
18
+ },
19
+ },
20
+ {
21
+ name: 'create_prospect',
22
+ description: 'Create a new prospect company in the CRM. Requires user confirmation before execution.',
23
+ inputSchema: {
24
+ type: 'object',
25
+ properties: {
26
+ companyName: { type: 'string', description: 'Company name' },
27
+ address: { type: 'string', description: 'Company address (optional)' },
28
+ industry: { type: 'string', description: 'Industry (optional)' },
29
+ website: { type: 'string', description: 'Website URL (optional)' },
30
+ priority: { type: 'string', enum: ['low', 'medium', 'high'], description: 'Priority level' },
31
+ status: { type: 'string', enum: ['new', 'contacted', 'qualified', 'interested', 'unresponsive', 'lost', 'converted'], description: 'Prospect status' },
32
+ eventMetAt: { type: 'string', description: 'Event where prospect was met (optional)' },
33
+ nextAction: { type: 'string', description: 'Next action to take (optional)' },
34
+ nextActionDueDate: { type: 'string', description: 'Due date for next action (ISO format, optional)' },
35
+ owner: { type: 'string', description: 'Prospect owner/assignee (optional)' },
36
+ notes: { type: 'string', description: 'Additional notes (optional)' },
37
+ },
38
+ required: ['companyName'],
39
+ },
40
+ },
41
+ {
42
+ name: 'update_prospect',
43
+ description: 'Update an existing prospect company. Requires user confirmation before execution.',
44
+ inputSchema: {
45
+ type: 'object',
46
+ properties: {
47
+ prospectId: { type: 'string', description: 'Prospect ID to update' },
48
+ companyName: { type: 'string', description: 'Company name (optional)' },
49
+ address: { type: 'string', description: 'Company address (optional)' },
50
+ industry: { type: 'string', description: 'Industry (optional)' },
51
+ website: { type: 'string', description: 'Website URL (optional)' },
52
+ priority: { type: 'string', enum: ['low', 'medium', 'high'], description: 'Priority level (optional)' },
53
+ status: { type: 'string', enum: ['new', 'contacted', 'qualified', 'interested', 'unresponsive', 'lost', 'converted'], description: 'Prospect status (optional)' },
54
+ nextAction: { type: 'string', description: 'Next action to take (optional)' },
55
+ nextActionDueDate: { type: 'string', description: 'Due date for next action (ISO format, optional)' },
56
+ owner: { type: 'string', description: 'Prospect owner/assignee (optional)' },
57
+ notes: { type: 'string', description: 'Additional notes (optional)' },
58
+ },
59
+ required: ['prospectId'],
60
+ },
61
+ },
62
+ {
63
+ name: 'add_prospect_contact',
64
+ description: 'Add a person/contact to a prospect company. Requires user confirmation before execution.',
65
+ inputSchema: {
66
+ type: 'object',
67
+ properties: {
68
+ prospectId: { type: 'string', description: 'Prospect company ID' },
69
+ firstName: { type: 'string', description: 'First name' },
70
+ lastName: { type: 'string', description: 'Last name' },
71
+ email: { type: 'string', description: 'Email address' },
72
+ phone: { type: 'string', description: 'Phone number (optional)' },
73
+ role: { type: 'string', description: 'Job title/role (optional)' },
74
+ isPrimary: { type: 'boolean', description: 'Is this the primary contact? (optional, default: false)' },
75
+ notes: { type: 'string', description: 'Additional notes (optional)' },
76
+ },
77
+ required: ['prospectId', 'firstName', 'lastName', 'email'],
78
+ },
79
+ },
80
+ {
81
+ name: 'list_prospect_contacts',
82
+ description: 'List all contacts/people associated with a prospect company.',
83
+ inputSchema: {
84
+ type: 'object',
85
+ properties: {
86
+ prospectId: { type: 'string', description: 'Prospect company ID' },
87
+ },
88
+ required: ['prospectId'],
89
+ },
90
+ },
91
+ {
92
+ name: 'record_touchpoint',
93
+ description: 'Record an interaction/touchpoint with a prospect. Requires user confirmation before execution.',
94
+ inputSchema: {
95
+ type: 'object',
96
+ properties: {
97
+ prospectId: { type: 'string', description: 'Prospect company ID' },
98
+ contactId: { type: 'string', description: 'Specific contact ID if touchpoint was with a particular person (optional)' },
99
+ type: { type: 'string', enum: ['email', 'call', 'meeting', 'linkedin', 'other'], description: 'Type of interaction' },
100
+ date: { type: 'string', description: 'Date of interaction (ISO format)' },
101
+ summary: { type: 'string', description: 'Summary of interaction (optional)' },
102
+ outcome: { type: 'string', enum: ['positive', 'neutral', 'negative', 'no_response'], description: 'Outcome (optional)' },
103
+ },
104
+ required: ['prospectId', 'type', 'date'],
105
+ },
106
+ },
107
+ {
108
+ name: 'list_touchpoints',
109
+ description: 'List touchpoints (interactions) for a prospect or all touchpoints',
110
+ inputSchema: {
111
+ type: 'object',
112
+ properties: {
113
+ prospectId: { type: 'string', description: 'Prospect ID (optional - lists all if omitted)' },
114
+ },
115
+ },
116
+ },
117
+ {
118
+ name: 'create_prospect_with_contact',
119
+ description: 'Create a prospect company and add a contact person in one operation. Ideal for business cards scanned by Claude. Requires user confirmation before execution.',
120
+ inputSchema: {
121
+ type: 'object',
122
+ properties: {
123
+ companyName: { type: 'string', description: 'Company name' },
124
+ address: { type: 'string', description: 'Company address (optional)' },
125
+ industry: { type: 'string', description: 'Industry (optional)' },
126
+ website: { type: 'string', description: 'Website URL (optional)' },
127
+ priority: { type: 'string', enum: ['low', 'medium', 'high'], description: 'Priority (default: medium)' },
128
+ eventMetAt: { type: 'string', description: 'Event where met (optional)' },
129
+ notes: { type: 'string', description: 'Company notes (optional)' },
130
+ contactFirstName: { type: 'string', description: 'Contact first name' },
131
+ contactLastName: { type: 'string', description: 'Contact last name' },
132
+ contactEmail: { type: 'string', description: 'Contact email' },
133
+ contactPhone: { type: 'string', description: 'Contact phone (optional)' },
134
+ contactRole: { type: 'string', description: 'Contact job title/role (optional)' },
135
+ },
136
+ required: ['companyName', 'contactFirstName', 'contactLastName', 'contactEmail'],
137
+ },
138
+ },
139
+ ];
140
+ export async function handleProspectTool(toolName, params) {
141
+ try {
142
+ switch (toolName) {
143
+ case 'list_prospects':
144
+ return await listProspects(params);
145
+ case 'create_prospect':
146
+ return await createProspect(params);
147
+ case 'update_prospect':
148
+ return await updateProspect(params);
149
+ case 'add_prospect_contact':
150
+ return await addProspectContact(params);
151
+ case 'list_prospect_contacts':
152
+ return await listProspectContacts(params);
153
+ case 'record_touchpoint':
154
+ return await recordTouchpoint(params);
155
+ case 'list_touchpoints':
156
+ return await listTouchpoints(params);
157
+ case 'create_prospect_with_contact':
158
+ return await createProspectWithContact(params);
159
+ default:
160
+ throw new Error(`Unknown prospect tool: ${toolName}`);
161
+ }
162
+ }
163
+ catch (error) {
164
+ logToolCall(toolName, params, 'error', { error: formatError(error) });
165
+ throw error;
166
+ }
167
+ }
168
+ async function listProspects(params) {
169
+ const prospects = await httpClient.get('/api/prospects', params);
170
+ logToolCall('list_prospects', params, 'success', { count: prospects.length });
171
+ if (prospects.length === 0) {
172
+ return {
173
+ content: [
174
+ {
175
+ type: 'text',
176
+ text: 'No prospects found matching the specified criteria.',
177
+ },
178
+ ],
179
+ };
180
+ }
181
+ const prospectsList = prospects
182
+ .map((p) => {
183
+ const primaryContact = p.contacts?.find((c) => c.isPrimary);
184
+ const contactInfo = primaryContact
185
+ ? `\n Primary Contact: ${primaryContact.firstName} ${primaryContact.lastName} (${primaryContact.email})`
186
+ : `\n Contacts: ${p._count?.contacts || 0}`;
187
+ return `- ${p.companyName}${contactInfo}\n Status: ${p.status} | Priority: ${p.priority}\n Owner: ${p.owner || 'Unassigned'}\n ID: ${p.id}`;
188
+ })
189
+ .join('\n\n');
190
+ return {
191
+ content: [
192
+ {
193
+ type: 'text',
194
+ text: `Found ${prospects.length} prospect(s):\n\n${prospectsList}`,
195
+ },
196
+ ],
197
+ };
198
+ }
199
+ async function createProspect(params) {
200
+ const validated = createProspectSchema.parse(params);
201
+ const prospect = await httpClient.post('/api/prospects', validated, 'create_prospect');
202
+ logToolCall('create_prospect', params, 'success', { prospectId: prospect.id });
203
+ return {
204
+ content: [
205
+ {
206
+ type: 'text',
207
+ text: `✓ Created prospect company: ${prospect.companyName}${prospect.similarCompanies ? `\n\n⚠️ Similar companies exist:\n${prospect.similarCompanies.map((c) => `- ${c.companyName}`).join('\n')}` : ''}`,
208
+ },
209
+ ],
210
+ };
211
+ }
212
+ async function updateProspect(params) {
213
+ const validated = updateProspectSchema.parse(params);
214
+ const { prospectId, ...updates } = validated;
215
+ const prospect = await httpClient.patch(`/api/prospects/${prospectId}`, updates, 'update_prospect');
216
+ logToolCall('update_prospect', params, 'success', { prospectId });
217
+ return {
218
+ content: [
219
+ {
220
+ type: 'text',
221
+ text: `✓ Updated prospect: ${prospect.companyName}`,
222
+ },
223
+ ],
224
+ };
225
+ }
226
+ async function addProspectContact(params) {
227
+ const validated = createContactSchema.parse(params);
228
+ const contact = await httpClient.post('/api/contacts', validated, 'add_prospect_contact');
229
+ logToolCall('add_prospect_contact', params, 'success', { contactId: contact.id });
230
+ return {
231
+ content: [
232
+ {
233
+ type: 'text',
234
+ text: `✓ Added contact: ${contact.firstName} ${contact.lastName} (${contact.email}) to ${contact.prospect?.companyName}`,
235
+ },
236
+ ],
237
+ };
238
+ }
239
+ async function listProspectContacts(params) {
240
+ const { prospectId } = params;
241
+ const contacts = await httpClient.get('/api/contacts', { prospectId });
242
+ logToolCall('list_prospect_contacts', params, 'success', { count: contacts.length });
243
+ if (contacts.length === 0) {
244
+ return {
245
+ content: [
246
+ {
247
+ type: 'text',
248
+ text: 'No contacts found for this prospect.',
249
+ },
250
+ ],
251
+ };
252
+ }
253
+ const contactsList = contacts
254
+ .map((c) => `- ${c.firstName} ${c.lastName} (${c.email})${c.isPrimary ? ' ★ Primary' : ''}\n Role: ${c.role || 'N/A'}\n Phone: ${c.phone || 'N/A'}\n ID: ${c.id}`)
255
+ .join('\n\n');
256
+ return {
257
+ content: [
258
+ {
259
+ type: 'text',
260
+ text: `Found ${contacts.length} contact(s):\n\n${contactsList}`,
261
+ },
262
+ ],
263
+ };
264
+ }
265
+ async function recordTouchpoint(params) {
266
+ const validated = recordTouchpointSchema.parse(params);
267
+ const touchpoint = await httpClient.post('/api/touchpoints', {
268
+ prospectId: validated.prospectId,
269
+ contactId: validated.contactId,
270
+ type: validated.type,
271
+ date: validated.date,
272
+ summary: validated.summary,
273
+ outcome: validated.outcome,
274
+ }, 'record_touchpoint');
275
+ logToolCall('record_touchpoint', params, 'success', { touchpointId: touchpoint.id });
276
+ return {
277
+ content: [
278
+ {
279
+ type: 'text',
280
+ text: `✓ Recorded ${touchpoint.type} touchpoint${touchpoint.summary ? ': ' + touchpoint.summary : ''}`,
281
+ },
282
+ ],
283
+ };
284
+ }
285
+ async function createProspectWithContact(params) {
286
+ const validated = createProspectWithContactSchema.parse(params);
287
+ const result = await httpClient.post('/api/prospects/with-contact', validated, 'create_prospect_with_contact');
288
+ logToolCall('create_prospect_with_contact', params, 'success', {
289
+ prospectId: result.prospect.id,
290
+ contactId: result.contact.id,
291
+ });
292
+ return {
293
+ content: [
294
+ {
295
+ type: 'text',
296
+ text: `✓ Added ${result.contact.firstName} ${result.contact.lastName} at ${result.prospect.companyName}\n Email: ${result.contact.email}${result.contact.phone ? `\n Phone: ${result.contact.phone}` : ''}${result.contact.role ? `\n Role: ${result.contact.role}` : ''}${result.similarCompanies ? `\n\n⚠️ Similar companies exist:\n${result.similarCompanies.map((c) => `- ${c.companyName}`).join('\n')}` : ''}`,
297
+ },
298
+ ],
299
+ };
300
+ }
301
+ async function listTouchpoints(params) {
302
+ const queryParams = {};
303
+ if (params.prospectId)
304
+ queryParams.prospectId = params.prospectId;
305
+ const touchpoints = await httpClient.get('/api/touchpoints', queryParams);
306
+ logToolCall('list_touchpoints', params, 'success', { count: touchpoints.length });
307
+ if (touchpoints.length === 0) {
308
+ return {
309
+ content: [{
310
+ type: 'text',
311
+ text: params.prospectId
312
+ ? 'No touchpoints found for this prospect.'
313
+ : 'No touchpoints found.',
314
+ }],
315
+ };
316
+ }
317
+ let response = `Found ${touchpoints.length} touchpoint(s):\n\n`;
318
+ touchpoints.forEach((t, index) => {
319
+ response += `${index + 1}. ${t.type.toUpperCase()} - ${t.prospect?.companyName || 'Unknown'}\n`;
320
+ response += ` Date: ${new Date(t.date).toLocaleDateString()}\n`;
321
+ if (t.summary) {
322
+ response += ` Summary: ${t.summary.substring(0, 100)}${t.summary.length > 100 ? '...' : ''}\n`;
323
+ }
324
+ if (t.outcome) {
325
+ response += ` Outcome: ${t.outcome}\n`;
326
+ }
327
+ response += ` ID: ${t.id}\n\n`;
328
+ });
329
+ return {
330
+ content: [{
331
+ type: 'text',
332
+ text: response,
333
+ }],
334
+ };
335
+ }
336
+ //# sourceMappingURL=prospects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prospects.js","sourceRoot":"","sources":["../../src/tools/prospects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAU,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EAEnB,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,2GAA2G;QACxH,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oEAAoE,EAAE;gBAC7G,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE;gBAClK,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE;gBAC3G,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;aACrE;YACD,QAAQ,EAAE,EAAE;SACb;KACF;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,wFAAwF;QACrG,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW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CAAC,CAAC,OAAO,EAAE,CAAC;YACd,QAAQ,IAAI,eAAe,CAAC,CAAC,OAAO,IAAI,CAAC;QAC3C,CAAC;QACD,QAAQ,IAAI,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,CAAC;gBACR,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;aACf,CAAC;KACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,83 @@
1
+ export declare const ticketTools: ({
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: string;
6
+ properties: {
7
+ customerId: {
8
+ type: string;
9
+ description: string;
10
+ };
11
+ title: {
12
+ type: string;
13
+ description: string;
14
+ };
15
+ description: {
16
+ type: string;
17
+ description: string;
18
+ };
19
+ priority: {
20
+ type: string;
21
+ enum: string[];
22
+ description: string;
23
+ };
24
+ assignee: {
25
+ type: string;
26
+ description: string;
27
+ };
28
+ dueDate: {
29
+ type: string;
30
+ description: string;
31
+ };
32
+ status?: undefined;
33
+ ticketId?: undefined;
34
+ };
35
+ required: string[];
36
+ };
37
+ } | {
38
+ name: string;
39
+ description: string;
40
+ inputSchema: {
41
+ type: string;
42
+ properties: {
43
+ customerId: {
44
+ type: string;
45
+ description: string;
46
+ };
47
+ status: {
48
+ type: string;
49
+ enum: string[];
50
+ description: string;
51
+ };
52
+ title?: undefined;
53
+ description?: undefined;
54
+ priority?: undefined;
55
+ assignee?: undefined;
56
+ dueDate?: undefined;
57
+ ticketId?: undefined;
58
+ };
59
+ required?: undefined;
60
+ };
61
+ } | {
62
+ name: string;
63
+ description: string;
64
+ inputSchema: {
65
+ type: string;
66
+ properties: {
67
+ ticketId: {
68
+ type: string;
69
+ description: string;
70
+ };
71
+ customerId?: undefined;
72
+ title?: undefined;
73
+ description?: undefined;
74
+ priority?: undefined;
75
+ assignee?: undefined;
76
+ dueDate?: undefined;
77
+ status?: undefined;
78
+ };
79
+ required: string[];
80
+ };
81
+ })[];
82
+ export declare function handleTicketTool(toolName: string, params: any): Promise<any>;
83
+ //# sourceMappingURL=tickets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tickets.d.ts","sourceRoot":"","sources":["../../src/tools/tickets.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuCvB,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAgBlF"}
@@ -0,0 +1,171 @@
1
+ import { httpClient } from '../client/http-client.js';
2
+ import { logToolCall } from '../utils/logger.js';
3
+ import { formatError } from '../utils/errors.js';
4
+ import { createLinearTicketSchema, } from '../validation/schemas.js';
5
+ export const ticketTools = [
6
+ {
7
+ name: 'create_linear_ticket',
8
+ description: 'Create a task/ticket linked to a customer. Requires user confirmation before execution.',
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ customerId: { type: 'string', description: 'Customer ID' },
13
+ title: { type: 'string', description: 'Ticket title' },
14
+ description: { type: 'string', description: 'Ticket description (optional)' },
15
+ priority: { type: 'string', enum: ['low', 'medium', 'high', 'urgent'], description: 'Priority level (default: medium)' },
16
+ assignee: { type: 'string', description: 'Person assigned to ticket (optional)' },
17
+ dueDate: { type: 'string', description: 'Due date (ISO format, optional)' },
18
+ },
19
+ required: ['customerId', 'title'],
20
+ },
21
+ },
22
+ {
23
+ name: 'list_tickets',
24
+ description: 'List Linear tickets with optional filters',
25
+ inputSchema: {
26
+ type: 'object',
27
+ properties: {
28
+ customerId: { type: 'string', description: 'Filter by customer' },
29
+ status: { type: 'string', enum: ['backlog', 'todo', 'in_progress', 'done', 'cancelled'], description: 'Filter by status' },
30
+ },
31
+ },
32
+ },
33
+ {
34
+ name: 'get_ticket',
35
+ description: 'Get a specific ticket by ID',
36
+ inputSchema: {
37
+ type: 'object',
38
+ properties: {
39
+ ticketId: { type: 'string', description: 'Ticket ID' },
40
+ },
41
+ required: ['ticketId'],
42
+ },
43
+ },
44
+ ];
45
+ export async function handleTicketTool(toolName, params) {
46
+ try {
47
+ switch (toolName) {
48
+ case 'create_linear_ticket':
49
+ return await createLinearTicket(params);
50
+ case 'list_tickets':
51
+ return await listTickets(params);
52
+ case 'get_ticket':
53
+ return await getTicket(params);
54
+ default:
55
+ throw new Error(`Unknown ticket tool: ${toolName}`);
56
+ }
57
+ }
58
+ catch (error) {
59
+ logToolCall(toolName, params, 'error', { error: formatError(error) });
60
+ throw error;
61
+ }
62
+ }
63
+ async function createLinearTicket(params) {
64
+ const validated = createLinearTicketSchema.parse(params);
65
+ const ticket = await httpClient.post('/api/tickets', validated, 'create_linear_ticket');
66
+ logToolCall('create_linear_ticket', params, 'success', { ticketId: ticket.id });
67
+ const priorityEmoji = {
68
+ low: '🔵',
69
+ medium: '🟡',
70
+ high: '🟠',
71
+ urgent: '🔴',
72
+ };
73
+ return {
74
+ content: [
75
+ {
76
+ type: 'text',
77
+ text: `✓ Created ticket for ${ticket.customer?.companyName || 'customer'}\n${priorityEmoji[ticket.priority]} ${ticket.priority.toUpperCase()}: ${ticket.title}`,
78
+ },
79
+ ],
80
+ };
81
+ }
82
+ async function listTickets(params) {
83
+ const queryParams = {};
84
+ if (params.customerId)
85
+ queryParams.customerId = params.customerId;
86
+ if (params.status)
87
+ queryParams.status = params.status;
88
+ const tickets = await httpClient.get('/api/tickets', queryParams);
89
+ logToolCall('list_tickets', params, 'success', { count: tickets.length });
90
+ if (tickets.length === 0) {
91
+ return {
92
+ content: [{
93
+ type: 'text',
94
+ text: params.customerId
95
+ ? 'No tickets found for this customer.'
96
+ : 'No tickets found.',
97
+ }],
98
+ };
99
+ }
100
+ const priorityEmoji = {
101
+ low: '🔵',
102
+ medium: '🟡',
103
+ high: '🟠',
104
+ urgent: '🔴',
105
+ };
106
+ let response = `Found ${tickets.length} ticket(s):\n\n`;
107
+ tickets.forEach((t, index) => {
108
+ response += `${index + 1}. ${priorityEmoji[t.priority]} ${t.title}\n`;
109
+ response += ` Customer: ${t.customer?.companyName || 'Unknown'}\n`;
110
+ response += ` Status: ${t.status}\n`;
111
+ response += ` Priority: ${t.priority}\n`;
112
+ if (t.assignee) {
113
+ response += ` Assignee: ${t.assignee}\n`;
114
+ }
115
+ if (t.dueDate) {
116
+ response += ` Due: ${new Date(t.dueDate).toLocaleDateString()}\n`;
117
+ }
118
+ response += ` ID: ${t.id}\n\n`;
119
+ });
120
+ return {
121
+ content: [{
122
+ type: 'text',
123
+ text: response,
124
+ }],
125
+ };
126
+ }
127
+ async function getTicket(params) {
128
+ const tickets = await httpClient.get('/api/tickets');
129
+ const ticket = tickets.find((t) => t.id === params.ticketId);
130
+ if (!ticket) {
131
+ return {
132
+ content: [{
133
+ type: 'text',
134
+ text: 'Ticket not found.',
135
+ }],
136
+ };
137
+ }
138
+ logToolCall('get_ticket', params, 'success', { ticketId: ticket.id });
139
+ const priorityEmoji = {
140
+ low: '🔵',
141
+ medium: '🟡',
142
+ high: '🟠',
143
+ urgent: '🔴',
144
+ };
145
+ let response = `Ticket Details\n${'='.repeat(50)}\n\n`;
146
+ response += `${priorityEmoji[ticket.priority]} ${ticket.title}\n\n`;
147
+ response += `Customer: ${ticket.customer?.companyName || 'Unknown'}\n`;
148
+ response += `Status: ${ticket.status}\n`;
149
+ response += `Priority: ${ticket.priority}\n`;
150
+ if (ticket.assignee) {
151
+ response += `Assignee: ${ticket.assignee}\n`;
152
+ }
153
+ if (ticket.dueDate) {
154
+ response += `Due Date: ${new Date(ticket.dueDate).toLocaleDateString()}\n`;
155
+ }
156
+ if (ticket.linearId) {
157
+ response += `Linear ID: ${ticket.linearId}\n`;
158
+ }
159
+ response += `Created: ${new Date(ticket.createdAt).toLocaleDateString()}\n`;
160
+ response += `ID: ${ticket.id}\n`;
161
+ if (ticket.description) {
162
+ response += `\nDescription:\n${ticket.description}\n`;
163
+ }
164
+ return {
165
+ content: [{
166
+ type: 'text',
167
+ text: response,
168
+ }],
169
+ };
170
+ }
171
+ //# sourceMappingURL=tickets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tickets.js","sourceRoot":"","sources":["../../src/tools/tickets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAU,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;QACE,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EAAE,yFAAyF;QACtG,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE;gBAC1D,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE;gBACtD,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+BAA+B,EAAE;gBAC7E,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE;gBACxH,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sCAAsC,EAAE;gBACjF,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iCAAiC,EAAE;aAC5E;YACD,QAAQ,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC;SAClC;KACF;IACD;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,2CAA2C;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