@agifyai/leadify-mcp 3.5.0 → 3.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.
package/dist/client.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare class LeadifyClient {
6
6
  get(path: string, params?: URLSearchParams): Promise<unknown>;
7
7
  post(path: string, body: unknown): Promise<unknown>;
8
8
  put(path: string, body: unknown): Promise<unknown>;
9
+ patch(path: string, body: unknown): Promise<unknown>;
9
10
  delete(path: string): Promise<unknown>;
10
11
  }
11
12
  export declare function getClient(): LeadifyClient;
package/dist/client.js CHANGED
@@ -16,7 +16,8 @@ export class LeadifyClient {
16
16
  Authorization: `Bearer ${this.apiKey}`,
17
17
  };
18
18
  const init = { method, headers };
19
- if (body !== undefined && (method === "POST" || method === "PUT")) {
19
+ if (body !== undefined &&
20
+ (method === "POST" || method === "PUT" || method === "PATCH")) {
20
21
  headers["Content-Type"] = "application/json";
21
22
  init.body = JSON.stringify(body);
22
23
  }
@@ -48,6 +49,10 @@ export class LeadifyClient {
48
49
  const url = new URL(path, this.baseUrl);
49
50
  return this.request("PUT", url, body);
50
51
  }
52
+ async patch(path, body) {
53
+ const url = new URL(path, this.baseUrl);
54
+ return this.request("PATCH", url, body);
55
+ }
51
56
  async delete(path) {
52
57
  const url = new URL(path, this.baseUrl);
53
58
  return this.request("DELETE", url);
package/dist/server.js CHANGED
@@ -16,7 +16,7 @@ import { registerPipelineTools } from "./tools/pipeline.js";
16
16
  export function createServer() {
17
17
  const server = new McpServer({
18
18
  name: "leadify",
19
- version: "3.5.0",
19
+ version: "3.6.1",
20
20
  });
21
21
  registerAuthTools(server);
22
22
  registerOrganizationTools(server);
@@ -4,6 +4,17 @@ import { toolResult, handleToolError } from "../types.js";
4
4
  // Dedicated tool for the Fine Tuning page (separate from OutreachSettings).
5
5
  // Both concepts live in the DB (FineTuning + OutreachSettings) and the API
6
6
  // keeps them strictly separated: this endpoint NEVER touches OutreachSettings.
7
+ //
8
+ // Two write tools coexist by design, with NON-OVERLAPPING contracts:
9
+ // - append_fine_tuning → ALWAYS appends, never replaces. Contractual guarantee
10
+ // for the iterative build-up pattern (skill operator
11
+ // accumulates rules and examples as the user iterates).
12
+ // - set_fine_tuning → WHOLESALE replace of ONE section. Use when you need
13
+ // to wipe + rewrite a section cleanly (e.g. after a big
14
+ // refactor, or to clear a section by passing empty
15
+ // content).
16
+ // The split exists so neither caller is ever confused about which behavior
17
+ // they triggered.
7
18
  export function registerFineTuningTools(server) {
8
19
  // ── get_fine_tuning ───────────────────────────────────────────────────
9
20
  server.tool("get_fine_tuning", "Get the fine tuning configuration for a specific lead group. Returns exactly " +
@@ -30,4 +41,49 @@ export function registerFineTuningTools(server) {
30
41
  return handleToolError(error);
31
42
  }
32
43
  });
44
+ // ── set_fine_tuning ───────────────────────────────────────────────────
45
+ // WHOLESALE replace of one Fine Tuning section. Distinct from
46
+ // append_fine_tuning (which is append-only, contractual). Both tools
47
+ // coexist intentionally — pick the right one for the intent.
48
+ server.tool("set_fine_tuning", "WHOLESALE replace ONE section of the fine tuning configuration for a lead group. " +
49
+ "The target section is fully overwritten with the new content. " +
50
+ "This is the destructive counterpart of append_fine_tuning: use it when you need " +
51
+ "to wipe and rewrite a section cleanly (big refactor, schema change, full clear). " +
52
+ "SIBLING SECTIONS ARE NOT TOUCHED. Only the named section is replaced; the other 3 " +
53
+ "Markdown sections, supportedLanguages, and fallbackLanguage stay intact. " +
54
+ "To clear a section, pass content=\"\". " +
55
+ "DO NOT use this for incremental edits — use append_fine_tuning instead so the " +
56
+ "iterative build-up pattern is preserved (no accidental wipe of accumulated rules " +
57
+ "or examples). " +
58
+ "The 4 replaceable sections are: nonNegotiableRules, pitfalls, structure, examples. " +
59
+ "Languages (supportedLanguages, fallbackLanguage) are managed separately via the " +
60
+ "Fine Tuning UI or by a dedicated languages tool — this endpoint does not touch them. " +
61
+ "Wired to PATCH /api/lead-group/{id}/fine-tuning/section/{section} per the Leadify API " +
62
+ "contract: section is in the URL path (not the body), the request is a partial update " +
63
+ "(not a wholesale row replace — for that, fall back to the Leadify UI or a follow-up " +
64
+ "MCP tool, neither of which exists yet as of 3.6.1).", {
65
+ lead_group_id: z
66
+ .string()
67
+ .describe("ID of the lead group whose fine tuning section to overwrite."),
68
+ section: z
69
+ .enum(["nonNegotiableRules", "pitfalls", "structure", "examples"])
70
+ .describe("Which Fine Tuning section to replace. One of: " +
71
+ "nonNegotiableRules | pitfalls | structure | examples. " +
72
+ "Goes into the URL path as /section/{section} — not the request body."),
73
+ content: z
74
+ .string()
75
+ .describe("New content for the section (Markdown). The section is replaced WHOLESALE — " +
76
+ "any previous content is lost. Pass an empty string to clear the section."),
77
+ }, async ({ lead_group_id, section, content }) => {
78
+ try {
79
+ const data = await getClient().patch(`/api/lead-group/${encodeURIComponent(lead_group_id)}/fine-tuning/section/${encodeURIComponent(section)}`, { content });
80
+ return toolResult({
81
+ ...(data && typeof data === "object" ? data : {}),
82
+ _note: `Wholesale replace of section '${section}' for lead group ${lead_group_id}.`,
83
+ });
84
+ }
85
+ catch (error) {
86
+ return handleToolError(error);
87
+ }
88
+ });
33
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agifyai/leadify-mcp",
3
- "version": "3.5.0",
3
+ "version": "3.6.1",
4
4
  "description": "MCP server for Leadify lead management API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",