@agifyai/leadify-mcp 8.2.0 → 8.3.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/dist/server.js +3 -1
- package/dist/tools/views.d.ts +2 -0
- package/dist/tools/views.js +56 -0
- package/package.json +1 -1
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.0",
|
|
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);
|
|
@@ -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
|
+
}
|