construct-labs-crm-env 0.1.2__py3-none-any.whl → 0.1.5__py3-none-any.whl
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.
- construct_labs_crm_env/__init__.py +7 -2
- construct_labs_crm_env/client.py +125 -569
- construct_labs_crm_env/tools.py +697 -0
- {construct_labs_crm_env-0.1.2.dist-info → construct_labs_crm_env-0.1.5.dist-info}/METADATA +1 -1
- construct_labs_crm_env-0.1.5.dist-info/RECORD +10 -0
- construct_labs_crm_env-0.1.5.dist-info/licenses/LICENSE +56 -0
- construct_labs_crm_env-0.1.2.dist-info/RECORD +0 -9
- construct_labs_crm_env-0.1.2.dist-info/licenses/LICENSE +0 -42
- {construct_labs_crm_env-0.1.2.dist-info → construct_labs_crm_env-0.1.5.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
"""Tool definitions for the CRM Agent Environment.
|
|
2
|
+
|
|
3
|
+
This module contains the static tool definitions in OpenAI function calling format.
|
|
4
|
+
These define the available actions an agent can take in the CRM environment.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
# Type alias for tool definitions
|
|
10
|
+
ToolDefinition = dict[str, Any]
|
|
11
|
+
|
|
12
|
+
# =============================================================================
|
|
13
|
+
# Company Tools
|
|
14
|
+
# =============================================================================
|
|
15
|
+
|
|
16
|
+
LIST_COMPANIES: ToolDefinition = {
|
|
17
|
+
"type": "function",
|
|
18
|
+
"function": {
|
|
19
|
+
"name": "list_companies",
|
|
20
|
+
"description": "List all companies in the CRM. Use filters to search by name, domain, or employee count. Response includes pageInfo with hasNextPage, startCursor, and endCursor for pagination.",
|
|
21
|
+
"parameters": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"limit": {
|
|
25
|
+
"type": "integer",
|
|
26
|
+
"default": 60,
|
|
27
|
+
"description": "Maximum number of companies to return (1-60). Default and max is 60.",
|
|
28
|
+
},
|
|
29
|
+
"starting_after": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "Cursor for forward pagination - returns companies after this cursor. Use endCursor from previous response's pageInfo.",
|
|
32
|
+
},
|
|
33
|
+
"ending_before": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "Cursor for backward pagination - returns companies before this cursor. Use startCursor from previous response's pageInfo.",
|
|
36
|
+
},
|
|
37
|
+
"order_by": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": "Sort order in format 'field[ASC|DESC]'. Examples: 'name[ASC]', 'createdAt[DESC]', 'employees[DESC]'.",
|
|
40
|
+
},
|
|
41
|
+
"filter": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "Filter in format 'field[comparator]:value'. Comparators: eq, neq, gt, gte, lt, lte, in, is, like, ilike, startsWith, containsAny. Quote strings/dates, not numbers. Multiple conditions with comma (AND). Examples: 'name[ilike]:\"%acme%\"', 'employees[gte]:100', 'deletedAt[is]:NULL'. Advanced: 'or(status[eq]:\"active\",employees[gt]:50)'.",
|
|
44
|
+
},
|
|
45
|
+
"depth": {
|
|
46
|
+
"type": "integer",
|
|
47
|
+
"default": 1,
|
|
48
|
+
"description": "Relation depth: 0 returns only company fields, 1 includes related people and opportunities. Default is 1.",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
"required": [],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
GET_COMPANY: ToolDefinition = {
|
|
57
|
+
"type": "function",
|
|
58
|
+
"function": {
|
|
59
|
+
"name": "get_company",
|
|
60
|
+
"description": "Get full details of a specific company by its ID, including related contacts and opportunities.",
|
|
61
|
+
"parameters": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"properties": {
|
|
64
|
+
"record_id": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "The unique identifier (UUID) of the company to retrieve. Get this from list_companies.",
|
|
67
|
+
},
|
|
68
|
+
"depth": {
|
|
69
|
+
"type": "integer",
|
|
70
|
+
"default": 1,
|
|
71
|
+
"description": "Relation depth: 0 returns only company fields, 1 includes related people and opportunities. Default is 1.",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
"required": ["record_id"],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
CREATE_COMPANY: ToolDefinition = {
|
|
80
|
+
"type": "function",
|
|
81
|
+
"function": {
|
|
82
|
+
"name": "create_company",
|
|
83
|
+
"description": "Create a new company in the CRM. Name is required; add domain, address, and employee count for a complete record.",
|
|
84
|
+
"parameters": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"properties": {
|
|
87
|
+
"company_name": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"description": "The official name of the company (required). Example: 'Acme Corporation'.",
|
|
90
|
+
},
|
|
91
|
+
"company_domain": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"description": "The company's website domain without protocol. Example: 'acme.com' (not 'https://acme.com').",
|
|
94
|
+
},
|
|
95
|
+
"company_address": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"description": "The company's physical address. Example: '123 Main St, San Francisco, CA 94102'.",
|
|
98
|
+
},
|
|
99
|
+
"company_employees": {
|
|
100
|
+
"type": "integer",
|
|
101
|
+
"description": "Approximate number of employees at the company. Example: 250.",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
"required": ["company_name"],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
UPDATE_COMPANY: ToolDefinition = {
|
|
110
|
+
"type": "function",
|
|
111
|
+
"function": {
|
|
112
|
+
"name": "update_company",
|
|
113
|
+
"description": "Update an existing company. Only include fields you want to change.",
|
|
114
|
+
"parameters": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"properties": {
|
|
117
|
+
"record_id": {
|
|
118
|
+
"type": "string",
|
|
119
|
+
"description": "The unique identifier (UUID) of the company to update. Get this from list_companies or get_company.",
|
|
120
|
+
},
|
|
121
|
+
"company_name": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"description": "New name for the company. Leave out to keep unchanged.",
|
|
124
|
+
},
|
|
125
|
+
"company_domain": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"description": "New website domain (e.g., 'acme.com'). Leave out to keep unchanged.",
|
|
128
|
+
},
|
|
129
|
+
"company_address": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"description": "New physical address. Leave out to keep unchanged.",
|
|
132
|
+
},
|
|
133
|
+
"company_employees": {
|
|
134
|
+
"type": "integer",
|
|
135
|
+
"description": "Updated employee count. Leave out to keep unchanged.",
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
"required": ["record_id"],
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
DELETE_COMPANY: ToolDefinition = {
|
|
144
|
+
"type": "function",
|
|
145
|
+
"function": {
|
|
146
|
+
"name": "delete_company",
|
|
147
|
+
"description": "Permanently delete a company from the CRM. This may also affect related contacts and opportunities.",
|
|
148
|
+
"parameters": {
|
|
149
|
+
"type": "object",
|
|
150
|
+
"properties": {
|
|
151
|
+
"record_id": {
|
|
152
|
+
"type": "string",
|
|
153
|
+
"description": "The unique identifier (UUID) of the company to delete. Get this from list_companies or get_company. This action cannot be undone.",
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
"required": ["record_id"],
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
# =============================================================================
|
|
162
|
+
# Person/Contact Tools
|
|
163
|
+
# =============================================================================
|
|
164
|
+
|
|
165
|
+
LIST_PEOPLE: ToolDefinition = {
|
|
166
|
+
"type": "function",
|
|
167
|
+
"function": {
|
|
168
|
+
"name": "list_people",
|
|
169
|
+
"description": "List all contacts/people in the CRM. Use filters to search by name, email, company, or job title. Response includes pageInfo with hasNextPage, startCursor, and endCursor for pagination.",
|
|
170
|
+
"parameters": {
|
|
171
|
+
"type": "object",
|
|
172
|
+
"properties": {
|
|
173
|
+
"limit": {
|
|
174
|
+
"type": "integer",
|
|
175
|
+
"default": 60,
|
|
176
|
+
"description": "Maximum number of contacts to return (1-60). Default and max is 60.",
|
|
177
|
+
},
|
|
178
|
+
"starting_after": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"description": "Cursor for forward pagination - returns contacts after this cursor. Use endCursor from previous response's pageInfo.",
|
|
181
|
+
},
|
|
182
|
+
"ending_before": {
|
|
183
|
+
"type": "string",
|
|
184
|
+
"description": "Cursor for backward pagination - returns contacts before this cursor. Use startCursor from previous response's pageInfo.",
|
|
185
|
+
},
|
|
186
|
+
"order_by": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"description": "Sort order in format 'field[ASC|DESC]'. Examples: 'name.firstName[ASC]', 'createdAt[DESC]', 'email[ASC]'.",
|
|
189
|
+
},
|
|
190
|
+
"filter": {
|
|
191
|
+
"type": "string",
|
|
192
|
+
"description": "Filter in format 'field[comparator]:value'. Comparators: eq, neq, gt, gte, lt, lte, in, is, like, ilike, startsWith, containsAny. Quote strings/dates, not numbers. Use dot notation for nested fields. Examples: 'email[ilike]:\"%@acme.com\"', 'name.firstName[eq]:\"John\"', 'company.name[ilike]:\"%tech%\"'. Advanced: 'or(jobTitle[ilike]:\"%CEO%\",jobTitle[ilike]:\"%CTO%\")'.",
|
|
193
|
+
},
|
|
194
|
+
"depth": {
|
|
195
|
+
"type": "integer",
|
|
196
|
+
"default": 1,
|
|
197
|
+
"description": "Relation depth: 0 returns only person fields, 1 includes related company data. Default is 1.",
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
"required": [],
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
GET_PERSON: ToolDefinition = {
|
|
206
|
+
"type": "function",
|
|
207
|
+
"function": {
|
|
208
|
+
"name": "get_person",
|
|
209
|
+
"description": "Get full details of a specific contact/person by their ID.",
|
|
210
|
+
"parameters": {
|
|
211
|
+
"type": "object",
|
|
212
|
+
"properties": {
|
|
213
|
+
"record_id": {
|
|
214
|
+
"type": "string",
|
|
215
|
+
"description": "The unique identifier (UUID) of the contact to retrieve. Get this from list_people.",
|
|
216
|
+
},
|
|
217
|
+
"depth": {
|
|
218
|
+
"type": "integer",
|
|
219
|
+
"default": 1,
|
|
220
|
+
"description": "Relation depth: 0 returns only person fields, 1 includes related company and opportunity data. Default is 1.",
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
"required": ["record_id"],
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
CREATE_PERSON: ToolDefinition = {
|
|
229
|
+
"type": "function",
|
|
230
|
+
"function": {
|
|
231
|
+
"name": "create_person",
|
|
232
|
+
"description": "Create a new contact/person in the CRM. First and last name are required; other fields are optional.",
|
|
233
|
+
"parameters": {
|
|
234
|
+
"type": "object",
|
|
235
|
+
"properties": {
|
|
236
|
+
"person_first_name": {
|
|
237
|
+
"type": "string",
|
|
238
|
+
"description": "The contact's first name (required).",
|
|
239
|
+
},
|
|
240
|
+
"person_last_name": {
|
|
241
|
+
"type": "string",
|
|
242
|
+
"description": "The contact's last name (required).",
|
|
243
|
+
},
|
|
244
|
+
"person_email": {
|
|
245
|
+
"type": "string",
|
|
246
|
+
"description": "The contact's email address. Format: 'user@domain.com'.",
|
|
247
|
+
},
|
|
248
|
+
"person_phone": {
|
|
249
|
+
"type": "string",
|
|
250
|
+
"description": "The contact's phone number. Any format accepted (e.g., '+1-555-123-4567').",
|
|
251
|
+
},
|
|
252
|
+
"person_company_id": {
|
|
253
|
+
"type": "string",
|
|
254
|
+
"description": "UUID of the company this person works for. Get this from list_companies or create_company.",
|
|
255
|
+
},
|
|
256
|
+
"person_job_title": {
|
|
257
|
+
"type": "string",
|
|
258
|
+
"description": "The contact's job title or role (e.g., 'CEO', 'Sales Manager', 'Software Engineer').",
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
"required": ["person_first_name", "person_last_name"],
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
UPDATE_PERSON: ToolDefinition = {
|
|
267
|
+
"type": "function",
|
|
268
|
+
"function": {
|
|
269
|
+
"name": "update_person",
|
|
270
|
+
"description": "Update an existing contact. Only include fields you want to change.",
|
|
271
|
+
"parameters": {
|
|
272
|
+
"type": "object",
|
|
273
|
+
"properties": {
|
|
274
|
+
"record_id": {
|
|
275
|
+
"type": "string",
|
|
276
|
+
"description": "The unique identifier (UUID) of the contact to update. Get this from list_people or get_person.",
|
|
277
|
+
},
|
|
278
|
+
"person_first_name": {
|
|
279
|
+
"type": "string",
|
|
280
|
+
"description": "New first name. Leave out to keep unchanged.",
|
|
281
|
+
},
|
|
282
|
+
"person_last_name": {
|
|
283
|
+
"type": "string",
|
|
284
|
+
"description": "New last name. Leave out to keep unchanged.",
|
|
285
|
+
},
|
|
286
|
+
"person_email": {
|
|
287
|
+
"type": "string",
|
|
288
|
+
"description": "New email address. Leave out to keep unchanged.",
|
|
289
|
+
},
|
|
290
|
+
"person_phone": {
|
|
291
|
+
"type": "string",
|
|
292
|
+
"description": "New phone number. Leave out to keep unchanged.",
|
|
293
|
+
},
|
|
294
|
+
"person_job_title": {
|
|
295
|
+
"type": "string",
|
|
296
|
+
"description": "New job title. Leave out to keep unchanged.",
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
"required": ["record_id"],
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
DELETE_PERSON: ToolDefinition = {
|
|
305
|
+
"type": "function",
|
|
306
|
+
"function": {
|
|
307
|
+
"name": "delete_person",
|
|
308
|
+
"description": "Permanently delete a contact/person from the CRM. This may also affect related opportunities and notes.",
|
|
309
|
+
"parameters": {
|
|
310
|
+
"type": "object",
|
|
311
|
+
"properties": {
|
|
312
|
+
"record_id": {
|
|
313
|
+
"type": "string",
|
|
314
|
+
"description": "The unique identifier (UUID) of the contact to delete. Get this from list_people or get_person. This action cannot be undone.",
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
"required": ["record_id"],
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
# =============================================================================
|
|
323
|
+
# Opportunity Tools
|
|
324
|
+
# =============================================================================
|
|
325
|
+
|
|
326
|
+
LIST_OPPORTUNITIES: ToolDefinition = {
|
|
327
|
+
"type": "function",
|
|
328
|
+
"function": {
|
|
329
|
+
"name": "list_opportunities",
|
|
330
|
+
"description": "List all opportunities/deals in the CRM. Use filters to search by stage, amount, company, or close date. Response includes pageInfo with hasNextPage, startCursor, and endCursor for pagination.",
|
|
331
|
+
"parameters": {
|
|
332
|
+
"type": "object",
|
|
333
|
+
"properties": {
|
|
334
|
+
"limit": {
|
|
335
|
+
"type": "integer",
|
|
336
|
+
"default": 60,
|
|
337
|
+
"description": "Maximum number of opportunities to return (1-60). Default and max is 60.",
|
|
338
|
+
},
|
|
339
|
+
"starting_after": {
|
|
340
|
+
"type": "string",
|
|
341
|
+
"description": "Cursor for forward pagination - returns opportunities after this cursor. Use endCursor from previous response's pageInfo.",
|
|
342
|
+
},
|
|
343
|
+
"ending_before": {
|
|
344
|
+
"type": "string",
|
|
345
|
+
"description": "Cursor for backward pagination - returns opportunities before this cursor. Use startCursor from previous response's pageInfo.",
|
|
346
|
+
},
|
|
347
|
+
"order_by": {
|
|
348
|
+
"type": "string",
|
|
349
|
+
"description": "Sort order in format 'field[ASC|DESC]'. Examples: 'amount[DESC]', 'closeDate[ASC]', 'stage[ASC]'.",
|
|
350
|
+
},
|
|
351
|
+
"filter": {
|
|
352
|
+
"type": "string",
|
|
353
|
+
"description": "Filter in format 'field[comparator]:value'. Comparators: eq, neq, gt, gte, lt, lte, in, is, like, ilike, startsWith, containsAny. Quote strings/dates, not numbers. Examples: 'stage[eq]:\"WON\"', 'amount[gte]:10000', 'closeDate[gte]:\"2026-01-01\"', 'company.name[ilike]:\"%acme%\"'. Advanced: 'or(stage[eq]:\"WON\",stage[eq]:\"PROPOSAL\")'.",
|
|
354
|
+
},
|
|
355
|
+
"depth": {
|
|
356
|
+
"type": "integer",
|
|
357
|
+
"default": 1,
|
|
358
|
+
"description": "Relation depth: 0 returns only opportunity fields, 1 includes related company and person data. Default is 1.",
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
"required": [],
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
GET_OPPORTUNITY: ToolDefinition = {
|
|
367
|
+
"type": "function",
|
|
368
|
+
"function": {
|
|
369
|
+
"name": "get_opportunity",
|
|
370
|
+
"description": "Get full details of a specific opportunity/deal by its ID.",
|
|
371
|
+
"parameters": {
|
|
372
|
+
"type": "object",
|
|
373
|
+
"properties": {
|
|
374
|
+
"record_id": {
|
|
375
|
+
"type": "string",
|
|
376
|
+
"description": "The unique identifier (UUID) of the opportunity to retrieve. Get this from list_opportunities.",
|
|
377
|
+
},
|
|
378
|
+
"depth": {
|
|
379
|
+
"type": "integer",
|
|
380
|
+
"default": 1,
|
|
381
|
+
"description": "Relation depth: 0 returns only opportunity fields, 1 includes related company and person data. Default is 1.",
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
"required": ["record_id"],
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
CREATE_OPPORTUNITY: ToolDefinition = {
|
|
390
|
+
"type": "function",
|
|
391
|
+
"function": {
|
|
392
|
+
"name": "create_opportunity",
|
|
393
|
+
"description": "Create a new sales opportunity/deal in the CRM. Name is required; link to company and contact for full tracking.",
|
|
394
|
+
"parameters": {
|
|
395
|
+
"type": "object",
|
|
396
|
+
"properties": {
|
|
397
|
+
"opportunity_name": {
|
|
398
|
+
"type": "string",
|
|
399
|
+
"description": "A descriptive name for the deal (required). Example: 'Acme Corp - Enterprise License Q1'.",
|
|
400
|
+
},
|
|
401
|
+
"opportunity_amount": {
|
|
402
|
+
"type": "number",
|
|
403
|
+
"description": "The monetary value of the deal in dollars. Example: 50000 for a $50,000 deal.",
|
|
404
|
+
},
|
|
405
|
+
"opportunity_stage": {
|
|
406
|
+
"type": "string",
|
|
407
|
+
"enum": ["NEW", "MEETING", "PROPOSAL", "WON", "LOST"],
|
|
408
|
+
"description": "Current stage in the sales pipeline. NEW: initial lead, MEETING: scheduled/had meeting, PROPOSAL: sent proposal, WON: closed won, LOST: closed lost.",
|
|
409
|
+
},
|
|
410
|
+
"opportunity_close_date": {
|
|
411
|
+
"type": "string",
|
|
412
|
+
"description": "Expected or actual close date in ISO 8601 format. Example: '2026-03-15' or '2026-03-15T00:00:00Z'.",
|
|
413
|
+
},
|
|
414
|
+
"opportunity_company_id": {
|
|
415
|
+
"type": "string",
|
|
416
|
+
"description": "UUID of the company this opportunity is with. Get this from list_companies or create_company.",
|
|
417
|
+
},
|
|
418
|
+
"opportunity_person_id": {
|
|
419
|
+
"type": "string",
|
|
420
|
+
"description": "UUID of the primary contact/person for this deal. Get this from list_people or create_person.",
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
"required": ["opportunity_name"],
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
UPDATE_OPPORTUNITY: ToolDefinition = {
|
|
429
|
+
"type": "function",
|
|
430
|
+
"function": {
|
|
431
|
+
"name": "update_opportunity",
|
|
432
|
+
"description": "Update an existing opportunity. Only include fields you want to change. Use this to advance deals through the pipeline.",
|
|
433
|
+
"parameters": {
|
|
434
|
+
"type": "object",
|
|
435
|
+
"properties": {
|
|
436
|
+
"record_id": {
|
|
437
|
+
"type": "string",
|
|
438
|
+
"description": "The unique identifier (UUID) of the opportunity to update. Get this from list_opportunities or get_opportunity.",
|
|
439
|
+
},
|
|
440
|
+
"opportunity_name": {
|
|
441
|
+
"type": "string",
|
|
442
|
+
"description": "New name for the opportunity. Leave out to keep unchanged.",
|
|
443
|
+
},
|
|
444
|
+
"opportunity_amount": {
|
|
445
|
+
"type": "number",
|
|
446
|
+
"description": "Updated deal value in dollars. Leave out to keep unchanged.",
|
|
447
|
+
},
|
|
448
|
+
"opportunity_stage": {
|
|
449
|
+
"type": "string",
|
|
450
|
+
"enum": ["NEW", "MEETING", "PROPOSAL", "WON", "LOST"],
|
|
451
|
+
"description": "New pipeline stage. NEW: initial lead, MEETING: scheduled/had meeting, PROPOSAL: sent proposal, WON: closed won, LOST: closed lost.",
|
|
452
|
+
},
|
|
453
|
+
"opportunity_close_date": {
|
|
454
|
+
"type": "string",
|
|
455
|
+
"description": "Updated close date in ISO 8601 format (e.g., '2026-03-15'). Leave out to keep unchanged.",
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
"required": ["record_id"],
|
|
459
|
+
},
|
|
460
|
+
},
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
DELETE_OPPORTUNITY: ToolDefinition = {
|
|
464
|
+
"type": "function",
|
|
465
|
+
"function": {
|
|
466
|
+
"name": "delete_opportunity",
|
|
467
|
+
"description": "Permanently delete an opportunity/deal from the CRM. Consider marking as LOST instead to preserve history.",
|
|
468
|
+
"parameters": {
|
|
469
|
+
"type": "object",
|
|
470
|
+
"properties": {
|
|
471
|
+
"record_id": {
|
|
472
|
+
"type": "string",
|
|
473
|
+
"description": "The unique identifier (UUID) of the opportunity to delete. Get this from list_opportunities or get_opportunity. This action cannot be undone.",
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
"required": ["record_id"],
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
# =============================================================================
|
|
482
|
+
# Note Tools
|
|
483
|
+
# =============================================================================
|
|
484
|
+
|
|
485
|
+
LIST_NOTES: ToolDefinition = {
|
|
486
|
+
"type": "function",
|
|
487
|
+
"function": {
|
|
488
|
+
"name": "list_notes",
|
|
489
|
+
"description": "List all notes in the CRM. Notes are attached to companies, people, or opportunities and contain meeting summaries, call logs, and updates.",
|
|
490
|
+
"parameters": {
|
|
491
|
+
"type": "object",
|
|
492
|
+
"properties": {
|
|
493
|
+
"limit": {
|
|
494
|
+
"type": "integer",
|
|
495
|
+
"default": 10,
|
|
496
|
+
"description": "Maximum number of notes to return. Default is 10. Use higher values to see more history.",
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
"required": [],
|
|
500
|
+
},
|
|
501
|
+
},
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
CREATE_NOTE: ToolDefinition = {
|
|
505
|
+
"type": "function",
|
|
506
|
+
"function": {
|
|
507
|
+
"name": "create_note",
|
|
508
|
+
"description": "Create a note attached to a company, person, or opportunity. Use for meeting notes, call logs, important updates.",
|
|
509
|
+
"parameters": {
|
|
510
|
+
"type": "object",
|
|
511
|
+
"properties": {
|
|
512
|
+
"note_body": {
|
|
513
|
+
"type": "string",
|
|
514
|
+
"description": "The text content of the note (required). Can include meeting summaries, call notes, action items, etc.",
|
|
515
|
+
},
|
|
516
|
+
"note_target_id": {
|
|
517
|
+
"type": "string",
|
|
518
|
+
"description": "UUID of the record to attach this note to. Get from list_companies, list_people, or list_opportunities.",
|
|
519
|
+
},
|
|
520
|
+
"note_target_type": {
|
|
521
|
+
"type": "string",
|
|
522
|
+
"enum": ["company", "person", "opportunity"],
|
|
523
|
+
"description": "The type of record to attach to: 'company', 'person', or 'opportunity'. Must match the type of note_target_id.",
|
|
524
|
+
},
|
|
525
|
+
},
|
|
526
|
+
"required": ["note_body"],
|
|
527
|
+
},
|
|
528
|
+
},
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
# =============================================================================
|
|
532
|
+
# Task Tools
|
|
533
|
+
# =============================================================================
|
|
534
|
+
|
|
535
|
+
LIST_TASKS: ToolDefinition = {
|
|
536
|
+
"type": "function",
|
|
537
|
+
"function": {
|
|
538
|
+
"name": "list_tasks",
|
|
539
|
+
"description": "List all tasks in the CRM. Tasks represent follow-ups, reminders, and action items that may be linked to companies, people, or opportunities.",
|
|
540
|
+
"parameters": {
|
|
541
|
+
"type": "object",
|
|
542
|
+
"properties": {
|
|
543
|
+
"limit": {
|
|
544
|
+
"type": "integer",
|
|
545
|
+
"default": 10,
|
|
546
|
+
"description": "Maximum number of tasks to return. Default is 10. Use higher values to see more tasks.",
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
"required": [],
|
|
550
|
+
},
|
|
551
|
+
},
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
CREATE_TASK: ToolDefinition = {
|
|
555
|
+
"type": "function",
|
|
556
|
+
"function": {
|
|
557
|
+
"name": "create_task",
|
|
558
|
+
"description": "Create a follow-up task, optionally linked to a company, person, or opportunity. Use for reminders, action items, and scheduled activities.",
|
|
559
|
+
"parameters": {
|
|
560
|
+
"type": "object",
|
|
561
|
+
"properties": {
|
|
562
|
+
"task_title": {
|
|
563
|
+
"type": "string",
|
|
564
|
+
"description": "Short title describing the task (required). Example: 'Follow up on proposal', 'Schedule demo call'.",
|
|
565
|
+
},
|
|
566
|
+
"task_body": {
|
|
567
|
+
"type": "string",
|
|
568
|
+
"description": "Detailed description of what needs to be done. Include context, steps, or relevant information.",
|
|
569
|
+
},
|
|
570
|
+
"task_due_date": {
|
|
571
|
+
"type": "string",
|
|
572
|
+
"description": "When the task should be completed, in ISO 8601 format. Example: '2026-02-15' or '2026-02-15T14:00:00Z'.",
|
|
573
|
+
},
|
|
574
|
+
"task_status": {
|
|
575
|
+
"type": "string",
|
|
576
|
+
"enum": ["TODO", "IN_PROGRESS", "DONE"],
|
|
577
|
+
"description": "Current status: TODO (not started), IN_PROGRESS (being worked on), DONE (completed). Defaults to TODO if not specified.",
|
|
578
|
+
},
|
|
579
|
+
"task_target_id": {
|
|
580
|
+
"type": "string",
|
|
581
|
+
"description": "UUID of the record to link this task to. Get from list_companies, list_people, or list_opportunities.",
|
|
582
|
+
},
|
|
583
|
+
"task_target_type": {
|
|
584
|
+
"type": "string",
|
|
585
|
+
"enum": ["company", "person", "opportunity"],
|
|
586
|
+
"description": "The type of record to link to: 'company', 'person', or 'opportunity'. Must match the type of task_target_id.",
|
|
587
|
+
},
|
|
588
|
+
},
|
|
589
|
+
"required": ["task_title"],
|
|
590
|
+
},
|
|
591
|
+
},
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
UPDATE_TASK: ToolDefinition = {
|
|
595
|
+
"type": "function",
|
|
596
|
+
"function": {
|
|
597
|
+
"name": "update_task",
|
|
598
|
+
"description": "Update an existing task. Only include fields you want to change. Use complete_task to mark as done.",
|
|
599
|
+
"parameters": {
|
|
600
|
+
"type": "object",
|
|
601
|
+
"properties": {
|
|
602
|
+
"record_id": {
|
|
603
|
+
"type": "string",
|
|
604
|
+
"description": "The unique identifier (UUID) of the task to update. Get this from list_tasks.",
|
|
605
|
+
},
|
|
606
|
+
"task_title": {
|
|
607
|
+
"type": "string",
|
|
608
|
+
"description": "New title for the task. Leave out to keep unchanged.",
|
|
609
|
+
},
|
|
610
|
+
"task_body": {
|
|
611
|
+
"type": "string",
|
|
612
|
+
"description": "New description for the task. Leave out to keep unchanged.",
|
|
613
|
+
},
|
|
614
|
+
"task_due_date": {
|
|
615
|
+
"type": "string",
|
|
616
|
+
"description": "New due date in ISO 8601 format (e.g., '2026-02-15'). Leave out to keep unchanged.",
|
|
617
|
+
},
|
|
618
|
+
},
|
|
619
|
+
"required": ["record_id"],
|
|
620
|
+
},
|
|
621
|
+
},
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
COMPLETE_TASK: ToolDefinition = {
|
|
625
|
+
"type": "function",
|
|
626
|
+
"function": {
|
|
627
|
+
"name": "complete_task",
|
|
628
|
+
"description": "Mark a task as complete (sets status to DONE). Use this when a task has been finished.",
|
|
629
|
+
"parameters": {
|
|
630
|
+
"type": "object",
|
|
631
|
+
"properties": {
|
|
632
|
+
"record_id": {
|
|
633
|
+
"type": "string",
|
|
634
|
+
"description": "The unique identifier (UUID) of the task to mark as complete. Get this from list_tasks.",
|
|
635
|
+
},
|
|
636
|
+
},
|
|
637
|
+
"required": ["record_id"],
|
|
638
|
+
},
|
|
639
|
+
},
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
# =============================================================================
|
|
643
|
+
# Submit Answer Tool
|
|
644
|
+
# =============================================================================
|
|
645
|
+
|
|
646
|
+
SUBMIT_ANSWER: ToolDefinition = {
|
|
647
|
+
"type": "function",
|
|
648
|
+
"function": {
|
|
649
|
+
"name": "submit_answer",
|
|
650
|
+
"description": "Submit your final answer to complete the task. Call this when you have gathered all necessary information and are ready to respond. This ends the session.",
|
|
651
|
+
"parameters": {
|
|
652
|
+
"type": "object",
|
|
653
|
+
"properties": {
|
|
654
|
+
"answer": {
|
|
655
|
+
"type": "string",
|
|
656
|
+
"description": "Your complete answer to the user's question, based on the CRM data you retrieved. Be specific and include relevant details like names, amounts, dates, or counts.",
|
|
657
|
+
},
|
|
658
|
+
},
|
|
659
|
+
"required": ["answer"],
|
|
660
|
+
},
|
|
661
|
+
},
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
# =============================================================================
|
|
665
|
+
# All Tools - Combined list
|
|
666
|
+
# =============================================================================
|
|
667
|
+
|
|
668
|
+
DEFAULT_TOOLS: list[ToolDefinition] = [
|
|
669
|
+
# Company
|
|
670
|
+
LIST_COMPANIES,
|
|
671
|
+
GET_COMPANY,
|
|
672
|
+
CREATE_COMPANY,
|
|
673
|
+
UPDATE_COMPANY,
|
|
674
|
+
DELETE_COMPANY,
|
|
675
|
+
# Person
|
|
676
|
+
LIST_PEOPLE,
|
|
677
|
+
GET_PERSON,
|
|
678
|
+
CREATE_PERSON,
|
|
679
|
+
UPDATE_PERSON,
|
|
680
|
+
DELETE_PERSON,
|
|
681
|
+
# Opportunity
|
|
682
|
+
LIST_OPPORTUNITIES,
|
|
683
|
+
GET_OPPORTUNITY,
|
|
684
|
+
CREATE_OPPORTUNITY,
|
|
685
|
+
UPDATE_OPPORTUNITY,
|
|
686
|
+
DELETE_OPPORTUNITY,
|
|
687
|
+
# Note
|
|
688
|
+
LIST_NOTES,
|
|
689
|
+
CREATE_NOTE,
|
|
690
|
+
# Task
|
|
691
|
+
LIST_TASKS,
|
|
692
|
+
CREATE_TASK,
|
|
693
|
+
UPDATE_TASK,
|
|
694
|
+
COMPLETE_TASK,
|
|
695
|
+
# Answer
|
|
696
|
+
SUBMIT_ANSWER,
|
|
697
|
+
]
|