@opennous/mcp 0.19.0 → 0.20.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/package.json +1 -1
- package/src/server.js +53 -1
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -28,13 +28,14 @@
|
|
|
28
28
|
* configure_crm_sync — set CRM sync rules (auto-sync, create policy, hygiene cadence)
|
|
29
29
|
* set_trigger — create an outbound event trigger (webhook); list_triggers reads them
|
|
30
30
|
* list_triggers — list the workspace's event triggers + available events
|
|
31
|
+
* lead_list_operations — the operations trail of a lead list (imports/enrich/push/replies), filterable
|
|
31
32
|
*/
|
|
32
33
|
|
|
33
34
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
34
35
|
import { z } from "zod";
|
|
35
36
|
import { get, post } from "./client.js";
|
|
36
37
|
|
|
37
|
-
export const SERVER_VERSION = "0.
|
|
38
|
+
export const SERVER_VERSION = "0.20.0";
|
|
38
39
|
|
|
39
40
|
// ─── helpers ──────────────────────────────────────────────────────────────────
|
|
40
41
|
|
|
@@ -760,5 +761,56 @@ export function createServer() {
|
|
|
760
761
|
}
|
|
761
762
|
);
|
|
762
763
|
|
|
764
|
+
// ===========================================================================
|
|
765
|
+
// TOOL: lead_list_operations — GET /api/lead-lists[/:id/operations]
|
|
766
|
+
// The operations trail for a lead list: imports, enrichment runs, pushes to
|
|
767
|
+
// campaigns, and replies — filterable by category and time window. This is how
|
|
768
|
+
// you answer "what happened on this list?" and attribute campaign performance
|
|
769
|
+
// back to where the leads came from (the list's source). Call with no
|
|
770
|
+
// lead_list_id to discover the lists and their ids first.
|
|
771
|
+
// ===========================================================================
|
|
772
|
+
server.tool(
|
|
773
|
+
"lead_list_operations",
|
|
774
|
+
"Inspect the operations trail of a lead list — imports, enrichment runs, pushes to campaigns, " +
|
|
775
|
+
"and classified replies — to report on what happened and attribute outcomes to a list's source. " +
|
|
776
|
+
"Call with NO lead_list_id to list the workspace's lead lists (id, name, count, source), then " +
|
|
777
|
+
"call again with an id. Filter with `event` (import | enrich | export | reply) and `days`. " +
|
|
778
|
+
"Each operation is a run-level summary (one row per import/enrich/push), not per-lead noise.",
|
|
779
|
+
{
|
|
780
|
+
lead_list_id: z.string().optional().describe("The lead list's UUID. Omit to list the available lead lists first."),
|
|
781
|
+
event: z.enum(["import", "enrich", "export", "reply"]).optional().describe("Filter to one category of operation."),
|
|
782
|
+
days: z.number().optional().describe("Look back this many days (default 30). Pass a large number for all-time."),
|
|
783
|
+
limit: z.number().optional().describe("Max operations to return (default 100, cap 200)."),
|
|
784
|
+
},
|
|
785
|
+
async ({ lead_list_id, event, days, limit }) => {
|
|
786
|
+
// Discovery mode — no list id yet. Return the lists so the agent can pick.
|
|
787
|
+
if (!lead_list_id) {
|
|
788
|
+
const r = await get("/api/lead-lists");
|
|
789
|
+
const lists = r.lead_lists || [];
|
|
790
|
+
const lines = lists.length
|
|
791
|
+
? [`LEAD LISTS (${lists.length}):`,
|
|
792
|
+
...lists.map(l => ` ${l.id} ${l.name} · ${l.lead_count ?? 0} leads · source: ${l.source || "—"}`),
|
|
793
|
+
"", "Call lead_list_operations again with one of these ids (and an optional event filter)."]
|
|
794
|
+
: ["No lead lists yet."];
|
|
795
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
const r = await get(`/api/lead-lists/${encodeURIComponent(lead_list_id)}/operations`, { event, days, limit });
|
|
799
|
+
const ops = r.operations || [];
|
|
800
|
+
const lines = [];
|
|
801
|
+
const summary = Object.entries(r.by_category || {}).map(([k, v]) => `${k} ${v}`).join(" · ");
|
|
802
|
+
lines.push(`OPERATIONS${event ? ` · ${event}` : ""} (${ops.length})${summary ? ` — ${summary}` : ""}`);
|
|
803
|
+
if (!ops.length) {
|
|
804
|
+
lines.push("", "No operations in this window.");
|
|
805
|
+
} else {
|
|
806
|
+
for (const o of ops) {
|
|
807
|
+
const cat = o.metadata?.category || o.event_type;
|
|
808
|
+
lines.push(` ${relAge(o.occurred_at).padEnd(8)} ${String(cat).padEnd(8)} ${o.summary}`);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
return { content: [{ type: "text", text: lines.join("\n").trim() }] };
|
|
812
|
+
}
|
|
813
|
+
);
|
|
814
|
+
|
|
763
815
|
return server;
|
|
764
816
|
}
|