@ebowwa/crm 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.md +174 -0
  2. package/dist/cli/commands/activities.d.ts +11 -0
  3. package/dist/cli/commands/activities.d.ts.map +1 -0
  4. package/dist/cli/commands/activities.js +427 -0
  5. package/dist/cli/commands/activities.js.map +1 -0
  6. package/dist/cli/commands/contacts.d.ts +11 -0
  7. package/dist/cli/commands/contacts.d.ts.map +1 -0
  8. package/dist/cli/commands/contacts.js +458 -0
  9. package/dist/cli/commands/contacts.js.map +1 -0
  10. package/dist/cli/commands/deals.d.ts +11 -0
  11. package/dist/cli/commands/deals.d.ts.map +1 -0
  12. package/dist/cli/commands/deals.js +498 -0
  13. package/dist/cli/commands/deals.js.map +1 -0
  14. package/dist/cli/commands/media.d.ts +11 -0
  15. package/dist/cli/commands/media.d.ts.map +1 -0
  16. package/dist/cli/commands/media.js +417 -0
  17. package/dist/cli/commands/media.js.map +1 -0
  18. package/dist/cli/commands/search.d.ts +11 -0
  19. package/dist/cli/commands/search.d.ts.map +1 -0
  20. package/dist/cli/commands/search.js +346 -0
  21. package/dist/cli/commands/search.js.map +1 -0
  22. package/dist/cli/index.d.ts +13 -0
  23. package/dist/cli/index.d.ts.map +1 -0
  24. package/dist/cli/index.js +173 -0
  25. package/dist/cli/index.js.map +1 -0
  26. package/dist/cli/repl.d.ts +15 -0
  27. package/dist/cli/repl.d.ts.map +1 -0
  28. package/dist/cli/repl.js +318 -0
  29. package/dist/cli/repl.js.map +1 -0
  30. package/dist/cli/utils/config.d.ts +91 -0
  31. package/dist/cli/utils/config.d.ts.map +1 -0
  32. package/dist/cli/utils/config.js +212 -0
  33. package/dist/cli/utils/config.js.map +1 -0
  34. package/dist/cli/utils/output.d.ts +136 -0
  35. package/dist/cli/utils/output.d.ts.map +1 -0
  36. package/dist/cli/utils/output.js +323 -0
  37. package/dist/cli/utils/output.js.map +1 -0
  38. package/dist/cli/utils/prompt.d.ts +81 -0
  39. package/dist/cli/utils/prompt.d.ts.map +1 -0
  40. package/dist/cli/utils/prompt.js +341 -0
  41. package/dist/cli/utils/prompt.js.map +1 -0
  42. package/dist/cli.d.ts +3 -0
  43. package/dist/cli.d.ts.map +1 -0
  44. package/dist/cli.js +8 -0
  45. package/dist/cli.js.map +1 -0
  46. package/dist/core/index.d.ts +6 -0
  47. package/dist/core/index.d.ts.map +1 -0
  48. package/dist/core/index.js +32 -0
  49. package/dist/core/index.js.map +1 -0
  50. package/dist/core/schemas.d.ts +3050 -0
  51. package/dist/core/schemas.d.ts.map +1 -0
  52. package/dist/core/schemas.js +667 -0
  53. package/dist/core/schemas.js.map +1 -0
  54. package/dist/core/types.d.ts +597 -0
  55. package/dist/core/types.d.ts.map +1 -0
  56. package/dist/core/types.js +8 -0
  57. package/dist/core/types.js.map +1 -0
  58. package/dist/index.d.ts +7 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +8 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/mcp/index.d.ts +14 -0
  63. package/dist/mcp/index.d.ts.map +1 -0
  64. package/dist/mcp/index.js +11 -0
  65. package/dist/mcp/index.js.map +1 -0
  66. package/dist/mcp/server.d.ts +13 -0
  67. package/dist/mcp/server.d.ts.map +1 -0
  68. package/dist/mcp/server.js +18 -0
  69. package/dist/mcp/server.js.map +1 -0
  70. package/dist/mcp/storage/client.d.ts +109 -0
  71. package/dist/mcp/storage/client.d.ts.map +1 -0
  72. package/dist/mcp/storage/client.js +355 -0
  73. package/dist/mcp/storage/client.js.map +1 -0
  74. package/dist/mcp/storage/index.d.ts +7 -0
  75. package/dist/mcp/storage/index.d.ts.map +1 -0
  76. package/dist/mcp/storage/index.js +6 -0
  77. package/dist/mcp/storage/index.js.map +1 -0
  78. package/dist/mcp/storage/types.d.ts +44 -0
  79. package/dist/mcp/storage/types.d.ts.map +1 -0
  80. package/dist/mcp/storage/types.js +35 -0
  81. package/dist/mcp/storage/types.js.map +1 -0
  82. package/dist/mcp/tools/definitions.d.ts +16 -0
  83. package/dist/mcp/tools/definitions.d.ts.map +1 -0
  84. package/dist/mcp/tools/definitions.js +914 -0
  85. package/dist/mcp/tools/definitions.js.map +1 -0
  86. package/dist/mcp/tools/handlers.d.ts +50 -0
  87. package/dist/mcp/tools/handlers.d.ts.map +1 -0
  88. package/dist/mcp/tools/handlers.js +760 -0
  89. package/dist/mcp/tools/handlers.js.map +1 -0
  90. package/dist/mcp/tools/index.d.ts +7 -0
  91. package/dist/mcp/tools/index.d.ts.map +1 -0
  92. package/dist/mcp/tools/index.js +6 -0
  93. package/dist/mcp/tools/index.js.map +1 -0
  94. package/dist/mcp/tools/types.d.ts +314 -0
  95. package/dist/mcp/tools/types.d.ts.map +1 -0
  96. package/dist/mcp/tools/types.js +5 -0
  97. package/dist/mcp/tools/types.js.map +1 -0
  98. package/dist/mcp/transports/stdio.d.ts +27 -0
  99. package/dist/mcp/transports/stdio.d.ts.map +1 -0
  100. package/dist/mcp/transports/stdio.js +237 -0
  101. package/dist/mcp/transports/stdio.js.map +1 -0
  102. package/dist/telemetry/index.d.ts +58 -0
  103. package/dist/telemetry/index.d.ts.map +1 -0
  104. package/dist/telemetry/index.js +109 -0
  105. package/dist/telemetry/index.js.map +1 -0
  106. package/dist/telemetry/logger.d.ts +116 -0
  107. package/dist/telemetry/logger.d.ts.map +1 -0
  108. package/dist/telemetry/logger.js +256 -0
  109. package/dist/telemetry/logger.js.map +1 -0
  110. package/dist/telemetry/metrics.d.ts +115 -0
  111. package/dist/telemetry/metrics.d.ts.map +1 -0
  112. package/dist/telemetry/metrics.js +292 -0
  113. package/dist/telemetry/metrics.js.map +1 -0
  114. package/dist/telemetry/tracer.d.ts +227 -0
  115. package/dist/telemetry/tracer.d.ts.map +1 -0
  116. package/dist/telemetry/tracer.js +355 -0
  117. package/dist/telemetry/tracer.js.map +1 -0
  118. package/dist/web/app.d.ts +2 -0
  119. package/dist/web/app.d.ts.map +1 -0
  120. package/dist/web/app.js +115 -0
  121. package/dist/web/app.js.map +1 -0
  122. package/dist/web/components/ContactList.d.ts +3 -0
  123. package/dist/web/components/ContactList.d.ts.map +1 -0
  124. package/dist/web/components/ContactList.js +262 -0
  125. package/dist/web/components/ContactList.js.map +1 -0
  126. package/dist/web/components/Dashboard.d.ts +3 -0
  127. package/dist/web/components/Dashboard.d.ts.map +1 -0
  128. package/dist/web/components/Dashboard.js +158 -0
  129. package/dist/web/components/Dashboard.js.map +1 -0
  130. package/dist/web/components/DealPipeline.d.ts +3 -0
  131. package/dist/web/components/DealPipeline.d.ts.map +1 -0
  132. package/dist/web/components/DealPipeline.js +306 -0
  133. package/dist/web/components/DealPipeline.js.map +1 -0
  134. package/dist/web/index.d.ts +2 -0
  135. package/dist/web/index.d.ts.map +1 -0
  136. package/dist/web/index.js +269 -0
  137. package/dist/web/index.js.map +1 -0
  138. package/dist/web/types.d.ts +75 -0
  139. package/dist/web/types.d.ts.map +1 -0
  140. package/dist/web/types.js +3 -0
  141. package/dist/web/types.js.map +1 -0
  142. package/native/index.d.ts +571 -0
  143. package/native/index.js +687 -0
  144. package/package.json +105 -0
  145. package/src/cli/commands/activities.ts +543 -0
  146. package/src/cli/commands/contacts.ts +563 -0
  147. package/src/cli/commands/deals.ts +637 -0
  148. package/src/cli/commands/media.ts +521 -0
  149. package/src/cli/commands/search.ts +426 -0
  150. package/src/cli/index.ts +203 -0
  151. package/src/cli/repl.ts +379 -0
  152. package/src/cli/utils/config.ts +299 -0
  153. package/src/cli/utils/output.ts +386 -0
  154. package/src/cli/utils/prompt.ts +444 -0
  155. package/src/cli.ts +11 -0
  156. package/src/core/index.ts +184 -0
  157. package/src/core/schemas.ts +770 -0
  158. package/src/core/types.ts +969 -0
  159. package/src/index.ts +8 -0
  160. package/src/mcp/index.ts +17 -0
  161. package/src/mcp/server.ts +26 -0
  162. package/src/mcp/storage/client.ts +408 -0
  163. package/src/mcp/storage/index.ts +7 -0
  164. package/src/mcp/storage/types.ts +72 -0
  165. package/src/mcp/tools/definitions.ts +961 -0
  166. package/src/mcp/tools/handlers.ts +805 -0
  167. package/src/mcp/tools/index.ts +7 -0
  168. package/src/mcp/tools/types.ts +390 -0
  169. package/src/mcp/transports/stdio.ts +225 -0
  170. package/src/telemetry/index.ts +131 -0
  171. package/src/telemetry/logger.ts +318 -0
  172. package/src/telemetry/metrics.ts +393 -0
  173. package/src/telemetry/tracer.ts +487 -0
  174. package/src/web/api/activities.ts +41 -0
  175. package/src/web/api/contacts.ts +114 -0
  176. package/src/web/api/deals.ts +108 -0
  177. package/src/web/api/media.ts +98 -0
  178. package/src/web/app.tsx +143 -0
  179. package/src/web/components/ActivityFeed.tsx +195 -0
  180. package/src/web/components/ContactList.tsx +340 -0
  181. package/src/web/components/Dashboard.tsx +214 -0
  182. package/src/web/components/DealPipeline.tsx +405 -0
  183. package/src/web/components/MediaGallery.tsx +334 -0
  184. package/src/web/index.html +14 -0
  185. package/src/web/index.ts +326 -0
  186. package/src/web/styles/main.css +180 -0
  187. package/src/web/types.ts +311 -0
@@ -0,0 +1,961 @@
1
+ /**
2
+ * MCP Tool definitions for CRM operations
3
+ * Defines the schema for each tool exposed via MCP
4
+ */
5
+
6
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
7
+
8
+ /** Tool definitions for all CRM MCP tools */
9
+ export const TOOL_DEFINITIONS: Tool[] = [
10
+ // ============================================================================
11
+ // Contact Tools
12
+ // ============================================================================
13
+
14
+ {
15
+ name: 'crm_create_contact',
16
+ description: 'Create a new contact in the CRM',
17
+ inputSchema: {
18
+ type: 'object',
19
+ properties: {
20
+ name: {
21
+ type: 'string',
22
+ description: 'Full name of the contact',
23
+ },
24
+ firstName: {
25
+ type: 'string',
26
+ description: 'First name',
27
+ },
28
+ lastName: {
29
+ type: 'string',
30
+ description: 'Last name',
31
+ },
32
+ emails: {
33
+ type: 'array',
34
+ description: 'Email addresses',
35
+ items: {
36
+ type: 'object',
37
+ properties: {
38
+ email: { type: 'string' },
39
+ type: { type: 'string', enum: ['personal', 'work', 'other'] },
40
+ primary: { type: 'boolean' },
41
+ },
42
+ required: ['email'],
43
+ },
44
+ },
45
+ phones: {
46
+ type: 'array',
47
+ description: 'Phone numbers',
48
+ items: {
49
+ type: 'object',
50
+ properties: {
51
+ number: { type: 'string' },
52
+ type: { type: 'string', enum: ['mobile', 'home', 'work', 'other'] },
53
+ primary: { type: 'boolean' },
54
+ },
55
+ required: ['number'],
56
+ },
57
+ },
58
+ company: {
59
+ type: 'string',
60
+ description: 'Company name',
61
+ },
62
+ title: {
63
+ type: 'string',
64
+ description: 'Job title',
65
+ },
66
+ tags: {
67
+ type: 'array',
68
+ description: 'Tags for categorization',
69
+ items: { type: 'string' },
70
+ },
71
+ source: {
72
+ type: 'string',
73
+ enum: ['organic', 'referral', 'advertisement', 'social_media', 'email_campaign', 'website', 'event', 'cold_outreach', 'partner', 'other'],
74
+ },
75
+ status: {
76
+ type: 'string',
77
+ enum: ['lead', 'prospect', 'qualified', 'customer', 'churned', 'archived'],
78
+ default: 'lead',
79
+ },
80
+ customFields: {
81
+ type: 'array',
82
+ description: 'Custom fields',
83
+ items: {
84
+ type: 'object',
85
+ properties: {
86
+ key: { type: 'string' },
87
+ value: {},
88
+ type: { type: 'string', enum: ['string', 'number', 'boolean', 'date', 'select', 'multiselect'] },
89
+ },
90
+ },
91
+ },
92
+ },
93
+ required: ['name'],
94
+ },
95
+ },
96
+
97
+ {
98
+ name: 'crm_get_contact',
99
+ description: 'Get a contact by ID',
100
+ inputSchema: {
101
+ type: 'object',
102
+ properties: {
103
+ id: {
104
+ type: 'string',
105
+ description: 'Contact ID (UUID)',
106
+ },
107
+ },
108
+ required: ['id'],
109
+ },
110
+ },
111
+
112
+ {
113
+ name: 'crm_update_contact',
114
+ description: 'Update an existing contact',
115
+ inputSchema: {
116
+ type: 'object',
117
+ properties: {
118
+ id: {
119
+ type: 'string',
120
+ description: 'Contact ID to update',
121
+ },
122
+ name: { type: 'string', description: 'Full name' },
123
+ firstName: { type: 'string', description: 'First name' },
124
+ lastName: { type: 'string', description: 'Last name' },
125
+ emails: { type: 'array', description: 'Email addresses', items: { type: 'object' } },
126
+ phones: { type: 'array', description: 'Phone numbers', items: { type: 'object' } },
127
+ company: { type: 'string', description: 'Company name' },
128
+ title: { type: 'string', description: 'Job title' },
129
+ tags: { type: 'array', items: { type: 'string' } },
130
+ status: {
131
+ type: 'string',
132
+ enum: ['lead', 'prospect', 'qualified', 'customer', 'churned', 'archived'],
133
+ },
134
+ customFields: { type: 'array', items: { type: 'object' } },
135
+ },
136
+ required: ['id'],
137
+ },
138
+ },
139
+
140
+ {
141
+ name: 'crm_delete_contact',
142
+ description: 'Delete a contact by ID',
143
+ inputSchema: {
144
+ type: 'object',
145
+ properties: {
146
+ id: {
147
+ type: 'string',
148
+ description: 'Contact ID to delete',
149
+ },
150
+ },
151
+ required: ['id'],
152
+ },
153
+ },
154
+
155
+ {
156
+ name: 'crm_list_contacts',
157
+ description: 'List contacts with optional filtering and pagination',
158
+ inputSchema: {
159
+ type: 'object',
160
+ properties: {
161
+ search: {
162
+ type: 'string',
163
+ description: 'Search query for name, email, company',
164
+ },
165
+ status: {
166
+ type: 'array',
167
+ description: 'Filter by status',
168
+ items: { type: 'string', enum: ['lead', 'prospect', 'qualified', 'customer', 'churned', 'archived'] },
169
+ },
170
+ tags: {
171
+ type: 'array',
172
+ description: 'Filter by tags',
173
+ items: { type: 'string' },
174
+ },
175
+ source: {
176
+ type: 'array',
177
+ description: 'Filter by source',
178
+ items: { type: 'string' },
179
+ },
180
+ limit: {
181
+ type: 'number',
182
+ description: 'Maximum number of results (default: 20)',
183
+ },
184
+ offset: {
185
+ type: 'number',
186
+ description: 'Number of results to skip',
187
+ },
188
+ },
189
+ },
190
+ },
191
+
192
+ {
193
+ name: 'crm_search_contacts',
194
+ description: 'Search contacts by email address',
195
+ inputSchema: {
196
+ type: 'object',
197
+ properties: {
198
+ email: {
199
+ type: 'string',
200
+ description: 'Email address to search for',
201
+ },
202
+ },
203
+ required: ['email'],
204
+ },
205
+ },
206
+
207
+ // ============================================================================
208
+ // Deal Tools
209
+ // ============================================================================
210
+
211
+ {
212
+ name: 'crm_create_deal',
213
+ description: 'Create a new deal/opportunity',
214
+ inputSchema: {
215
+ type: 'object',
216
+ properties: {
217
+ title: {
218
+ type: 'string',
219
+ description: 'Deal title',
220
+ },
221
+ contactId: {
222
+ type: 'string',
223
+ description: 'Associated contact ID',
224
+ },
225
+ value: {
226
+ type: 'number',
227
+ description: 'Deal value',
228
+ },
229
+ currency: {
230
+ type: 'string',
231
+ enum: ['USD', 'EUR', 'GBP', 'CAD', 'AUD', 'JPY', 'CNY', 'INR', 'BRL', 'MXN'],
232
+ default: 'USD',
233
+ },
234
+ stage: {
235
+ type: 'string',
236
+ enum: ['prospecting', 'qualification', 'needs_analysis', 'proposal', 'negotiation', 'closed_won', 'closed_lost'],
237
+ default: 'prospecting',
238
+ },
239
+ probability: {
240
+ type: 'number',
241
+ description: 'Win probability (0-100)',
242
+ minimum: 0,
243
+ maximum: 100,
244
+ },
245
+ expectedClose: {
246
+ type: 'string',
247
+ description: 'Expected close date (ISO 8601)',
248
+ },
249
+ priority: {
250
+ type: 'string',
251
+ enum: ['low', 'medium', 'high', 'urgent'],
252
+ default: 'medium',
253
+ },
254
+ notes: {
255
+ type: 'string',
256
+ description: 'Deal notes',
257
+ },
258
+ tags: {
259
+ type: 'array',
260
+ items: { type: 'string' },
261
+ },
262
+ },
263
+ required: ['title', 'contactId', 'value', 'expectedClose'],
264
+ },
265
+ },
266
+
267
+ {
268
+ name: 'crm_get_deal',
269
+ description: 'Get a deal by ID',
270
+ inputSchema: {
271
+ type: 'object',
272
+ properties: {
273
+ id: {
274
+ type: 'string',
275
+ description: 'Deal ID (UUID)',
276
+ },
277
+ },
278
+ required: ['id'],
279
+ },
280
+ },
281
+
282
+ {
283
+ name: 'crm_update_deal',
284
+ description: 'Update an existing deal',
285
+ inputSchema: {
286
+ type: 'object',
287
+ properties: {
288
+ id: {
289
+ type: 'string',
290
+ description: 'Deal ID to update',
291
+ },
292
+ title: { type: 'string' },
293
+ value: { type: 'number' },
294
+ stage: {
295
+ type: 'string',
296
+ enum: ['prospecting', 'qualification', 'needs_analysis', 'proposal', 'negotiation', 'closed_won', 'closed_lost'],
297
+ },
298
+ probability: { type: 'number', minimum: 0, maximum: 100 },
299
+ expectedClose: { type: 'string' },
300
+ actualClose: { type: 'string' },
301
+ priority: { type: 'string', enum: ['low', 'medium', 'high', 'urgent'] },
302
+ notes: { type: 'string' },
303
+ tags: { type: 'array', items: { type: 'string' } },
304
+ },
305
+ required: ['id'],
306
+ },
307
+ },
308
+
309
+ {
310
+ name: 'crm_delete_deal',
311
+ description: 'Delete a deal by ID',
312
+ inputSchema: {
313
+ type: 'object',
314
+ properties: {
315
+ id: {
316
+ type: 'string',
317
+ description: 'Deal ID to delete',
318
+ },
319
+ },
320
+ required: ['id'],
321
+ },
322
+ },
323
+
324
+ {
325
+ name: 'crm_list_deals',
326
+ description: 'List deals with optional filtering',
327
+ inputSchema: {
328
+ type: 'object',
329
+ properties: {
330
+ contactId: {
331
+ type: 'string',
332
+ description: 'Filter by contact ID',
333
+ },
334
+ stage: {
335
+ type: 'array',
336
+ description: 'Filter by stage',
337
+ items: { type: 'string' },
338
+ },
339
+ priority: {
340
+ type: 'array',
341
+ items: { type: 'string', enum: ['low', 'medium', 'high', 'urgent'] },
342
+ },
343
+ minValue: {
344
+ type: 'number',
345
+ description: 'Minimum deal value',
346
+ },
347
+ maxValue: {
348
+ type: 'number',
349
+ description: 'Maximum deal value',
350
+ },
351
+ limit: { type: 'number' },
352
+ offset: { type: 'number' },
353
+ },
354
+ },
355
+ },
356
+
357
+ {
358
+ name: 'crm_get_deals_by_stage',
359
+ description: 'Get all deals in a specific pipeline stage',
360
+ inputSchema: {
361
+ type: 'object',
362
+ properties: {
363
+ stage: {
364
+ type: 'string',
365
+ enum: ['prospecting', 'qualification', 'needs_analysis', 'proposal', 'negotiation', 'closed_won', 'closed_lost'],
366
+ },
367
+ },
368
+ required: ['stage'],
369
+ },
370
+ },
371
+
372
+ // ============================================================================
373
+ // Activity Tools
374
+ // ============================================================================
375
+
376
+ {
377
+ name: 'crm_create_activity',
378
+ description: 'Log a new activity (call, email, meeting, task, etc.)',
379
+ inputSchema: {
380
+ type: 'object',
381
+ properties: {
382
+ contactId: {
383
+ type: 'string',
384
+ description: 'Associated contact ID',
385
+ },
386
+ dealId: {
387
+ type: 'string',
388
+ description: 'Associated deal ID',
389
+ },
390
+ type: {
391
+ type: 'string',
392
+ enum: ['call', 'email', 'meeting', 'task', 'note', 'sms', 'video_call', 'demo', 'proposal_sent', 'contract_sent', 'follow_up', 'social_media', 'event', 'other'],
393
+ },
394
+ title: {
395
+ type: 'string',
396
+ description: 'Activity title',
397
+ },
398
+ description: {
399
+ type: 'string',
400
+ description: 'Activity description',
401
+ },
402
+ timestamp: {
403
+ type: 'string',
404
+ description: 'Activity timestamp (ISO 8601)',
405
+ },
406
+ duration: {
407
+ type: 'number',
408
+ description: 'Duration in seconds',
409
+ },
410
+ metadata: {
411
+ type: 'object',
412
+ description: 'Activity-specific metadata',
413
+ },
414
+ tags: {
415
+ type: 'array',
416
+ items: { type: 'string' },
417
+ },
418
+ },
419
+ required: ['type', 'title'],
420
+ },
421
+ },
422
+
423
+ {
424
+ name: 'crm_get_activity',
425
+ description: 'Get an activity by ID',
426
+ inputSchema: {
427
+ type: 'object',
428
+ properties: {
429
+ id: {
430
+ type: 'string',
431
+ description: 'Activity ID',
432
+ },
433
+ },
434
+ required: ['id'],
435
+ },
436
+ },
437
+
438
+ {
439
+ name: 'crm_list_activities',
440
+ description: 'List activities with optional filtering',
441
+ inputSchema: {
442
+ type: 'object',
443
+ properties: {
444
+ contactId: {
445
+ type: 'string',
446
+ description: 'Filter by contact ID',
447
+ },
448
+ dealId: {
449
+ type: 'string',
450
+ description: 'Filter by deal ID',
451
+ },
452
+ type: {
453
+ type: 'array',
454
+ description: 'Filter by activity type',
455
+ items: { type: 'string' },
456
+ },
457
+ limit: { type: 'number' },
458
+ offset: { type: 'number' },
459
+ },
460
+ },
461
+ },
462
+
463
+ {
464
+ name: 'crm_delete_activity',
465
+ description: 'Delete an activity by ID',
466
+ inputSchema: {
467
+ type: 'object',
468
+ properties: {
469
+ id: {
470
+ type: 'string',
471
+ description: 'Activity ID to delete',
472
+ },
473
+ },
474
+ required: ['id'],
475
+ },
476
+ },
477
+
478
+ // ============================================================================
479
+ // Media Tools
480
+ // ============================================================================
481
+
482
+ {
483
+ name: 'crm_upload_media',
484
+ description: 'Register a media file (image, video, audio, document) attached to an entity',
485
+ inputSchema: {
486
+ type: 'object',
487
+ properties: {
488
+ entityType: {
489
+ type: 'string',
490
+ enum: ['contact', 'deal', 'activity', 'note', 'company'],
491
+ },
492
+ entityId: {
493
+ type: 'string',
494
+ description: 'ID of the entity this media belongs to',
495
+ },
496
+ type: {
497
+ type: 'string',
498
+ enum: ['image', 'video', 'audio', 'document', 'spreadsheet', 'presentation', 'pdf', 'archive', 'other'],
499
+ },
500
+ filename: {
501
+ type: 'string',
502
+ description: 'Original filename',
503
+ },
504
+ mimeType: {
505
+ type: 'string',
506
+ description: 'MIME type',
507
+ },
508
+ size: {
509
+ type: 'number',
510
+ description: 'File size in bytes',
511
+ },
512
+ url: {
513
+ type: 'string',
514
+ description: 'Storage URL or path',
515
+ },
516
+ thumbnailUrl: {
517
+ type: 'string',
518
+ description: 'Thumbnail URL (for images/videos)',
519
+ },
520
+ altText: {
521
+ type: 'string',
522
+ description: 'Alt text for accessibility',
523
+ },
524
+ caption: {
525
+ type: 'string',
526
+ description: 'Caption/description',
527
+ },
528
+ isPublic: {
529
+ type: 'boolean',
530
+ default: false,
531
+ },
532
+ },
533
+ required: ['entityType', 'entityId', 'type', 'filename', 'mimeType', 'size', 'url'],
534
+ },
535
+ },
536
+
537
+ {
538
+ name: 'crm_get_media',
539
+ description: 'Get media by ID',
540
+ inputSchema: {
541
+ type: 'object',
542
+ properties: {
543
+ id: {
544
+ type: 'string',
545
+ description: 'Media ID',
546
+ },
547
+ },
548
+ required: ['id'],
549
+ },
550
+ },
551
+
552
+ {
553
+ name: 'crm_list_media',
554
+ description: 'List media for an entity',
555
+ inputSchema: {
556
+ type: 'object',
557
+ properties: {
558
+ entityType: {
559
+ type: 'string',
560
+ enum: ['contact', 'deal', 'activity', 'note', 'company'],
561
+ },
562
+ entityId: {
563
+ type: 'string',
564
+ description: 'Entity ID to get media for',
565
+ },
566
+ type: {
567
+ type: 'string',
568
+ enum: ['image', 'video', 'audio', 'document', 'spreadsheet', 'presentation', 'pdf', 'archive', 'other'],
569
+ },
570
+ },
571
+ required: ['entityId'],
572
+ },
573
+ },
574
+
575
+ {
576
+ name: 'crm_delete_media',
577
+ description: 'Delete media by ID',
578
+ inputSchema: {
579
+ type: 'object',
580
+ properties: {
581
+ id: {
582
+ type: 'string',
583
+ description: 'Media ID to delete',
584
+ },
585
+ },
586
+ required: ['id'],
587
+ },
588
+ },
589
+
590
+ // ============================================================================
591
+ // Note Tools
592
+ // ============================================================================
593
+
594
+ {
595
+ name: 'crm_create_note',
596
+ description: 'Create a note attached to a contact or deal',
597
+ inputSchema: {
598
+ type: 'object',
599
+ properties: {
600
+ contactId: {
601
+ type: 'string',
602
+ description: 'Contact ID',
603
+ },
604
+ dealId: {
605
+ type: 'string',
606
+ description: 'Deal ID',
607
+ },
608
+ content: {
609
+ type: 'string',
610
+ description: 'Note content (supports markdown)',
611
+ },
612
+ format: {
613
+ type: 'string',
614
+ enum: ['plain', 'markdown', 'html'],
615
+ default: 'markdown',
616
+ },
617
+ title: {
618
+ type: 'string',
619
+ description: 'Note title',
620
+ },
621
+ visibility: {
622
+ type: 'string',
623
+ enum: ['private', 'team', 'public'],
624
+ default: 'team',
625
+ },
626
+ pinned: {
627
+ type: 'boolean',
628
+ default: false,
629
+ },
630
+ tags: {
631
+ type: 'array',
632
+ items: { type: 'string' },
633
+ },
634
+ },
635
+ required: ['content'],
636
+ },
637
+ },
638
+
639
+ {
640
+ name: 'crm_get_note',
641
+ description: 'Get a note by ID',
642
+ inputSchema: {
643
+ type: 'object',
644
+ properties: {
645
+ id: {
646
+ type: 'string',
647
+ description: 'Note ID',
648
+ },
649
+ },
650
+ required: ['id'],
651
+ },
652
+ },
653
+
654
+ {
655
+ name: 'crm_update_note',
656
+ description: 'Update an existing note',
657
+ inputSchema: {
658
+ type: 'object',
659
+ properties: {
660
+ id: {
661
+ type: 'string',
662
+ description: 'Note ID to update',
663
+ },
664
+ content: { type: 'string' },
665
+ title: { type: 'string' },
666
+ visibility: { type: 'string', enum: ['private', 'team', 'public'] },
667
+ pinned: { type: 'boolean' },
668
+ tags: { type: 'array', items: { type: 'string' } },
669
+ },
670
+ required: ['id'],
671
+ },
672
+ },
673
+
674
+ {
675
+ name: 'crm_delete_note',
676
+ description: 'Delete a note by ID',
677
+ inputSchema: {
678
+ type: 'object',
679
+ properties: {
680
+ id: {
681
+ type: 'string',
682
+ description: 'Note ID to delete',
683
+ },
684
+ },
685
+ required: ['id'],
686
+ },
687
+ },
688
+
689
+ {
690
+ name: 'crm_list_notes',
691
+ description: 'List notes for a contact or deal',
692
+ inputSchema: {
693
+ type: 'object',
694
+ properties: {
695
+ contactId: {
696
+ type: 'string',
697
+ description: 'Filter by contact ID',
698
+ },
699
+ dealId: {
700
+ type: 'string',
701
+ description: 'Filter by deal ID',
702
+ },
703
+ limit: { type: 'number' },
704
+ offset: { type: 'number' },
705
+ },
706
+ },
707
+ },
708
+
709
+ // ============================================================================
710
+ // Tag Tools
711
+ // ============================================================================
712
+
713
+ {
714
+ name: 'crm_create_tag',
715
+ description: 'Create a new tag for categorization',
716
+ inputSchema: {
717
+ type: 'object',
718
+ properties: {
719
+ name: {
720
+ type: 'string',
721
+ description: 'Tag name (slug-friendly)',
722
+ pattern: '^[a-z0-9-]+$',
723
+ },
724
+ label: {
725
+ type: 'string',
726
+ description: 'Display label',
727
+ },
728
+ color: {
729
+ type: 'string',
730
+ description: 'Color (hex or named)',
731
+ },
732
+ category: {
733
+ type: 'string',
734
+ enum: ['general', 'industry', 'source', 'status', 'priority', 'product', 'region', 'custom'],
735
+ default: 'general',
736
+ },
737
+ description: {
738
+ type: 'string',
739
+ description: 'Tag description',
740
+ },
741
+ icon: {
742
+ type: 'string',
743
+ description: 'Icon (emoji or icon name)',
744
+ },
745
+ parentId: {
746
+ type: 'string',
747
+ description: 'Parent tag ID (for hierarchical tags)',
748
+ },
749
+ },
750
+ required: ['name', 'label', 'color'],
751
+ },
752
+ },
753
+
754
+ {
755
+ name: 'crm_get_tag',
756
+ description: 'Get a tag by ID or name',
757
+ inputSchema: {
758
+ type: 'object',
759
+ properties: {
760
+ id: {
761
+ type: 'string',
762
+ description: 'Tag ID',
763
+ },
764
+ name: {
765
+ type: 'string',
766
+ description: 'Tag name',
767
+ },
768
+ },
769
+ },
770
+ },
771
+
772
+ {
773
+ name: 'crm_list_tags',
774
+ description: 'List all tags',
775
+ inputSchema: {
776
+ type: 'object',
777
+ properties: {
778
+ category: {
779
+ type: 'string',
780
+ enum: ['general', 'industry', 'source', 'status', 'priority', 'product', 'region', 'custom'],
781
+ },
782
+ },
783
+ },
784
+ },
785
+
786
+ {
787
+ name: 'crm_delete_tag',
788
+ description: 'Delete a tag by ID',
789
+ inputSchema: {
790
+ type: 'object',
791
+ properties: {
792
+ id: {
793
+ type: 'string',
794
+ description: 'Tag ID to delete',
795
+ },
796
+ },
797
+ required: ['id'],
798
+ },
799
+ },
800
+
801
+ // ============================================================================
802
+ // Company Tools
803
+ // ============================================================================
804
+
805
+ {
806
+ name: 'crm_create_company',
807
+ description: 'Create a company/organization',
808
+ inputSchema: {
809
+ type: 'object',
810
+ properties: {
811
+ name: {
812
+ type: 'string',
813
+ description: 'Company name',
814
+ },
815
+ website: {
816
+ type: 'string',
817
+ description: 'Website URL',
818
+ },
819
+ industry: {
820
+ type: 'string',
821
+ enum: ['technology', 'finance', 'healthcare', 'education', 'retail', 'manufacturing', 'consulting', 'marketing', 'legal', 'real_estate', 'construction', 'transportation', 'hospitality', 'energy', 'telecommunications', 'government', 'non_profit', 'other'],
822
+ },
823
+ size: {
824
+ type: 'string',
825
+ enum: ['sole_proprietor', 'startup', 'small', 'medium', 'large', 'enterprise'],
826
+ },
827
+ employeeCount: {
828
+ type: 'number',
829
+ description: 'Number of employees',
830
+ },
831
+ annualRevenue: {
832
+ type: 'number',
833
+ description: 'Annual revenue',
834
+ },
835
+ tags: {
836
+ type: 'array',
837
+ items: { type: 'string' },
838
+ },
839
+ },
840
+ required: ['name'],
841
+ },
842
+ },
843
+
844
+ {
845
+ name: 'crm_get_company',
846
+ description: 'Get a company by ID',
847
+ inputSchema: {
848
+ type: 'object',
849
+ properties: {
850
+ id: {
851
+ type: 'string',
852
+ description: 'Company ID',
853
+ },
854
+ },
855
+ required: ['id'],
856
+ },
857
+ },
858
+
859
+ {
860
+ name: 'crm_update_company',
861
+ description: 'Update a company',
862
+ inputSchema: {
863
+ type: 'object',
864
+ properties: {
865
+ id: {
866
+ type: 'string',
867
+ description: 'Company ID to update',
868
+ },
869
+ name: { type: 'string' },
870
+ website: { type: 'string' },
871
+ industry: { type: 'string' },
872
+ size: { type: 'string' },
873
+ employeeCount: { type: 'number' },
874
+ annualRevenue: { type: 'number' },
875
+ tags: { type: 'array', items: { type: 'string' } },
876
+ },
877
+ required: ['id'],
878
+ },
879
+ },
880
+
881
+ {
882
+ name: 'crm_delete_company',
883
+ description: 'Delete a company by ID',
884
+ inputSchema: {
885
+ type: 'object',
886
+ properties: {
887
+ id: {
888
+ type: 'string',
889
+ description: 'Company ID to delete',
890
+ },
891
+ },
892
+ required: ['id'],
893
+ },
894
+ },
895
+
896
+ {
897
+ name: 'crm_list_companies',
898
+ description: 'List companies with optional filtering',
899
+ inputSchema: {
900
+ type: 'object',
901
+ properties: {
902
+ search: {
903
+ type: 'string',
904
+ description: 'Search query for company name',
905
+ },
906
+ industry: {
907
+ type: 'string',
908
+ enum: ['technology', 'finance', 'healthcare', 'education', 'retail', 'manufacturing', 'consulting', 'marketing', 'legal', 'real_estate', 'construction', 'transportation', 'hospitality', 'energy', 'telecommunications', 'government', 'non_profit', 'other'],
909
+ },
910
+ size: {
911
+ type: 'array',
912
+ items: { type: 'string', enum: ['sole_proprietor', 'startup', 'small', 'medium', 'large', 'enterprise'] },
913
+ },
914
+ limit: { type: 'number' },
915
+ offset: { type: 'number' },
916
+ },
917
+ },
918
+ },
919
+
920
+ // ============================================================================
921
+ // Stats & Dashboard Tools
922
+ // ============================================================================
923
+
924
+ {
925
+ name: 'crm_get_stats',
926
+ description: 'Get CRM statistics (counts of all entity types)',
927
+ inputSchema: {
928
+ type: 'object',
929
+ properties: {},
930
+ },
931
+ },
932
+
933
+ {
934
+ name: 'crm_get_dashboard',
935
+ description: 'Get dashboard data with deals by stage and recent activities',
936
+ inputSchema: {
937
+ type: 'object',
938
+ properties: {
939
+ period: {
940
+ type: 'string',
941
+ enum: ['day', 'week', 'month', 'quarter', 'year'],
942
+ default: 'month',
943
+ },
944
+ },
945
+ },
946
+ },
947
+ ];
948
+
949
+ /**
950
+ * Get tool definition by name
951
+ */
952
+ export function getToolDefinition(name: string): Tool | undefined {
953
+ return TOOL_DEFINITIONS.find((t) => t.name === name);
954
+ }
955
+
956
+ /**
957
+ * List all tool names
958
+ */
959
+ export function listToolNames(): string[] {
960
+ return TOOL_DEFINITIONS.map((t) => t.name);
961
+ }