@l4yercak3/cli 1.1.12 → 1.2.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.
@@ -0,0 +1,649 @@
1
+ /**
2
+ * Events Domain Tools
3
+ *
4
+ * Event management tools for creating events, managing tickets,
5
+ * tracking attendees, and handling sponsors.
6
+ *
7
+ * @module mcp/registry/domains/events
8
+ */
9
+
10
+ const backendClient = require('../../../api/backend-client');
11
+
12
+ /**
13
+ * Events domain definition
14
+ */
15
+ module.exports = {
16
+ name: 'events',
17
+ description: 'Event management - events, tickets, attendees, sponsors',
18
+ tools: [
19
+ // ========================================
20
+ // Event CRUD Tools
21
+ // ========================================
22
+ {
23
+ name: 'l4yercak3_events_list',
24
+ description: `List all events for the organization.
25
+ Returns events with their basic details, status, and dates.`,
26
+ inputSchema: {
27
+ type: 'object',
28
+ properties: {
29
+ status: {
30
+ type: 'string',
31
+ enum: ['draft', 'published', 'in_progress', 'completed', 'cancelled'],
32
+ description: 'Filter by event status',
33
+ },
34
+ subtype: {
35
+ type: 'string',
36
+ enum: ['conference', 'workshop', 'concert', 'meetup', 'seminar'],
37
+ description: 'Filter by event type',
38
+ },
39
+ fromDate: {
40
+ type: 'string',
41
+ description: 'ISO date - only events starting after this date',
42
+ },
43
+ toDate: {
44
+ type: 'string',
45
+ description: 'ISO date - only events starting before this date',
46
+ },
47
+ limit: {
48
+ type: 'number',
49
+ description: 'Max events to return (default 50)',
50
+ },
51
+ },
52
+ },
53
+ requiresAuth: true,
54
+ requiredPermissions: ['view_events'],
55
+ handler: async (params, authContext) => {
56
+ const queryParams = new URLSearchParams();
57
+ queryParams.set('organizationId', authContext.organizationId);
58
+ if (params.status) queryParams.set('status', params.status);
59
+ if (params.subtype) queryParams.set('subtype', params.subtype);
60
+ if (params.fromDate) queryParams.set('fromDate', params.fromDate);
61
+ if (params.toDate) queryParams.set('toDate', params.toDate);
62
+ if (params.limit) queryParams.set('limit', Math.min(params.limit, 100));
63
+
64
+ const response = await backendClient.request(
65
+ 'GET',
66
+ `/api/v1/events?${queryParams.toString()}`
67
+ );
68
+
69
+ return {
70
+ events: (response.events || []).map(event => ({
71
+ id: event._id,
72
+ name: event.name,
73
+ description: event.description,
74
+ subtype: event.subtype,
75
+ status: event.status,
76
+ startDate: event.customProperties?.startDate,
77
+ endDate: event.customProperties?.endDate,
78
+ location: event.customProperties?.location,
79
+ slug: event.customProperties?.slug,
80
+ attendeeCount: event.customProperties?.attendeeCount || 0,
81
+ })),
82
+ total: response.total || (response.events || []).length,
83
+ };
84
+ },
85
+ },
86
+
87
+ {
88
+ name: 'l4yercak3_events_create',
89
+ description: `Create a new event.
90
+ Events start in 'draft' status and can be published when ready.`,
91
+ inputSchema: {
92
+ type: 'object',
93
+ properties: {
94
+ name: {
95
+ type: 'string',
96
+ description: 'Event name',
97
+ },
98
+ description: {
99
+ type: 'string',
100
+ description: 'Event description',
101
+ },
102
+ subtype: {
103
+ type: 'string',
104
+ enum: ['conference', 'workshop', 'concert', 'meetup', 'seminar'],
105
+ description: 'Event type (default: meetup)',
106
+ },
107
+ startDate: {
108
+ type: 'string',
109
+ description: 'Start date/time (ISO format)',
110
+ },
111
+ endDate: {
112
+ type: 'string',
113
+ description: 'End date/time (ISO format)',
114
+ },
115
+ location: {
116
+ type: 'string',
117
+ description: 'Event location/venue',
118
+ },
119
+ timezone: {
120
+ type: 'string',
121
+ description: 'Timezone (e.g., America/New_York)',
122
+ },
123
+ maxCapacity: {
124
+ type: 'number',
125
+ description: 'Maximum attendee capacity',
126
+ },
127
+ },
128
+ required: ['name', 'startDate', 'endDate', 'location'],
129
+ },
130
+ requiresAuth: true,
131
+ requiredPermissions: ['manage_events'],
132
+ handler: async (params, authContext) => {
133
+ // Convert ISO dates to timestamps
134
+ const startDate = new Date(params.startDate).getTime();
135
+ const endDate = new Date(params.endDate).getTime();
136
+
137
+ const response = await backendClient.request('POST', '/api/v1/events', {
138
+ organizationId: authContext.organizationId,
139
+ name: params.name,
140
+ description: params.description,
141
+ subtype: params.subtype || 'meetup',
142
+ startDate,
143
+ endDate,
144
+ location: params.location,
145
+ customProperties: {
146
+ timezone: params.timezone || 'UTC',
147
+ maxCapacity: params.maxCapacity,
148
+ },
149
+ });
150
+
151
+ return {
152
+ success: true,
153
+ eventId: response.eventId || response.id,
154
+ status: 'draft',
155
+ message: `Created event: ${params.name} (draft)`,
156
+ nextSteps: [
157
+ 'Add ticket products with l4yercak3_events_create_product',
158
+ 'Publish the event with l4yercak3_events_publish',
159
+ ],
160
+ };
161
+ },
162
+ },
163
+
164
+ {
165
+ name: 'l4yercak3_events_get',
166
+ description: `Get detailed information about a specific event.
167
+ Includes agenda, products, and optionally sponsors.`,
168
+ inputSchema: {
169
+ type: 'object',
170
+ properties: {
171
+ eventId: {
172
+ type: 'string',
173
+ description: 'The event ID',
174
+ },
175
+ includeProducts: {
176
+ type: 'boolean',
177
+ description: 'Include linked products/tickets (default: true)',
178
+ },
179
+ includeSponsors: {
180
+ type: 'boolean',
181
+ description: 'Include sponsors (default: false)',
182
+ },
183
+ },
184
+ required: ['eventId'],
185
+ },
186
+ requiresAuth: true,
187
+ requiredPermissions: ['view_events'],
188
+ handler: async (params, authContext) => {
189
+ const queryParams = new URLSearchParams();
190
+ if (params.includeProducts !== false) queryParams.set('includeProducts', 'true');
191
+ if (params.includeSponsors) queryParams.set('includeSponsors', 'true');
192
+
193
+ const response = await backendClient.request(
194
+ 'GET',
195
+ `/api/v1/events/${params.eventId}?${queryParams.toString()}`
196
+ );
197
+
198
+ const event = response.event || response;
199
+
200
+ return {
201
+ id: event._id,
202
+ name: event.name,
203
+ description: event.description,
204
+ subtype: event.subtype,
205
+ status: event.status,
206
+ startDate: event.customProperties?.startDate,
207
+ endDate: event.customProperties?.endDate,
208
+ location: event.customProperties?.location,
209
+ formattedAddress: event.customProperties?.formattedAddress,
210
+ timezone: event.customProperties?.timezone,
211
+ slug: event.customProperties?.slug,
212
+ maxCapacity: event.customProperties?.maxCapacity,
213
+ agenda: event.customProperties?.agenda || [],
214
+ detailedDescription: event.customProperties?.detailedDescription,
215
+ products: response.products || [],
216
+ sponsors: response.sponsors || [],
217
+ createdAt: event.createdAt,
218
+ updatedAt: event.updatedAt,
219
+ };
220
+ },
221
+ },
222
+
223
+ {
224
+ name: 'l4yercak3_events_update',
225
+ description: `Update an existing event.
226
+ Can update name, dates, location, and other properties.`,
227
+ inputSchema: {
228
+ type: 'object',
229
+ properties: {
230
+ eventId: {
231
+ type: 'string',
232
+ description: 'The event ID to update',
233
+ },
234
+ name: { type: 'string', description: 'New event name' },
235
+ description: { type: 'string', description: 'New description' },
236
+ subtype: {
237
+ type: 'string',
238
+ enum: ['conference', 'workshop', 'concert', 'meetup', 'seminar'],
239
+ },
240
+ startDate: { type: 'string', description: 'New start date (ISO)' },
241
+ endDate: { type: 'string', description: 'New end date (ISO)' },
242
+ location: { type: 'string', description: 'New location' },
243
+ maxCapacity: { type: 'number', description: 'New capacity limit' },
244
+ },
245
+ required: ['eventId'],
246
+ },
247
+ requiresAuth: true,
248
+ requiredPermissions: ['manage_events'],
249
+ handler: async (params, authContext) => {
250
+ const { eventId, startDate, endDate, ...updates } = params;
251
+
252
+ // Convert dates if provided
253
+ if (startDate) updates.startDate = new Date(startDate).getTime();
254
+ if (endDate) updates.endDate = new Date(endDate).getTime();
255
+
256
+ await backendClient.request('PATCH', `/api/v1/events/${eventId}`, updates);
257
+
258
+ return {
259
+ success: true,
260
+ eventId,
261
+ message: 'Event updated successfully',
262
+ };
263
+ },
264
+ },
265
+
266
+ {
267
+ name: 'l4yercak3_events_publish',
268
+ description: `Publish an event to make it publicly visible.
269
+ Changes status from 'draft' to 'published'.`,
270
+ inputSchema: {
271
+ type: 'object',
272
+ properties: {
273
+ eventId: {
274
+ type: 'string',
275
+ description: 'The event ID to publish',
276
+ },
277
+ },
278
+ required: ['eventId'],
279
+ },
280
+ requiresAuth: true,
281
+ requiredPermissions: ['manage_events'],
282
+ handler: async (params, authContext) => {
283
+ await backendClient.request('POST', `/api/v1/events/${params.eventId}/publish`);
284
+
285
+ return {
286
+ success: true,
287
+ eventId: params.eventId,
288
+ status: 'published',
289
+ message: 'Event published successfully',
290
+ };
291
+ },
292
+ },
293
+
294
+ {
295
+ name: 'l4yercak3_events_cancel',
296
+ description: `Cancel an event.
297
+ Sets status to 'cancelled'. This is a soft delete.`,
298
+ inputSchema: {
299
+ type: 'object',
300
+ properties: {
301
+ eventId: {
302
+ type: 'string',
303
+ description: 'The event ID to cancel',
304
+ },
305
+ },
306
+ required: ['eventId'],
307
+ },
308
+ requiresAuth: true,
309
+ requiredPermissions: ['manage_events'],
310
+ handler: async (params, authContext) => {
311
+ await backendClient.request('POST', `/api/v1/events/${params.eventId}/cancel`);
312
+
313
+ return {
314
+ success: true,
315
+ eventId: params.eventId,
316
+ status: 'cancelled',
317
+ message: 'Event cancelled',
318
+ };
319
+ },
320
+ },
321
+
322
+ // ========================================
323
+ // Event Agenda Tools
324
+ // ========================================
325
+ {
326
+ name: 'l4yercak3_events_update_agenda',
327
+ description: `Update the event agenda/schedule.
328
+ Replace the entire agenda with a new list of agenda items.`,
329
+ inputSchema: {
330
+ type: 'object',
331
+ properties: {
332
+ eventId: {
333
+ type: 'string',
334
+ description: 'The event ID',
335
+ },
336
+ agenda: {
337
+ type: 'array',
338
+ items: {
339
+ type: 'object',
340
+ properties: {
341
+ time: {
342
+ type: 'string',
343
+ description: 'Time (e.g., "09:00 AM" or ISO timestamp)',
344
+ },
345
+ title: {
346
+ type: 'string',
347
+ description: 'Session title',
348
+ },
349
+ description: {
350
+ type: 'string',
351
+ description: 'Session description',
352
+ },
353
+ speaker: {
354
+ type: 'string',
355
+ description: 'Speaker name',
356
+ },
357
+ location: {
358
+ type: 'string',
359
+ description: 'Room/venue within event',
360
+ },
361
+ duration: {
362
+ type: 'number',
363
+ description: 'Duration in minutes',
364
+ },
365
+ },
366
+ required: ['time', 'title'],
367
+ },
368
+ description: 'List of agenda items',
369
+ },
370
+ },
371
+ required: ['eventId', 'agenda'],
372
+ },
373
+ requiresAuth: true,
374
+ requiredPermissions: ['manage_events'],
375
+ handler: async (params, authContext) => {
376
+ await backendClient.request('PATCH', `/api/v1/events/${params.eventId}/agenda`, {
377
+ agenda: params.agenda,
378
+ });
379
+
380
+ return {
381
+ success: true,
382
+ eventId: params.eventId,
383
+ agendaItemCount: params.agenda.length,
384
+ message: 'Event agenda updated',
385
+ };
386
+ },
387
+ },
388
+
389
+ // ========================================
390
+ // Product/Ticket Tools
391
+ // ========================================
392
+ {
393
+ name: 'l4yercak3_events_get_products',
394
+ description: `Get all products (tickets) offered by an event.`,
395
+ inputSchema: {
396
+ type: 'object',
397
+ properties: {
398
+ eventId: {
399
+ type: 'string',
400
+ description: 'The event ID',
401
+ },
402
+ },
403
+ required: ['eventId'],
404
+ },
405
+ requiresAuth: true,
406
+ requiredPermissions: ['view_events'],
407
+ handler: async (params, authContext) => {
408
+ const response = await backendClient.request(
409
+ 'GET',
410
+ `/api/v1/events/${params.eventId}/products`
411
+ );
412
+
413
+ return {
414
+ products: (response.products || []).map(product => ({
415
+ id: product._id,
416
+ name: product.name,
417
+ description: product.description,
418
+ priceInCents: product.customProperties?.priceInCents,
419
+ currency: product.customProperties?.currency || 'EUR',
420
+ quantity: product.customProperties?.quantity,
421
+ soldCount: product.customProperties?.soldCount || 0,
422
+ status: product.status,
423
+ isFeatured: product.linkProperties?.isFeatured || false,
424
+ })),
425
+ };
426
+ },
427
+ },
428
+
429
+ {
430
+ name: 'l4yercak3_events_create_product',
431
+ description: `Create a product (ticket type) for an event.
432
+ Products can be tickets, merchandise, or add-ons.`,
433
+ inputSchema: {
434
+ type: 'object',
435
+ properties: {
436
+ eventId: {
437
+ type: 'string',
438
+ description: 'The event ID',
439
+ },
440
+ name: {
441
+ type: 'string',
442
+ description: 'Product name (e.g., "Early Bird Ticket")',
443
+ },
444
+ description: {
445
+ type: 'string',
446
+ description: 'Product description',
447
+ },
448
+ priceInCents: {
449
+ type: 'number',
450
+ description: 'Price in cents (e.g., 5000 = €50.00)',
451
+ },
452
+ currency: {
453
+ type: 'string',
454
+ description: 'Currency code (default: EUR)',
455
+ },
456
+ quantity: {
457
+ type: 'number',
458
+ description: 'Available quantity (null = unlimited)',
459
+ },
460
+ subtype: {
461
+ type: 'string',
462
+ enum: ['ticket', 'merchandise', 'addon', 'donation'],
463
+ description: 'Product type (default: ticket)',
464
+ },
465
+ isFeatured: {
466
+ type: 'boolean',
467
+ description: 'Feature this product prominently',
468
+ },
469
+ },
470
+ required: ['eventId', 'name', 'priceInCents'],
471
+ },
472
+ requiresAuth: true,
473
+ requiredPermissions: ['manage_events'],
474
+ handler: async (params, authContext) => {
475
+ const response = await backendClient.request('POST', '/api/v1/products', {
476
+ organizationId: authContext.organizationId,
477
+ eventId: params.eventId,
478
+ name: params.name,
479
+ description: params.description,
480
+ priceInCents: params.priceInCents,
481
+ currency: params.currency || 'EUR',
482
+ quantity: params.quantity,
483
+ subtype: params.subtype || 'ticket',
484
+ isFeatured: params.isFeatured || false,
485
+ });
486
+
487
+ return {
488
+ success: true,
489
+ productId: response.productId || response.id,
490
+ message: `Created product: ${params.name}`,
491
+ };
492
+ },
493
+ },
494
+
495
+ // ========================================
496
+ // Attendee Tools
497
+ // ========================================
498
+ {
499
+ name: 'l4yercak3_events_get_attendees',
500
+ description: `Get all attendees (ticket holders) for an event.
501
+ Returns people who have purchased tickets.`,
502
+ inputSchema: {
503
+ type: 'object',
504
+ properties: {
505
+ eventId: {
506
+ type: 'string',
507
+ description: 'The event ID',
508
+ },
509
+ status: {
510
+ type: 'string',
511
+ enum: ['issued', 'checked_in', 'cancelled'],
512
+ description: 'Filter by ticket status',
513
+ },
514
+ limit: {
515
+ type: 'number',
516
+ description: 'Max attendees to return',
517
+ },
518
+ },
519
+ required: ['eventId'],
520
+ },
521
+ requiresAuth: true,
522
+ requiredPermissions: ['view_events'],
523
+ handler: async (params, authContext) => {
524
+ const queryParams = new URLSearchParams();
525
+ if (params.status) queryParams.set('status', params.status);
526
+ if (params.limit) queryParams.set('limit', params.limit);
527
+
528
+ const response = await backendClient.request(
529
+ 'GET',
530
+ `/api/v1/events/${params.eventId}/attendees?${queryParams.toString()}`
531
+ );
532
+
533
+ return {
534
+ attendees: (response.attendees || []).map(attendee => ({
535
+ ticketId: attendee._id,
536
+ holderName: attendee.holderName,
537
+ holderEmail: attendee.holderEmail,
538
+ holderPhone: attendee.holderPhone,
539
+ ticketNumber: attendee.ticketNumber,
540
+ ticketType: attendee.ticketType,
541
+ status: attendee.status,
542
+ purchaseDate: attendee.purchaseDate,
543
+ pricePaid: attendee.pricePaid,
544
+ formResponses: attendee.formResponses,
545
+ })),
546
+ total: response.total || (response.attendees || []).length,
547
+ };
548
+ },
549
+ },
550
+
551
+ // ========================================
552
+ // Sponsor Tools
553
+ // ========================================
554
+ {
555
+ name: 'l4yercak3_events_get_sponsors',
556
+ description: `Get all sponsors for an event.
557
+ Sponsors are CRM organizations linked to the event.`,
558
+ inputSchema: {
559
+ type: 'object',
560
+ properties: {
561
+ eventId: {
562
+ type: 'string',
563
+ description: 'The event ID',
564
+ },
565
+ sponsorLevel: {
566
+ type: 'string',
567
+ enum: ['platinum', 'gold', 'silver', 'bronze', 'community'],
568
+ description: 'Filter by sponsor level',
569
+ },
570
+ },
571
+ required: ['eventId'],
572
+ },
573
+ requiresAuth: true,
574
+ requiredPermissions: ['view_events'],
575
+ handler: async (params, authContext) => {
576
+ const queryParams = new URLSearchParams();
577
+ if (params.sponsorLevel) queryParams.set('sponsorLevel', params.sponsorLevel);
578
+
579
+ const response = await backendClient.request(
580
+ 'GET',
581
+ `/api/v1/events/${params.eventId}/sponsors?${queryParams.toString()}`
582
+ );
583
+
584
+ return {
585
+ sponsors: (response.sponsors || []).map(sponsor => ({
586
+ crmOrganizationId: sponsor._id,
587
+ name: sponsor.name,
588
+ website: sponsor.customProperties?.website,
589
+ sponsorLevel: sponsor.sponsorshipProperties?.sponsorLevel,
590
+ logoUrl: sponsor.sponsorshipProperties?.logoUrl,
591
+ description: sponsor.sponsorshipProperties?.description,
592
+ })),
593
+ };
594
+ },
595
+ },
596
+
597
+ {
598
+ name: 'l4yercak3_events_add_sponsor',
599
+ description: `Add a sponsor (CRM organization) to an event.`,
600
+ inputSchema: {
601
+ type: 'object',
602
+ properties: {
603
+ eventId: {
604
+ type: 'string',
605
+ description: 'The event ID',
606
+ },
607
+ crmOrganizationId: {
608
+ type: 'string',
609
+ description: 'The CRM organization ID to add as sponsor',
610
+ },
611
+ sponsorLevel: {
612
+ type: 'string',
613
+ enum: ['platinum', 'gold', 'silver', 'bronze', 'community'],
614
+ description: 'Sponsor level (default: community)',
615
+ },
616
+ logoUrl: {
617
+ type: 'string',
618
+ description: 'Sponsor logo URL',
619
+ },
620
+ websiteUrl: {
621
+ type: 'string',
622
+ description: 'Sponsor website URL',
623
+ },
624
+ description: {
625
+ type: 'string',
626
+ description: 'Sponsor description',
627
+ },
628
+ },
629
+ required: ['eventId', 'crmOrganizationId'],
630
+ },
631
+ requiresAuth: true,
632
+ requiredPermissions: ['manage_events'],
633
+ handler: async (params, authContext) => {
634
+ await backendClient.request('POST', `/api/v1/events/${params.eventId}/sponsors`, {
635
+ crmOrganizationId: params.crmOrganizationId,
636
+ sponsorLevel: params.sponsorLevel || 'community',
637
+ logoUrl: params.logoUrl,
638
+ websiteUrl: params.websiteUrl,
639
+ description: params.description,
640
+ });
641
+
642
+ return {
643
+ success: true,
644
+ message: 'Sponsor added to event',
645
+ };
646
+ },
647
+ },
648
+ ],
649
+ };