@agifyai/leadify-mcp 8.2.0 → 8.3.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 +1 -0
- package/dist/server.js +3 -1
- package/dist/tools/leads.d.ts +1 -1
- package/dist/tools/leads.js +20 -6
- package/dist/tools/views.d.ts +2 -0
- package/dist/tools/views.js +56 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -185,6 +185,7 @@ Conséquences pratiques :
|
|
|
185
185
|
| `get_leads` | Rechercher et lister des leads avec filtres, recherche et pagination. |
|
|
186
186
|
| `get_lead` | Récupérer les détails complets d'un lead par son ID. |
|
|
187
187
|
| `update_lead` | Mettre à jour un ou plusieurs champs d'un lead existant. |
|
|
188
|
+
| `delete_sequence_messages` | Supprimer uniquement les messages de séquence générés d'un lead, après confirmation explicite. |
|
|
188
189
|
| `delete_leads` | Supprimer définitivement des leads par leurs IDs. |
|
|
189
190
|
| `update_schema` | Ajouter ou modifier les définitions de champs d'un groupe. |
|
|
190
191
|
| `delete_columns` | Supprimer des colonnes du schéma et des données d'un groupe. |
|
package/dist/server.js
CHANGED
|
@@ -13,14 +13,16 @@ import { registerOrganizationTools } from "./tools/organizations.js";
|
|
|
13
13
|
import { registerPipelineTools } from "./tools/pipeline.js";
|
|
14
14
|
import { registerFineTuningTools } from "./tools/fine_tuning.js";
|
|
15
15
|
import { registerContextWorkspaceTools } from "./tools/context_workspace.js";
|
|
16
|
+
import { registerLeadViewTools } from "./tools/views.js";
|
|
16
17
|
export function createServer() {
|
|
17
18
|
const server = new McpServer({
|
|
18
19
|
name: "leadify",
|
|
19
|
-
version: "8.
|
|
20
|
+
version: "8.3.1",
|
|
20
21
|
});
|
|
21
22
|
registerAuthTools(server);
|
|
22
23
|
registerOrganizationTools(server);
|
|
23
24
|
registerLeadGroupTools(server);
|
|
25
|
+
registerLeadViewTools(server);
|
|
24
26
|
registerLeadTools(server);
|
|
25
27
|
registerSchemaTools(server);
|
|
26
28
|
registerLogTools(server);
|
package/dist/tools/leads.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
export declare function registerLeadTools(server: McpServer): void;
|
|
2
|
+
export declare function registerLeadTools(server: McpServer, client?: import("../client.js").LeadifyClient): void;
|
package/dist/tools/leads.js
CHANGED
|
@@ -19,7 +19,7 @@ function compactLeadsResponse(data, fields, includeSchema) {
|
|
|
19
19
|
result.schema = source.schema;
|
|
20
20
|
return result;
|
|
21
21
|
}
|
|
22
|
-
export function registerLeadTools(server) {
|
|
22
|
+
export function registerLeadTools(server, client = getClient()) {
|
|
23
23
|
// ── add_leads ──────────────────────────────────────────────────────────
|
|
24
24
|
server.tool("add_leads", "Add one or more leads to a specific lead group in Leadify. Provide the group ID " +
|
|
25
25
|
"and an array of lead objects with any combination of fields (email, firstName, " +
|
|
@@ -51,7 +51,7 @@ export function registerLeadTools(server) {
|
|
|
51
51
|
body.leadData.isSelectFields =
|
|
52
52
|
is_select_fields;
|
|
53
53
|
}
|
|
54
|
-
const data = await
|
|
54
|
+
const data = await client.post("/add-lead", body);
|
|
55
55
|
return toolResult(data);
|
|
56
56
|
}
|
|
57
57
|
catch (error) {
|
|
@@ -113,7 +113,7 @@ export function registerLeadTools(server) {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
const data = await
|
|
116
|
+
const data = await client.get("/get-leads", params);
|
|
117
117
|
return toolResult(compactLeadsResponse(data, fields ?? DEFAULT_LEAD_FIELDS, include_schema));
|
|
118
118
|
}
|
|
119
119
|
catch (error) {
|
|
@@ -130,7 +130,7 @@ export function registerLeadTools(server) {
|
|
|
130
130
|
try {
|
|
131
131
|
const params = new URLSearchParams();
|
|
132
132
|
params.set("id", id);
|
|
133
|
-
const data = await
|
|
133
|
+
const data = await client.get("/get-lead", params);
|
|
134
134
|
const source = data && typeof data === "object" ? data : {};
|
|
135
135
|
const lead = source.lead;
|
|
136
136
|
const result = { lead: projectLead(lead, fields ?? DEFAULT_LEAD_FIELDS) };
|
|
@@ -178,7 +178,21 @@ export function registerLeadTools(server) {
|
|
|
178
178
|
...(u.is_select !== undefined ? { isSelect: u.is_select } : {}),
|
|
179
179
|
})),
|
|
180
180
|
};
|
|
181
|
-
const data = await
|
|
181
|
+
const data = await client.put("/update-lead", body);
|
|
182
|
+
return toolResult(data);
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
return handleToolError(error);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
// ── delete_sequence_messages ──────────────────────────────────────────
|
|
189
|
+
server.tool("delete_sequence_messages", "Permanently remove only the generated LinkedIn and email sequence messages for one lead. " +
|
|
190
|
+
"It does not modify the lead's contact data, qualification, activities, campaign state, or any other fields. " +
|
|
191
|
+
"This action is irreversible: obtain explicit user confirmation before calling it.", {
|
|
192
|
+
lead_id: z.string().describe("ID of the lead whose generated sequence messages must be removed."),
|
|
193
|
+
}, async ({ lead_id }) => {
|
|
194
|
+
try {
|
|
195
|
+
const data = await client.post("/api/delete-sequence-messages", { leadId: lead_id });
|
|
182
196
|
return toolResult(data);
|
|
183
197
|
}
|
|
184
198
|
catch (error) {
|
|
@@ -196,7 +210,7 @@ export function registerLeadTools(server) {
|
|
|
196
210
|
.describe("Array of lead IDs to delete."),
|
|
197
211
|
}, async ({ lead_ids }) => {
|
|
198
212
|
try {
|
|
199
|
-
const data = await
|
|
213
|
+
const data = await client.post("/delete-lead", {
|
|
200
214
|
leadIds: lead_ids,
|
|
201
215
|
});
|
|
202
216
|
return toolResult(data);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getClient } from "../client.js";
|
|
3
|
+
import { handleToolError, toolResult } from "../types.js";
|
|
4
|
+
const filterSchema = z.object({
|
|
5
|
+
field: z.string().describe("A standard, virtual, or selected lead-group schema field."),
|
|
6
|
+
operator: z.enum(["equals", "contains", "gte", "lte", "not_equals", "not_contains", "is_true", "is_false", "is_null", "is_not_null", "activity_days_ago", "activity_count_equals", "activity_count_gte", "activity_count_lte", "bbox"]),
|
|
7
|
+
value: z.unknown().optional(),
|
|
8
|
+
});
|
|
9
|
+
const viewConfigSchema = {
|
|
10
|
+
organization_id: z.string().describe("Organization that owns the explicitly selected lead group."),
|
|
11
|
+
lead_group_id: z.string().describe("Lead group ID. The view is shared with this group's organization."),
|
|
12
|
+
name: z.string().min(1),
|
|
13
|
+
filters: z.array(filterSchema),
|
|
14
|
+
columns: z.array(z.string()).optional(),
|
|
15
|
+
sort: z.object({ field: z.string(), direction: z.enum(["asc", "desc"]) }).optional(),
|
|
16
|
+
pagination: z.object({ page: z.number().int().min(1), limit: z.number().int().min(1).max(1000) }).optional(),
|
|
17
|
+
};
|
|
18
|
+
export function registerLeadViewTools(server) {
|
|
19
|
+
server.tool("list_lead_views", "List the virtual read-only default view and every saved view shared by the selected lead group's organization. Use get_lead_view for one full configuration.", { organization_id: z.string(), lead_group_id: z.string() }, async ({ organization_id, lead_group_id }) => {
|
|
20
|
+
try {
|
|
21
|
+
const data = await getClient().get(`/api/lead-group/${encodeURIComponent(lead_group_id)}/views`);
|
|
22
|
+
const result = data;
|
|
23
|
+
return toolResult({ ...result, organizationId: organization_id });
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
return handleToolError(error);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
server.tool("get_lead_view", "Read one selected saved view, or the read-only virtual view ID `default`, after selecting its organization and lead group.", { organization_id: z.string(), lead_group_id: z.string(), view_id: z.string() }, async ({ organization_id, lead_group_id, view_id }) => {
|
|
30
|
+
try {
|
|
31
|
+
const data = await getClient().get(`/api/lead-group/${encodeURIComponent(lead_group_id)}/views/${encodeURIComponent(view_id)}`);
|
|
32
|
+
return toolResult({ ...data, organizationId: organization_id });
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return handleToolError(error);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
server.tool("preview_lead_view", "Validate a proposed organization-shared lead view without writing it. Use this before create_lead_view; no data or preference is changed.", viewConfigSchema, async ({ organization_id, lead_group_id, name, filters, columns, sort, pagination }) => {
|
|
39
|
+
try {
|
|
40
|
+
const data = await getClient().post(`/api/lead-group/${encodeURIComponent(lead_group_id)}/views/preview`, { organizationId: organization_id, name, filters, columns, sort, pagination });
|
|
41
|
+
return toolResult(data);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return handleToolError(error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
server.tool("create_lead_view", "Create an organization-shared saved view after previewing it. Idempotency key is required: retry the same request with the same key; changing the payload with that key conflicts. Update and delete are intentionally unavailable.", { ...viewConfigSchema, idempotency_key: z.string().min(8).max(200) }, async ({ organization_id, lead_group_id, name, filters, columns, sort, pagination, idempotency_key }) => {
|
|
48
|
+
try {
|
|
49
|
+
const data = await getClient().post(`/api/lead-group/${encodeURIComponent(lead_group_id)}/views`, { organizationId: organization_id, name, filters, columns, sort, pagination, idempotencyKey: idempotency_key });
|
|
50
|
+
return toolResult(data);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return handleToolError(error);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|