@agifyai/leadify-mcp 8.5.4 → 8.6.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.
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { getClient } from "../client.js";
3
3
  import { toolResult, toolError, handleToolError } from "../types.js";
4
- export function registerPipelineTools(server) {
4
+ export function registerPipelineTools(server, client = getClient()) {
5
5
  // ── trigger_outreach ─────────────────────────────────────────────────────
6
6
  server.tool("trigger_outreach", "Generate the outreach message SEQUENCE for a lead via the Trigger.dev agent " +
7
7
  "(Leadify v3 writer). The agent is a PURE MESSAGE WRITER: it produces a multi-touch " +
@@ -28,13 +28,11 @@ export function registerPipelineTools(server) {
28
28
  "traceUrl. In dry-run (dryrun=true) the call is safe to retry, since nothing is " +
29
29
  "persisted; for production writes (dryrun=false) prefer following the trace over " +
30
30
  "blindly retrying to avoid duplicate generation. " +
31
- "CARDS SUBSET (cards_to_generate): pass an explicit list of card names to restrict " +
32
- "the generation to a specific subset. Use this for single-touch campaigns or " +
33
- "when the full 10-card cycle is not needed. Omit to generate the full sequence " +
34
- "(default). Subject fields (card_email_one_subject, etc.) should always accompany " +
35
- "their body card. Valid card names: card_connexion, card_linkedin_one, " +
36
- "card_linkedin_two, card_linkedin_three, card_email_one, card_email_one_subject, " +
37
- "card_email_two, card_email_two_subject, card_email_three, card_email_three_subject.", {
31
+ "FREE WRITER: context_selection extends this same runtime with one explicit " +
32
+ "Vertical, Offer and Persona triplet. The backend requires all three objects to be " +
33
+ "ACTIVE, tenant-scoped and linked; no default is inferred. Omit context_selection " +
34
+ "to use the Lead Group-owned selection. The exact message-card set always comes " +
35
+ "from Fine Tuning and cannot be selected through technical card names.", {
38
36
  lead_id: z.string().describe("ID of the lead to generate a message for."),
39
37
  dryrun: z
40
38
  .boolean()
@@ -49,28 +47,17 @@ export function registerPipelineTools(server) {
49
47
  .default(false)
50
48
  .describe("true = bypass the 'already has a message?' check so you can re-generate. " +
51
49
  "false (default) = normal behaviour: skip leads that already have card_message."),
52
- cards_to_generate: z
53
- .array(z.enum([
54
- "card_connexion",
55
- "card_linkedin_one",
56
- "card_linkedin_two",
57
- "card_linkedin_three",
58
- "card_email_one",
59
- "card_email_one_subject",
60
- "card_email_two",
61
- "card_email_two_subject",
62
- "card_email_three",
63
- "card_email_three_subject",
64
- ]))
65
- .min(1)
50
+ context_selection: z
51
+ .object({
52
+ vertical_id: z.string().trim().min(1),
53
+ offer_id: z.string().trim().min(1),
54
+ persona_id: z.string().trim().min(1),
55
+ })
56
+ .strict()
66
57
  .optional()
67
- .describe("Optional subset of outreach cards to generate. When omitted, all cards are " +
68
- "generated (default behaviour full 10-card sequence). When provided, ONLY " +
69
- "these cards are generated. Example for single-touch: " +
70
- "['card_connexion', 'card_linkedin_one', 'card_email_one', 'card_email_one_subject']. " +
71
- "Subject fields must always accompany their body card. Cards for channels the " +
72
- "lead doesn't have (e.g. email when no email address) are silently dropped."),
73
- }, async ({ lead_id, dryrun, force, cards_to_generate }) => {
58
+ .describe("Optional explicit free-writer context. Supply vertical_id, offer_id and " +
59
+ "persona_id together. Omit to inherit the Lead Group context."),
60
+ }, async ({ lead_id, dryrun, force, context_selection }) => {
74
61
  try {
75
62
  // Resolve leadGroupId server-side. The Trigger.dev task payload requires
76
63
  // `leadGroupId`, but the lead_id alone is enough on the MCP side — we
@@ -79,7 +66,7 @@ export function registerPipelineTools(server) {
79
66
  // 10–60s Trigger.dev wait that follows.
80
67
  const leadParams = new URLSearchParams();
81
68
  leadParams.set("id", lead_id);
82
- const leadRes = (await getClient().get("/get-lead", leadParams));
69
+ const leadRes = (await client.get("/get-lead", leadParams));
83
70
  const leadGroupId = leadRes?.lead?.groupId;
84
71
  if (!leadGroupId) {
85
72
  return toolError(`Cannot resolve leadGroupId for lead "${lead_id}". ` +
@@ -96,10 +83,14 @@ export function registerPipelineTools(server) {
96
83
  dryrun,
97
84
  force,
98
85
  };
99
- if (cards_to_generate && cards_to_generate.length > 0) {
100
- body.cardsToGenerate = cards_to_generate;
86
+ if (context_selection) {
87
+ body.contextSelection = {
88
+ verticalId: context_selection.vertical_id,
89
+ offerId: context_selection.offer_id,
90
+ personaId: context_selection.persona_id,
91
+ };
101
92
  }
102
- const data = (await getClient().post("/api/trigger-outreach", body));
93
+ const data = (await client.post("/api/trigger-outreach", body));
103
94
  // Decorate the response with a Trigger.dev run deep-link when the
104
95
  // backend didn't ship one. Applies to BOTH success and failure paths
105
96
  // so the skill operator can always jump to the trace.
@@ -133,7 +124,7 @@ export function registerPipelineTools(server) {
133
124
  .describe("Separator between old and new content. Default: '\\n\\n---\\n\\n'."),
134
125
  }, async ({ lead_group_id, section, content, separator }) => {
135
126
  try {
136
- const data = await getClient().post("/api/pipeline/append-fine-tuning", {
127
+ const data = await client.post("/api/pipeline/append-fine-tuning", {
137
128
  leadGroupId: lead_group_id,
138
129
  section,
139
130
  content,
@@ -166,7 +157,7 @@ export function registerPipelineTools(server) {
166
157
  .describe("Maximum number of leads to return (1-5, default 1)."),
167
158
  }, async ({ lead_group_id, exclude_lead_ids, limit }) => {
168
159
  try {
169
- const data = await getClient().post("/api/pipeline/next-lead", {
160
+ const data = await client.post("/api/pipeline/next-lead", {
170
161
  leadGroupId: lead_group_id,
171
162
  excludeLeadIds: exclude_lead_ids,
172
163
  limit,
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export declare const MCP_PACKAGE_NAME = "@agifyai/leadify-mcp";
2
2
  export declare const MCP_SERVER_NAME = "leadify";
3
- export declare const MCP_VERSION = "8.5.4";
3
+ export declare const MCP_VERSION = "8.6.1";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export const MCP_PACKAGE_NAME = "@agifyai/leadify-mcp";
2
2
  export const MCP_SERVER_NAME = "leadify";
3
- export const MCP_VERSION = "8.5.4";
3
+ export const MCP_VERSION = "8.6.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agifyai/leadify-mcp",
3
- "version": "8.5.4",
3
+ "version": "8.6.1",
4
4
  "description": "MCP server for Leadify lead management API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,2 +0,0 @@
1
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare function registerDataRoomTools(server: McpServer): void;