dalvon-mcp 3.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.
- package/LICENSE +7 -0
- package/README.md +743 -0
- package/dist/clients/dalvon.d.ts +258 -0
- package/dist/clients/dalvon.d.ts.map +1 -0
- package/dist/clients/dalvon.js +1240 -0
- package/dist/clients/dalvon.js.map +1 -0
- package/dist/clients/knowledge.d.ts +59 -0
- package/dist/clients/knowledge.d.ts.map +1 -0
- package/dist/clients/knowledge.js +267 -0
- package/dist/clients/knowledge.js.map +1 -0
- package/dist/clients/telefonieren.d.ts +258 -0
- package/dist/clients/telefonieren.d.ts.map +1 -0
- package/dist/clients/telefonieren.js +1240 -0
- package/dist/clients/telefonieren.js.map +1 -0
- package/dist/config.d.ts +43 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +76 -0
- package/dist/config.js.map +1 -0
- package/dist/environment.d.ts +33 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +63 -0
- package/dist/environment.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/agents.d.ts +8 -0
- package/dist/tools/agents.d.ts.map +1 -0
- package/dist/tools/agents.js +1880 -0
- package/dist/tools/agents.js.map +1 -0
- package/dist/tools/billing.d.ts +8 -0
- package/dist/tools/billing.d.ts.map +1 -0
- package/dist/tools/billing.js +205 -0
- package/dist/tools/billing.js.map +1 -0
- package/dist/tools/calendar.d.ts +8 -0
- package/dist/tools/calendar.d.ts.map +1 -0
- package/dist/tools/calendar.js +347 -0
- package/dist/tools/calendar.js.map +1 -0
- package/dist/tools/calls.d.ts +8 -0
- package/dist/tools/calls.d.ts.map +1 -0
- package/dist/tools/calls.js +508 -0
- package/dist/tools/calls.js.map +1 -0
- package/dist/tools/campaigns.d.ts +8 -0
- package/dist/tools/campaigns.d.ts.map +1 -0
- package/dist/tools/campaigns.js +531 -0
- package/dist/tools/campaigns.js.map +1 -0
- package/dist/tools/channels.d.ts +8 -0
- package/dist/tools/channels.d.ts.map +1 -0
- package/dist/tools/channels.js +165 -0
- package/dist/tools/channels.js.map +1 -0
- package/dist/tools/chats.d.ts +8 -0
- package/dist/tools/chats.d.ts.map +1 -0
- package/dist/tools/chats.js +142 -0
- package/dist/tools/chats.js.map +1 -0
- package/dist/tools/collections.d.ts +8 -0
- package/dist/tools/collections.d.ts.map +1 -0
- package/dist/tools/collections.js +389 -0
- package/dist/tools/collections.js.map +1 -0
- package/dist/tools/contacts.d.ts +8 -0
- package/dist/tools/contacts.d.ts.map +1 -0
- package/dist/tools/contacts.js +430 -0
- package/dist/tools/contacts.js.map +1 -0
- package/dist/tools/crawler.d.ts +8 -0
- package/dist/tools/crawler.d.ts.map +1 -0
- package/dist/tools/crawler.js +263 -0
- package/dist/tools/crawler.js.map +1 -0
- package/dist/tools/dnc.d.ts +8 -0
- package/dist/tools/dnc.d.ts.map +1 -0
- package/dist/tools/dnc.js +287 -0
- package/dist/tools/dnc.js.map +1 -0
- package/dist/tools/documents.d.ts +9 -0
- package/dist/tools/documents.d.ts.map +1 -0
- package/dist/tools/documents.js +518 -0
- package/dist/tools/documents.js.map +1 -0
- package/dist/tools/engines.d.ts +8 -0
- package/dist/tools/engines.d.ts.map +1 -0
- package/dist/tools/engines.js +271 -0
- package/dist/tools/engines.js.map +1 -0
- package/dist/tools/environment.d.ts +9 -0
- package/dist/tools/environment.d.ts.map +1 -0
- package/dist/tools/environment.js +59 -0
- package/dist/tools/environment.js.map +1 -0
- package/dist/tools/forwarding.d.ts +8 -0
- package/dist/tools/forwarding.d.ts.map +1 -0
- package/dist/tools/forwarding.js +30 -0
- package/dist/tools/forwarding.js.map +1 -0
- package/dist/tools/index.d.ts +58 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +158 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/integrations.d.ts +8 -0
- package/dist/tools/integrations.d.ts.map +1 -0
- package/dist/tools/integrations.js +234 -0
- package/dist/tools/integrations.js.map +1 -0
- package/dist/tools/mailbox.d.ts +8 -0
- package/dist/tools/mailbox.d.ts.map +1 -0
- package/dist/tools/mailbox.js +105 -0
- package/dist/tools/mailbox.js.map +1 -0
- package/dist/tools/media.d.ts +8 -0
- package/dist/tools/media.d.ts.map +1 -0
- package/dist/tools/media.js +223 -0
- package/dist/tools/media.js.map +1 -0
- package/dist/tools/numbers.d.ts +8 -0
- package/dist/tools/numbers.d.ts.map +1 -0
- package/dist/tools/numbers.js +560 -0
- package/dist/tools/numbers.js.map +1 -0
- package/dist/tools/organizations.d.ts +8 -0
- package/dist/tools/organizations.d.ts.map +1 -0
- package/dist/tools/organizations.js +234 -0
- package/dist/tools/organizations.js.map +1 -0
- package/dist/tools/postprocessing.d.ts +8 -0
- package/dist/tools/postprocessing.d.ts.map +1 -0
- package/dist/tools/postprocessing.js +383 -0
- package/dist/tools/postprocessing.js.map +1 -0
- package/dist/tools/pronunciations.d.ts +8 -0
- package/dist/tools/pronunciations.d.ts.map +1 -0
- package/dist/tools/pronunciations.js +236 -0
- package/dist/tools/pronunciations.js.map +1 -0
- package/dist/tools/rules.d.ts +8 -0
- package/dist/tools/rules.d.ts.map +1 -0
- package/dist/tools/rules.js +465 -0
- package/dist/tools/rules.js.map +1 -0
- package/dist/tools/statistics.d.ts +8 -0
- package/dist/tools/statistics.d.ts.map +1 -0
- package/dist/tools/statistics.js +120 -0
- package/dist/tools/statistics.js.map +1 -0
- package/dist/tools/templates.d.ts +8 -0
- package/dist/tools/templates.d.ts.map +1 -0
- package/dist/tools/templates.js +211 -0
- package/dist/tools/templates.js.map +1 -0
- package/dist/tools/tests.d.ts +8 -0
- package/dist/tools/tests.d.ts.map +1 -0
- package/dist/tools/tests.js +329 -0
- package/dist/tools/tests.js.map +1 -0
- package/dist/tools/users.d.ts +8 -0
- package/dist/tools/users.d.ts.map +1 -0
- package/dist/tools/users.js +484 -0
- package/dist/tools/users.js.map +1 -0
- package/dist/tools/voice-preview.d.ts +8 -0
- package/dist/tools/voice-preview.d.ts.map +1 -0
- package/dist/tools/voice-preview.js +100 -0
- package/dist/tools/voice-preview.js.map +1 -0
- package/dist/tools/voices.d.ts +8 -0
- package/dist/tools/voices.d.ts.map +1 -0
- package/dist/tools/voices.js +110 -0
- package/dist/tools/voices.js.map +1 -0
- package/dist/tools/whitelabels.d.ts +8 -0
- package/dist/tools/whitelabels.d.ts.map +1 -0
- package/dist/tools/whitelabels.js +199 -0
- package/dist/tools/whitelabels.js.map +1 -0
- package/dist/tools/widget-config.d.ts +8 -0
- package/dist/tools/widget-config.d.ts.map +1 -0
- package/dist/tools/widget-config.js +116 -0
- package/dist/tools/widget-config.js.map +1 -0
- package/dist/types/api.d.ts +303 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +6 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/tools.d.ts +41 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +6 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/utils/errors.d.ts +31 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +77 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +25 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/validation.d.ts +34 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +68 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contact Management Tools (Phase 1)
|
|
3
|
+
* 8 tools for managing dalvon.ai contacts
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { validateUUID } from '../utils/validation.js';
|
|
7
|
+
import { formatApiError, createError, createSuccess, isApiError } from '../utils/errors.js';
|
|
8
|
+
// Zod Schemas
|
|
9
|
+
const listContactsSchema = z.object({
|
|
10
|
+
target_user_id: z.string().uuid().optional().describe('Impersonate user to see their contacts (requires admin/platform permissions)'),
|
|
11
|
+
scope: z.enum(['user', 'organization', 'whitelabel', 'platform']).optional().describe('Expand view scope (admin only)'),
|
|
12
|
+
visibility: z.array(z.enum(['user', 'organization', 'whitelabel', 'platform'])).optional().describe('Filter by visibility levels'),
|
|
13
|
+
name: z.string().optional(),
|
|
14
|
+
phone: z.string().optional(),
|
|
15
|
+
email: z.string().optional(),
|
|
16
|
+
tags: z.array(z.string()).optional(),
|
|
17
|
+
categories: z.array(z.string()).optional(),
|
|
18
|
+
search: z.string().optional(),
|
|
19
|
+
sort_by: z.enum(['name', 'created_at', 'updated_at', 'last_contact_date']).default('created_at'),
|
|
20
|
+
sort_direction: z.enum(['ASC', 'DESC']).default('DESC'),
|
|
21
|
+
limit: z.number().min(1).max(100).default(30),
|
|
22
|
+
offset: z.number().min(0).default(0),
|
|
23
|
+
});
|
|
24
|
+
const getContactSchema = z.object({
|
|
25
|
+
contact_id: z.string(),
|
|
26
|
+
target_user_id: z.string().uuid().optional().describe('Impersonate user (requires admin/platform permissions)'),
|
|
27
|
+
});
|
|
28
|
+
const createContactSchema = z.object({
|
|
29
|
+
target_user_id: z.string().uuid().optional().describe('Impersonate user (requires admin/platform permissions)'),
|
|
30
|
+
name: z.string().min(1),
|
|
31
|
+
phone: z.string().regex(/^\+?[1-9]\d{1,14}$/, 'Invalid phone number format (E.164)'),
|
|
32
|
+
email: z.string().email().optional(),
|
|
33
|
+
tags: z.array(z.string()).optional(),
|
|
34
|
+
categories: z.array(z.string()).optional(),
|
|
35
|
+
custom_fields: z.record(z.unknown()).optional(),
|
|
36
|
+
notes: z.string().optional(),
|
|
37
|
+
});
|
|
38
|
+
const updateContactSchema = z.object({
|
|
39
|
+
contact_id: z.string(),
|
|
40
|
+
target_user_id: z.string().uuid().optional().describe('Impersonate user (requires admin/platform permissions)'),
|
|
41
|
+
name: z.string().optional(),
|
|
42
|
+
phone: z.string().regex(/^\+?[1-9]\d{1,14}$/, 'Invalid phone number format (E.164)').optional(),
|
|
43
|
+
email: z.string().email().optional(),
|
|
44
|
+
tags: z.array(z.string()).optional(),
|
|
45
|
+
categories: z.array(z.string()).optional(),
|
|
46
|
+
custom_fields: z.record(z.unknown()).optional(),
|
|
47
|
+
notes: z.string().optional(),
|
|
48
|
+
});
|
|
49
|
+
const deleteContactSchema = z.object({
|
|
50
|
+
contact_id: z.string(),
|
|
51
|
+
target_user_id: z.string().uuid().optional().describe('Impersonate user (requires admin/platform permissions)'),
|
|
52
|
+
});
|
|
53
|
+
const bulkDeleteContactsSchema = z.object({
|
|
54
|
+
contact_ids: z.array(z.string()).min(1),
|
|
55
|
+
});
|
|
56
|
+
const manageContactCategoriesSchema = z.object({
|
|
57
|
+
contact_id: z.string(),
|
|
58
|
+
action: z.enum(['add', 'remove']),
|
|
59
|
+
categories: z.array(z.string()).min(1),
|
|
60
|
+
});
|
|
61
|
+
const importContactsSchema = z.object({
|
|
62
|
+
file_path: z.string(),
|
|
63
|
+
skip_duplicates: z.boolean().default(true),
|
|
64
|
+
update_existing: z.boolean().default(false),
|
|
65
|
+
});
|
|
66
|
+
export function createContactTools(client) {
|
|
67
|
+
return [
|
|
68
|
+
// list_contacts
|
|
69
|
+
{
|
|
70
|
+
name: 'list_contacts',
|
|
71
|
+
description: 'List all contacts with filtering and pagination. Search by name, phone, email, tags, or categories.\n\n**Cross-User Access:** Use `target_user_id` to impersonate another user (requires admin/platform permissions). Use `scope` to expand view beyond your own resources.',
|
|
72
|
+
inputSchema: {
|
|
73
|
+
type: 'object',
|
|
74
|
+
properties: {
|
|
75
|
+
target_user_id: { type: 'string', description: 'Impersonate user to see their contacts (requires admin/platform permissions)' },
|
|
76
|
+
scope: { type: 'string', enum: ['user', 'organization', 'whitelabel', 'platform'], description: 'Expand view scope (admin only)' },
|
|
77
|
+
visibility: { type: 'array', items: { type: 'string', enum: ['user', 'organization', 'whitelabel', 'platform'] }, description: 'Filter by visibility levels' },
|
|
78
|
+
name: { type: 'string', description: 'Filter by contact name (partial match)' },
|
|
79
|
+
phone: { type: 'string', description: 'Filter by phone number (partial match)' },
|
|
80
|
+
email: { type: 'string', description: 'Filter by email address (partial match)' },
|
|
81
|
+
tags: { type: 'array', items: { type: 'string' }, description: 'Filter by tags' },
|
|
82
|
+
categories: { type: 'array', items: { type: 'string' }, description: 'Filter by categories' },
|
|
83
|
+
search: { type: 'string', description: 'Search across name, phone, email' },
|
|
84
|
+
sort_by: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
enum: ['name', 'created_at', 'updated_at', 'last_contact_date'],
|
|
87
|
+
default: 'created_at',
|
|
88
|
+
},
|
|
89
|
+
sort_direction: { type: 'string', enum: ['ASC', 'DESC'], default: 'DESC' },
|
|
90
|
+
limit: { type: 'integer', minimum: 1, maximum: 100, default: 30 },
|
|
91
|
+
offset: { type: 'integer', minimum: 0, default: 0 },
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
handler: async (args) => {
|
|
95
|
+
const parsed = listContactsSchema.safeParse(args);
|
|
96
|
+
if (!parsed.success) {
|
|
97
|
+
return createError(`Invalid arguments: ${parsed.error.message}`);
|
|
98
|
+
}
|
|
99
|
+
const result = await client.listContacts(parsed.data);
|
|
100
|
+
if (!result.success || isApiError(result)) {
|
|
101
|
+
return formatApiError(result, 'list_contacts');
|
|
102
|
+
}
|
|
103
|
+
const contacts = result.data || [];
|
|
104
|
+
return createSuccess({
|
|
105
|
+
count: contacts.length,
|
|
106
|
+
contacts,
|
|
107
|
+
filters_applied: parsed.data,
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
// get_contact
|
|
112
|
+
{
|
|
113
|
+
name: 'get_contact',
|
|
114
|
+
description: 'Get detailed information about a specific contact including custom fields and call history.',
|
|
115
|
+
inputSchema: {
|
|
116
|
+
type: 'object',
|
|
117
|
+
properties: {
|
|
118
|
+
contact_id: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
description: 'UUID of the contact',
|
|
121
|
+
pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$',
|
|
122
|
+
},
|
|
123
|
+
target_user_id: { type: 'string', description: 'Impersonate user (requires admin/platform permissions)' },
|
|
124
|
+
},
|
|
125
|
+
required: ['contact_id'],
|
|
126
|
+
},
|
|
127
|
+
handler: async (args) => {
|
|
128
|
+
const parsed = getContactSchema.safeParse(args);
|
|
129
|
+
if (!parsed.success) {
|
|
130
|
+
return createError(`Invalid arguments: ${parsed.error.message}`);
|
|
131
|
+
}
|
|
132
|
+
const validationError = validateUUID(parsed.data.contact_id, 'contact_id');
|
|
133
|
+
if (validationError)
|
|
134
|
+
return validationError;
|
|
135
|
+
const result = await client.getContact(parsed.data.contact_id, parsed.data.target_user_id);
|
|
136
|
+
if (!result.success || isApiError(result)) {
|
|
137
|
+
return formatApiError(result, 'get_contact', 'Check if the contact_id is correct using list_contacts');
|
|
138
|
+
}
|
|
139
|
+
return result;
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
// create_contact
|
|
143
|
+
{
|
|
144
|
+
name: 'create_contact',
|
|
145
|
+
description: 'Create or update a contact. If a contact with the same phone number already exists, it will be updated instead of creating a duplicate.',
|
|
146
|
+
inputSchema: {
|
|
147
|
+
type: 'object',
|
|
148
|
+
properties: {
|
|
149
|
+
target_user_id: { type: 'string', description: 'Impersonate user (requires admin/platform permissions)' },
|
|
150
|
+
name: { type: 'string', description: 'Full name of the contact', minLength: 1 },
|
|
151
|
+
phone: {
|
|
152
|
+
type: 'string',
|
|
153
|
+
description: 'Phone number in E.164 format (e.g., +491234567890)',
|
|
154
|
+
pattern: '^\\+?[1-9]\\d{1,14}$',
|
|
155
|
+
},
|
|
156
|
+
email: { type: 'string', description: 'Email address', format: 'email' },
|
|
157
|
+
tags: { type: 'array', items: { type: 'string' }, description: 'Tags for organizing contacts' },
|
|
158
|
+
categories: { type: 'array', items: { type: 'string' }, description: 'Categories for the contact' },
|
|
159
|
+
custom_fields: { type: 'object', description: 'Custom key-value pairs for additional data' },
|
|
160
|
+
notes: { type: 'string', description: 'Notes about the contact' },
|
|
161
|
+
},
|
|
162
|
+
required: ['name', 'phone'],
|
|
163
|
+
},
|
|
164
|
+
handler: async (args) => {
|
|
165
|
+
const parsed = createContactSchema.safeParse(args);
|
|
166
|
+
if (!parsed.success) {
|
|
167
|
+
return createError(`Invalid arguments: ${parsed.error.message}`);
|
|
168
|
+
}
|
|
169
|
+
const { target_user_id, ...contactData } = parsed.data;
|
|
170
|
+
const result = await client.createContact(contactData, target_user_id);
|
|
171
|
+
if (!result.success || isApiError(result)) {
|
|
172
|
+
return formatApiError(result, 'create_contact');
|
|
173
|
+
}
|
|
174
|
+
const contact = result.data;
|
|
175
|
+
return createSuccess({
|
|
176
|
+
contact_id: contact?.id,
|
|
177
|
+
name: contact?.name,
|
|
178
|
+
phone: contact?.phone,
|
|
179
|
+
created: true,
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
// update_contact
|
|
184
|
+
{
|
|
185
|
+
name: 'update_contact',
|
|
186
|
+
description: 'Update an existing contact. Only provide fields you want to change.',
|
|
187
|
+
inputSchema: {
|
|
188
|
+
type: 'object',
|
|
189
|
+
properties: {
|
|
190
|
+
contact_id: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
description: 'UUID of the contact to update',
|
|
193
|
+
pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$',
|
|
194
|
+
},
|
|
195
|
+
target_user_id: { type: 'string', description: 'Impersonate user (requires admin/platform permissions)' },
|
|
196
|
+
name: { type: 'string', description: 'Updated name' },
|
|
197
|
+
phone: {
|
|
198
|
+
type: 'string',
|
|
199
|
+
description: 'Updated phone number in E.164 format',
|
|
200
|
+
pattern: '^\\+?[1-9]\\d{1,14}$',
|
|
201
|
+
},
|
|
202
|
+
email: { type: 'string', description: 'Updated email address', format: 'email' },
|
|
203
|
+
tags: { type: 'array', items: { type: 'string' }, description: 'Updated tags (replaces existing)' },
|
|
204
|
+
categories: {
|
|
205
|
+
type: 'array',
|
|
206
|
+
items: { type: 'string' },
|
|
207
|
+
description: 'Updated categories (replaces existing)',
|
|
208
|
+
},
|
|
209
|
+
custom_fields: { type: 'object', description: 'Updated custom fields (merges with existing)' },
|
|
210
|
+
notes: { type: 'string', description: 'Updated notes' },
|
|
211
|
+
},
|
|
212
|
+
required: ['contact_id'],
|
|
213
|
+
},
|
|
214
|
+
handler: async (args) => {
|
|
215
|
+
const parsed = updateContactSchema.safeParse(args);
|
|
216
|
+
if (!parsed.success) {
|
|
217
|
+
return createError(`Invalid arguments: ${parsed.error.message}`);
|
|
218
|
+
}
|
|
219
|
+
const validationError = validateUUID(parsed.data.contact_id, 'contact_id');
|
|
220
|
+
if (validationError)
|
|
221
|
+
return validationError;
|
|
222
|
+
const { contact_id, target_user_id: contactTargetUserId, ...updateData } = parsed.data;
|
|
223
|
+
// Check if there's anything to update
|
|
224
|
+
const nonNullFields = Object.entries(updateData).filter(([, v]) => v !== undefined);
|
|
225
|
+
if (nonNullFields.length === 0) {
|
|
226
|
+
return createError('No fields to update', 'Provide at least one field to update');
|
|
227
|
+
}
|
|
228
|
+
const result = await client.updateContact(contact_id, updateData, contactTargetUserId);
|
|
229
|
+
if (!result.success || isApiError(result)) {
|
|
230
|
+
return formatApiError(result, 'update_contact');
|
|
231
|
+
}
|
|
232
|
+
return createSuccess({
|
|
233
|
+
contact_id,
|
|
234
|
+
updated_fields: nonNullFields.map(([k]) => k),
|
|
235
|
+
updated: true,
|
|
236
|
+
data: result.data,
|
|
237
|
+
});
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
// delete_contact
|
|
241
|
+
{
|
|
242
|
+
name: 'delete_contact',
|
|
243
|
+
description: 'Permanently delete a contact. WARNING: This action is irreversible!',
|
|
244
|
+
inputSchema: {
|
|
245
|
+
type: 'object',
|
|
246
|
+
properties: {
|
|
247
|
+
contact_id: {
|
|
248
|
+
type: 'string',
|
|
249
|
+
description: 'UUID of the contact to delete',
|
|
250
|
+
pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$',
|
|
251
|
+
},
|
|
252
|
+
target_user_id: { type: 'string', description: 'Impersonate user (requires admin/platform permissions)' },
|
|
253
|
+
},
|
|
254
|
+
required: ['contact_id'],
|
|
255
|
+
},
|
|
256
|
+
handler: async (args) => {
|
|
257
|
+
const parsed = deleteContactSchema.safeParse(args);
|
|
258
|
+
if (!parsed.success) {
|
|
259
|
+
return createError(`Invalid arguments: ${parsed.error.message}`);
|
|
260
|
+
}
|
|
261
|
+
const validationError = validateUUID(parsed.data.contact_id, 'contact_id');
|
|
262
|
+
if (validationError)
|
|
263
|
+
return validationError;
|
|
264
|
+
const result = await client.deleteContact(parsed.data.contact_id, parsed.data.target_user_id);
|
|
265
|
+
if (!result.success || isApiError(result)) {
|
|
266
|
+
return formatApiError(result, 'delete_contact');
|
|
267
|
+
}
|
|
268
|
+
return createSuccess({
|
|
269
|
+
contact_id: parsed.data.contact_id,
|
|
270
|
+
deleted: true,
|
|
271
|
+
warning: 'Contact permanently deleted - cannot be restored',
|
|
272
|
+
});
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
// bulk_delete_contacts
|
|
276
|
+
{
|
|
277
|
+
name: 'bulk_delete_contacts',
|
|
278
|
+
description: 'Delete multiple contacts at once. WARNING: This action is irreversible!',
|
|
279
|
+
inputSchema: {
|
|
280
|
+
type: 'object',
|
|
281
|
+
properties: {
|
|
282
|
+
contact_ids: {
|
|
283
|
+
type: 'array',
|
|
284
|
+
items: { type: 'string' },
|
|
285
|
+
description: 'Array of contact UUIDs to delete',
|
|
286
|
+
minItems: 1,
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
required: ['contact_ids'],
|
|
290
|
+
},
|
|
291
|
+
handler: async (args) => {
|
|
292
|
+
const parsed = bulkDeleteContactsSchema.safeParse(args);
|
|
293
|
+
if (!parsed.success) {
|
|
294
|
+
return createError(`Invalid arguments: ${parsed.error.message}`);
|
|
295
|
+
}
|
|
296
|
+
// Validate all UUIDs
|
|
297
|
+
for (const contact_id of parsed.data.contact_ids) {
|
|
298
|
+
const validationError = validateUUID(contact_id, 'contact_id');
|
|
299
|
+
if (validationError)
|
|
300
|
+
return validationError;
|
|
301
|
+
}
|
|
302
|
+
const result = await client.bulkDeleteContacts(parsed.data.contact_ids);
|
|
303
|
+
if (!result.success || isApiError(result)) {
|
|
304
|
+
return formatApiError(result, 'bulk_delete_contacts');
|
|
305
|
+
}
|
|
306
|
+
return createSuccess({
|
|
307
|
+
deleted: true,
|
|
308
|
+
count: parsed.data.contact_ids.length,
|
|
309
|
+
contact_ids: parsed.data.contact_ids,
|
|
310
|
+
warning: 'Contacts permanently deleted - cannot be restored',
|
|
311
|
+
result: result.data,
|
|
312
|
+
});
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
// manage_contact_categories
|
|
316
|
+
{
|
|
317
|
+
name: 'manage_contact_categories',
|
|
318
|
+
description: 'Add or remove categories for a contact. Categories help organize and filter contacts.',
|
|
319
|
+
inputSchema: {
|
|
320
|
+
type: 'object',
|
|
321
|
+
properties: {
|
|
322
|
+
contact_id: {
|
|
323
|
+
type: 'string',
|
|
324
|
+
description: 'UUID of the contact',
|
|
325
|
+
pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$',
|
|
326
|
+
},
|
|
327
|
+
action: {
|
|
328
|
+
type: 'string',
|
|
329
|
+
enum: ['add', 'remove'],
|
|
330
|
+
description: 'Whether to add or remove categories',
|
|
331
|
+
},
|
|
332
|
+
categories: {
|
|
333
|
+
type: 'array',
|
|
334
|
+
items: { type: 'string' },
|
|
335
|
+
description: 'Array of category names',
|
|
336
|
+
minItems: 1,
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
required: ['contact_id', 'action', 'categories'],
|
|
340
|
+
},
|
|
341
|
+
handler: async (args) => {
|
|
342
|
+
const parsed = manageContactCategoriesSchema.safeParse(args);
|
|
343
|
+
if (!parsed.success) {
|
|
344
|
+
return createError(`Invalid arguments: ${parsed.error.message}`);
|
|
345
|
+
}
|
|
346
|
+
const validationError = validateUUID(parsed.data.contact_id, 'contact_id');
|
|
347
|
+
if (validationError)
|
|
348
|
+
return validationError;
|
|
349
|
+
const result = await client.manageContactCategories(parsed.data.contact_id, parsed.data.action, parsed.data.categories);
|
|
350
|
+
if (!result.success || isApiError(result)) {
|
|
351
|
+
return formatApiError(result, 'manage_contact_categories');
|
|
352
|
+
}
|
|
353
|
+
return createSuccess({
|
|
354
|
+
contact_id: parsed.data.contact_id,
|
|
355
|
+
action: parsed.data.action,
|
|
356
|
+
categories: parsed.data.categories,
|
|
357
|
+
updated: true,
|
|
358
|
+
result: result.data,
|
|
359
|
+
});
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
// import_contacts
|
|
363
|
+
{
|
|
364
|
+
name: 'import_contacts',
|
|
365
|
+
description: 'Import contacts from CSV or Excel file. Supports bulk import with duplicate handling.\n\n**File format:** CSV or Excel (.xlsx) with columns: name, phone, email (optional), tags (optional), notes (optional)',
|
|
366
|
+
inputSchema: {
|
|
367
|
+
type: 'object',
|
|
368
|
+
properties: {
|
|
369
|
+
file_path: {
|
|
370
|
+
type: 'string',
|
|
371
|
+
description: 'Absolute path to the CSV or Excel file',
|
|
372
|
+
},
|
|
373
|
+
skip_duplicates: {
|
|
374
|
+
type: 'boolean',
|
|
375
|
+
description: 'Skip contacts with duplicate phone numbers',
|
|
376
|
+
default: true,
|
|
377
|
+
},
|
|
378
|
+
update_existing: {
|
|
379
|
+
type: 'boolean',
|
|
380
|
+
description: 'Update existing contacts instead of skipping',
|
|
381
|
+
default: false,
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
required: ['file_path'],
|
|
385
|
+
},
|
|
386
|
+
handler: async (args) => {
|
|
387
|
+
const parsed = importContactsSchema.safeParse(args);
|
|
388
|
+
if (!parsed.success) {
|
|
389
|
+
return createError(`Invalid arguments: ${parsed.error.message}`);
|
|
390
|
+
}
|
|
391
|
+
// Read file from filesystem
|
|
392
|
+
try {
|
|
393
|
+
const fs = await import('fs/promises');
|
|
394
|
+
const fileBuffer = await fs.readFile(parsed.data.file_path);
|
|
395
|
+
const fileName = parsed.data.file_path.split('/').pop() || 'import.csv';
|
|
396
|
+
// Check file size (10MB limit)
|
|
397
|
+
if (fileBuffer.length > 10 * 1024 * 1024) {
|
|
398
|
+
return createError('File too large', 'Maximum file size is 10MB');
|
|
399
|
+
}
|
|
400
|
+
// Check file extension
|
|
401
|
+
const isValidFile = fileName.endsWith('.csv') || fileName.endsWith('.xlsx');
|
|
402
|
+
if (!isValidFile) {
|
|
403
|
+
return createError('Invalid file format', 'Only CSV (.csv) and Excel (.xlsx) files are supported');
|
|
404
|
+
}
|
|
405
|
+
const params = {
|
|
406
|
+
skip_duplicates: parsed.data.skip_duplicates,
|
|
407
|
+
update_existing: parsed.data.update_existing,
|
|
408
|
+
};
|
|
409
|
+
const result = await client.importContacts(fileBuffer, fileName, params);
|
|
410
|
+
if (!result.success || isApiError(result)) {
|
|
411
|
+
return formatApiError(result, 'import_contacts');
|
|
412
|
+
}
|
|
413
|
+
return createSuccess({
|
|
414
|
+
imported: true,
|
|
415
|
+
file: fileName,
|
|
416
|
+
options: params,
|
|
417
|
+
result: result.data,
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
catch (error) {
|
|
421
|
+
if (error.code === 'ENOENT') {
|
|
422
|
+
return createError('File not found', `Could not find file: ${parsed.data.file_path}`);
|
|
423
|
+
}
|
|
424
|
+
return createError('File read error', `Failed to read file: ${error instanceof Error ? error.message : String(error)}`);
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
];
|
|
429
|
+
}
|
|
430
|
+
//# sourceMappingURL=contacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/tools/contacts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5F,cAAc;AACd,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8EAA8E,CAAC;IACrI,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IACvH,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAClI,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,C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,EAAE,MAAM,CAAC,IAAI;qBACpB,CAAC,CAAC;gBACL,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;wBACvD,OAAO,WAAW,CAAC,gBAAgB,EAAE,wBAAwB,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;oBACxF,CAAC;oBAED,OAAO,WAAW,CAChB,iBAAiB,EACjB,wBAAwB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACjF,CAAC;gBACJ,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crawler Tools for dalvon-mcp
|
|
3
|
+
* Phase 5: 6 Tools for managing web crawling and URL collections
|
|
4
|
+
*/
|
|
5
|
+
import type { KnowledgeClient } from '../clients/knowledge.js';
|
|
6
|
+
import type { McpTool } from '../types/index.js';
|
|
7
|
+
export declare function createCrawlerTools(client: KnowledgeClient): McpTool[];
|
|
8
|
+
//# sourceMappingURL=crawler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crawler.d.ts","sourceRoot":"","sources":["../../src/tools/crawler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,mBAAmB,CAAC;AA6B/D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,EAAE,CA2PrE"}
|