@agifyai/leadify-mcp 8.4.0 → 8.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/tools/leads.js +35 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -193,6 +193,11 @@ Conséquences pratiques :
|
|
|
193
193
|
| `get_leads` | Rechercher et lister des leads avec filtres, recherche et pagination. |
|
|
194
194
|
| `get_lead` | Récupérer les détails complets d'un lead par son ID. |
|
|
195
195
|
| `update_lead` | Mettre à jour un ou plusieurs champs d'un lead existant. |
|
|
196
|
+
|
|
197
|
+
Pour `add_leads` et `update_lead`, `location` utilise l’objet canonique
|
|
198
|
+
`{ city, region?, postalCode?, countryCode, street? }`. `city` et le code pays
|
|
199
|
+
ISO-2 `countryCode` sont obligatoires. La projection `geo` est calculée par
|
|
200
|
+
Leadify et ne doit jamais être envoyée par un agent MCP.
|
|
196
201
|
| `delete_sequence_messages` | Supprimer uniquement les messages de séquence générés d'un lead, après confirmation explicite. |
|
|
197
202
|
| `delete_leads` | Supprimer définitivement des leads par leurs IDs. |
|
|
198
203
|
| `update_schema` | Ajouter ou modifier les définitions de champs d'un groupe. |
|
package/dist/tools/leads.js
CHANGED
|
@@ -2,6 +2,37 @@ import { z } from "zod";
|
|
|
2
2
|
import { getClient } from "../client.js";
|
|
3
3
|
import { toolResult, handleToolError } from "../types.js";
|
|
4
4
|
const DEFAULT_LEAD_FIELDS = ["firstName", "lastName", "email", "company", "jobTitle", "linkedin"];
|
|
5
|
+
const canonicalLocationSchema = z.object({
|
|
6
|
+
city: z.string().trim().min(1).max(200),
|
|
7
|
+
region: z.string().trim().min(1).max(500).optional(),
|
|
8
|
+
postalCode: z.string().trim().min(1).max(500).optional(),
|
|
9
|
+
countryCode: z.string().trim().regex(/^[A-Za-z]{2}$/).transform((value) => value.toUpperCase()),
|
|
10
|
+
street: z.string().trim().min(1).max(500).optional(),
|
|
11
|
+
}).strict().describe("Canonical Leadify location source. city and ISO-2 countryCode are required; region, postalCode and street are optional. geo is system-owned and forbidden.");
|
|
12
|
+
const leadInputSchema = z.record(z.unknown()).superRefine((lead, context) => {
|
|
13
|
+
if (!Object.hasOwn(lead, "location"))
|
|
14
|
+
return;
|
|
15
|
+
const parsed = canonicalLocationSchema.safeParse(lead.location);
|
|
16
|
+
if (!parsed.success) {
|
|
17
|
+
for (const issue of parsed.error.issues) {
|
|
18
|
+
context.addIssue({ ...issue, path: ["location", ...issue.path] });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const leadUpdateSchema = z.object({
|
|
23
|
+
property_name: z.string().describe("Name of the field to update (e.g. 'email', 'status', 'card_analysis')."),
|
|
24
|
+
value: z.unknown().describe("New value for the field. location must use the canonical object; location.geo is forbidden."),
|
|
25
|
+
is_select: z.boolean().optional().describe("If true, the field is created/updated as a 'select' dropdown type. Use for categorical fields like status, source, etc."),
|
|
26
|
+
}).superRefine((update, context) => {
|
|
27
|
+
if (update.property_name !== "location")
|
|
28
|
+
return;
|
|
29
|
+
const parsed = canonicalLocationSchema.safeParse(update.value);
|
|
30
|
+
if (!parsed.success) {
|
|
31
|
+
for (const issue of parsed.error.issues) {
|
|
32
|
+
context.addIssue({ ...issue, path: ["value", ...issue.path] });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
5
36
|
function projectLead(lead, fields) {
|
|
6
37
|
const source = lead && typeof lead === "object" ? lead : {};
|
|
7
38
|
const data = source.data && typeof source.data === "object" ? source.data : {};
|
|
@@ -32,10 +63,10 @@ export function registerLeadTools(server, client = getClient()) {
|
|
|
32
63
|
.string()
|
|
33
64
|
.describe("ID of the lead group to add leads to."),
|
|
34
65
|
leads: z
|
|
35
|
-
.array(
|
|
66
|
+
.array(leadInputSchema)
|
|
36
67
|
.describe("Array of lead objects. Each object is a key-value map of field names to values. " +
|
|
37
68
|
"Common fields: email, firstName, lastName, company, jobTitle, phone, linkedin, " +
|
|
38
|
-
"website,
|
|
69
|
+
"website, seniority, specialty, age. location must be {city, region?, postalCode?, countryCode, street?}; geo is computed by Leadify. Also supports card_* fields, " +
|
|
39
70
|
"percent_* fields and boolean flags (decisionMaking, excluded). Canonical relation fields are rejected."),
|
|
40
71
|
is_select_fields: z
|
|
41
72
|
.array(z.string())
|
|
@@ -152,22 +183,11 @@ export function registerLeadTools(server, client = getClient()) {
|
|
|
152
183
|
"Supports all field types including special fields (card_*, percent_*, boolean flags " +
|
|
153
184
|
"like decisionMaking/excluded). When a configured canonical relation field is changed, " +
|
|
154
185
|
"the backend routes it through the typed relationship service and keeps the JSON field read-only. Returns the updated lead. " +
|
|
186
|
+
"location must be the canonical object {city, region?, postalCode?, countryCode, street?}; never submit geo. " +
|
|
155
187
|
"For bulk updates across many leads, call this tool once per lead.", {
|
|
156
188
|
lead_id: z.string().describe("ID of the lead to update."),
|
|
157
189
|
updates: z
|
|
158
|
-
.array(
|
|
159
|
-
property_name: z
|
|
160
|
-
.string()
|
|
161
|
-
.describe("Name of the field to update (e.g. 'email', 'status', 'card_analysis')."),
|
|
162
|
-
value: z
|
|
163
|
-
.unknown()
|
|
164
|
-
.describe("New value for the field. Type depends on the field."),
|
|
165
|
-
is_select: z
|
|
166
|
-
.boolean()
|
|
167
|
-
.optional()
|
|
168
|
-
.describe("If true, the field is created/updated as a 'select' dropdown type. " +
|
|
169
|
-
"Use for categorical fields like status, source, etc."),
|
|
170
|
-
}))
|
|
190
|
+
.array(leadUpdateSchema)
|
|
171
191
|
.min(1)
|
|
172
192
|
.describe("Array of field updates to apply."),
|
|
173
193
|
}, async ({ lead_id, updates }) => {
|