@loopops/mcp-server 3.22.0 → 3.23.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/tools/crm.js +9 -50
- package/package.json +1 -1
package/dist/tools/crm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { trpcMutation } from "../api-client.js";
|
|
3
3
|
import { safeTool } from "./_helpers.js";
|
|
4
|
-
import {
|
|
4
|
+
import { targetAccountTierSchema } from "./_schemas.js";
|
|
5
5
|
export function registerCrmTools(server, allowed) {
|
|
6
6
|
// my_pipeline retired 2026-05-06 — replaced by ClickHouse parameterized
|
|
7
7
|
// view analytics.my_pipeline. Row policies on salesforce.opportunity
|
|
@@ -12,58 +12,17 @@ export function registerCrmTools(server, allowed) {
|
|
|
12
12
|
// analytics.my_leads. Row policies on salesforce.lead enforce per-user
|
|
13
13
|
// scoping. Filter by created_date in the caller. See docs/CH-ANALYTICS-VIEWS.md.
|
|
14
14
|
// pipeline_health retired 2026-05-06 — replaced by ClickHouse views
|
|
15
|
-
// analytics.pipeline_by_stage + analytics.win_rate(range_days).
|
|
16
|
-
//
|
|
17
|
-
// salesforce.opportunity enforce per-user scoping. See docs/CH-ANALYTICS-VIEWS.md.
|
|
15
|
+
// analytics.pipeline_by_stage + analytics.win_rate(range_days).
|
|
16
|
+
// See docs/CH-ANALYTICS-VIEWS.md.
|
|
18
17
|
// rep_performance retired 2026-05-06 — replaced by ClickHouse view
|
|
19
18
|
// analytics.rep_performance(range_days). See docs/CH-ANALYTICS-VIEWS.md.
|
|
20
19
|
// forecast retired 2026-05-06 — replaced by ClickHouse view
|
|
21
|
-
// analytics.forecast(quarter_start, quarter_end).
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.describe("Salesforce Opportunity ID (006…). Preferred if known."),
|
|
28
|
-
opportunityName: z
|
|
29
|
-
.string()
|
|
30
|
-
.optional()
|
|
31
|
-
.describe("Exact opportunity name, used when you don't have the Salesforce ID."),
|
|
32
|
-
close_date: z
|
|
33
|
-
.string()
|
|
34
|
-
.regex(/^\d{4}-\d{2}-\d{2}$/, { message: "Use YYYY-MM-DD." })
|
|
35
|
-
.optional()
|
|
36
|
-
.describe("New close date in YYYY-MM-DD format."),
|
|
37
|
-
next_step: z.string().optional().describe("Next step text."),
|
|
38
|
-
description: z.string().optional().describe("Opportunity description."),
|
|
39
|
-
reason: z
|
|
40
|
-
.string()
|
|
41
|
-
.min(1)
|
|
42
|
-
.describe("Why this change is being made (required, logged)."),
|
|
43
|
-
}, safeTool(async ({ opportunityId, opportunityName, close_date, next_step, description, reason }) => trpcMutation("mcp.updateOpportunity", {
|
|
44
|
-
opportunityId,
|
|
45
|
-
opportunityName,
|
|
46
|
-
fields: { close_date, next_step, description },
|
|
47
|
-
reason,
|
|
48
|
-
})));
|
|
49
|
-
}
|
|
50
|
-
if (allowed.has("update_lead")) {
|
|
51
|
-
server.tool("update_lead", "Update a lead's status or description. Reps can only update their own leads. Requires a reason for the change.", {
|
|
52
|
-
leadId: salesforceLeadIdSchema.describe("Salesforce Lead ID (00Q…)."),
|
|
53
|
-
status: leadStatusSchema
|
|
54
|
-
.optional()
|
|
55
|
-
.describe("New Salesforce Lead status."),
|
|
56
|
-
description: z.string().optional().describe("Lead description."),
|
|
57
|
-
reason: z
|
|
58
|
-
.string()
|
|
59
|
-
.min(1)
|
|
60
|
-
.describe("Why this change is being made (required, logged)."),
|
|
61
|
-
}, safeTool(async ({ leadId, status, description, reason }) => trpcMutation("mcp.updateLead", {
|
|
62
|
-
leadId,
|
|
63
|
-
fields: { status, description },
|
|
64
|
-
reason,
|
|
65
|
-
})));
|
|
66
|
-
}
|
|
20
|
+
// analytics.forecast(quarter_start, quarter_end). See docs/CH-ANALYTICS-VIEWS.md.
|
|
21
|
+
// update_opportunity / update_lead removed 2026-05-09 (Phase 2 of
|
|
22
|
+
// docs/SALESFORCE-MCP-PLAN.md). Opportunity + Lead writes go through
|
|
23
|
+
// the `salesforce-hosted` MCP for every Loop role: per-user OAuth+PKCE
|
|
24
|
+
// preserves LastModifiedById; sharing rules + FLS + validation rules
|
|
25
|
+
// enforce server-side. Use mcp__salesforce-hosted__updateSobjectRecord.
|
|
67
26
|
if (allowed.has("push_target_account_to_sf")) {
|
|
68
27
|
server.tool("push_target_account_to_sf", "Create Salesforce Account records from the target account list. Pushes accounts that don't yet have an SF Account ID. Ops+ only.", {
|
|
69
28
|
domain: z
|