salesforce-metadata-mcp 2.2.0 → 2.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/CHANGELOG.md +62 -0
- package/README.md +73 -3
- package/dist/index.js +4 -4
- package/dist/schemas/index.js +259 -5
- package/dist/services/salesforce.js +667 -0
- package/dist/tools/index.js +4 -0
- package/dist/tools/omnichannel.js +279 -0
- package/dist/tools/omnistudio.js +280 -0
- package/package.json +15 -3
package/dist/tools/index.js
CHANGED
|
@@ -12,6 +12,8 @@ import { registerMcpTools } from "./mcp.js";
|
|
|
12
12
|
import { registerIntegrationTools } from "./integrations.js";
|
|
13
13
|
import { registerReportTools } from "./reports.js";
|
|
14
14
|
import { registerDataTools } from "./data.js";
|
|
15
|
+
import { registerOmniStudioTools } from "./omnistudio.js";
|
|
16
|
+
import { registerOmniChannelTools } from "./omnichannel.js";
|
|
15
17
|
export function registerTools(server) {
|
|
16
18
|
registerMetadataTools(server);
|
|
17
19
|
registerObjectTools(server);
|
|
@@ -27,5 +29,7 @@ export function registerTools(server) {
|
|
|
27
29
|
registerIntegrationTools(server);
|
|
28
30
|
registerReportTools(server);
|
|
29
31
|
registerDataTools(server);
|
|
32
|
+
registerOmniStudioTools(server);
|
|
33
|
+
registerOmniChannelTools(server);
|
|
30
34
|
}
|
|
31
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CreateServiceChannelSchema, CreateRoutingConfigurationSchema, CreateQueueRoutingConfigSchema,
|
|
3
|
+
CreatePresenceConfigurationSchema, CreatePresenceStatusSchema, AssignPresenceStatusSchema,
|
|
4
|
+
CreateSkillSchema, AssignSkillToAgentSchema, CreateServiceTerritorySchema, CreateWorkTypeSchema,
|
|
5
|
+
CreateMessagingChannelSchema, CreateChatButtonSchema, CreateEmbeddedServiceSchema, CreateBotRoutingSchema,
|
|
6
|
+
} from "../schemas/index.js";
|
|
7
|
+
import {
|
|
8
|
+
getAuth,
|
|
9
|
+
createServiceChannel, createRoutingConfiguration, createQueueRoutingConfig,
|
|
10
|
+
createPresenceConfiguration, createPresenceStatus, assignPresenceStatus,
|
|
11
|
+
createSkill, assignSkillToAgent, createServiceTerritory, createWorkType,
|
|
12
|
+
createMessagingChannel, createChatButton, createEmbeddedService, createBotRouting,
|
|
13
|
+
} from "../services/salesforce.js";
|
|
14
|
+
import { resultContent } from "./utils.js";
|
|
15
|
+
|
|
16
|
+
export function registerOmniChannelTools(server) {
|
|
17
|
+
// ─── SERVICE CHANNELS & ROUTING ───────────────────────────────────────────
|
|
18
|
+
server.registerTool("sf_create_service_channel", {
|
|
19
|
+
title: "Create OmniChannel Service Channel",
|
|
20
|
+
description: `Creates an OmniChannel Service Channel that connects work items from a Salesforce object to the OmniChannel routing engine.
|
|
21
|
+
|
|
22
|
+
channelType options: Case, Chat, Messaging, Voice, Email, SocialPost, Custom
|
|
23
|
+
|
|
24
|
+
relatedObjectApiName: the Salesforce object this channel routes (e.g. "Case", "LiveChatTranscript", "MessagingSession"). Required for Custom type.
|
|
25
|
+
|
|
26
|
+
capacity: maximum number of simultaneous work items an agent can handle on this channel (default 1).
|
|
27
|
+
|
|
28
|
+
Service Channels are referenced by Routing Configurations and Presence Configurations.`,
|
|
29
|
+
inputSchema: CreateServiceChannelSchema,
|
|
30
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
31
|
+
}, async (params) => {
|
|
32
|
+
const auth = await getAuth();
|
|
33
|
+
const result = await createServiceChannel(auth, params);
|
|
34
|
+
return resultContent(result);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
server.registerTool("sf_create_routing_configuration", {
|
|
38
|
+
title: "Create OmniChannel Routing Configuration",
|
|
39
|
+
description: `Creates a Routing Configuration that defines how work items are assigned to agents.
|
|
40
|
+
|
|
41
|
+
routingModel options:
|
|
42
|
+
- LeastActive: routes to the agent with the fewest active work items
|
|
43
|
+
- MostAvailable: routes to the agent with the most available capacity
|
|
44
|
+
- ExternalRouting: custom routing via Apex or external system
|
|
45
|
+
|
|
46
|
+
capacity: agent capacity consumed per work item (1–100)
|
|
47
|
+
priority: routing priority (lower number = higher priority, range 1–10)
|
|
48
|
+
unitType: Percentage or Throughput (how capacity is measured)
|
|
49
|
+
pushTimeout: seconds before a declined/unanswered item is re-queued (optional)
|
|
50
|
+
|
|
51
|
+
After creating, link it to a queue with sf_create_queue_routing_config.`,
|
|
52
|
+
inputSchema: CreateRoutingConfigurationSchema,
|
|
53
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
54
|
+
}, async (params) => {
|
|
55
|
+
const auth = await getAuth();
|
|
56
|
+
const result = await createRoutingConfiguration(auth, params);
|
|
57
|
+
return resultContent(result);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
server.registerTool("sf_create_queue_routing_config", {
|
|
61
|
+
title: "Link Routing Configuration to Queue",
|
|
62
|
+
description: `Associates a Routing Configuration with an existing Queue, enabling OmniChannel routing for that queue.
|
|
63
|
+
|
|
64
|
+
After creating a Routing Configuration (sf_create_routing_configuration), use this tool to link it to the Queue that holds the work items. Work items assigned to the queue will then be routed to agents using the specified routing model.
|
|
65
|
+
|
|
66
|
+
queueDeveloperName: the API name of the Queue (DeveloperName, not label)
|
|
67
|
+
routingConfigName: the API name of the Routing Configuration to link`,
|
|
68
|
+
inputSchema: CreateQueueRoutingConfigSchema,
|
|
69
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
70
|
+
}, async (params) => {
|
|
71
|
+
const auth = await getAuth();
|
|
72
|
+
const result = await createQueueRoutingConfig(auth, params);
|
|
73
|
+
return resultContent(result);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
server.registerTool("sf_create_presence_configuration", {
|
|
77
|
+
title: "Create OmniChannel Presence Configuration",
|
|
78
|
+
description: `Creates a Presence Configuration (PresenceUserConfig) that controls which Service Channels agents can handle and their total work capacity.
|
|
79
|
+
|
|
80
|
+
capacity: total capacity units available to agents with this configuration
|
|
81
|
+
serviceChannels: list of Service Channel API names the agents can work on
|
|
82
|
+
allowAgentsToChangeStatus: whether agents can manually change their presence status
|
|
83
|
+
|
|
84
|
+
Assign this configuration to agents via their Profile or Permission Set.`,
|
|
85
|
+
inputSchema: CreatePresenceConfigurationSchema,
|
|
86
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
87
|
+
}, async (params) => {
|
|
88
|
+
const auth = await getAuth();
|
|
89
|
+
const result = await createPresenceConfiguration(auth, params);
|
|
90
|
+
return resultContent(result);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
server.registerTool("sf_create_presence_status", {
|
|
94
|
+
title: "Create OmniChannel Presence Status",
|
|
95
|
+
description: `Creates a Presence Status that agents can set to indicate their availability.
|
|
96
|
+
|
|
97
|
+
statusType:
|
|
98
|
+
- Online: agent is available for all assigned channels
|
|
99
|
+
- Busy: agent is limited to specific channels
|
|
100
|
+
- Offline: agent receives no work items
|
|
101
|
+
|
|
102
|
+
serviceChannels: for Busy status, list which channels remain active.
|
|
103
|
+
|
|
104
|
+
After creating, assign the status to profiles/permission sets with sf_assign_presence_status.`,
|
|
105
|
+
inputSchema: CreatePresenceStatusSchema,
|
|
106
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
107
|
+
}, async (params) => {
|
|
108
|
+
const auth = await getAuth();
|
|
109
|
+
const result = await createPresenceStatus(auth, params);
|
|
110
|
+
return resultContent(result);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
server.registerTool("sf_assign_presence_status", {
|
|
114
|
+
title: "Assign Presence Status to Profiles/Permission Sets",
|
|
115
|
+
description: `Grants access to a Presence Status for the specified Profiles and/or Permission Sets. Agents can only select presence statuses that are assigned to their profile or permission set.
|
|
116
|
+
|
|
117
|
+
profiles: list of Profile names (e.g. ["Standard User", "Service Agent"])
|
|
118
|
+
permissionSets: list of Permission Set API names
|
|
119
|
+
|
|
120
|
+
Either profiles or permissionSets must be provided (or both).`,
|
|
121
|
+
inputSchema: AssignPresenceStatusSchema,
|
|
122
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
123
|
+
}, async (params) => {
|
|
124
|
+
const auth = await getAuth();
|
|
125
|
+
const result = await assignPresenceStatus(auth, params);
|
|
126
|
+
return resultContent(result);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// ─── SKILLS & FIELD SERVICE ───────────────────────────────────────────────
|
|
130
|
+
server.registerTool("sf_create_skill", {
|
|
131
|
+
title: "Create OmniChannel / Field Service Skill",
|
|
132
|
+
description: `Creates a Skill that can be assigned to service agents. Skills are used for:
|
|
133
|
+
- OmniChannel skill-based routing (route work to agents with required skills)
|
|
134
|
+
- Field Service Lightning (assign skills to resources, skills to work types)
|
|
135
|
+
|
|
136
|
+
After creating a skill, assign it to agents with sf_assign_skill_to_agent.`,
|
|
137
|
+
inputSchema: CreateSkillSchema,
|
|
138
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
139
|
+
}, async (params) => {
|
|
140
|
+
const auth = await getAuth();
|
|
141
|
+
const result = await createSkill(auth, params);
|
|
142
|
+
return resultContent(result);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
server.registerTool("sf_assign_skill_to_agent", {
|
|
146
|
+
title: "Assign Skill to Service Agent",
|
|
147
|
+
description: `Assigns a Skill to a Salesforce user (service agent) with a skill level rating. Creates a ServiceResource for the user if one does not already exist, then creates a ServiceResourceSkill record.
|
|
148
|
+
|
|
149
|
+
skillName: the API name (DeveloperName) of the skill to assign
|
|
150
|
+
username: the Salesforce username (e.g. agent@example.com) or user ID
|
|
151
|
+
skillLevel: proficiency level from 0 to 10 (default 5)
|
|
152
|
+
|
|
153
|
+
ServiceResource is the Field Service / OmniChannel representation of a user as a workable resource.`,
|
|
154
|
+
inputSchema: AssignSkillToAgentSchema,
|
|
155
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
156
|
+
}, async (params) => {
|
|
157
|
+
const auth = await getAuth();
|
|
158
|
+
const result = await assignSkillToAgent(auth, params);
|
|
159
|
+
return resultContent(result);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
server.registerTool("sf_create_service_territory", {
|
|
163
|
+
title: "Create Field Service Service Territory",
|
|
164
|
+
description: `Creates a Service Territory for Field Service Lightning. Territories define the geographic areas or organizational divisions where field service resources operate.
|
|
165
|
+
|
|
166
|
+
isActive: set true to make the territory immediately available for scheduling
|
|
167
|
+
operatingHoursName: API name of an existing OperatingHours record to set business hours
|
|
168
|
+
Address fields (street, city, state, country, postalCode): optional location for the territory center`,
|
|
169
|
+
inputSchema: CreateServiceTerritorySchema,
|
|
170
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
171
|
+
}, async (params) => {
|
|
172
|
+
const auth = await getAuth();
|
|
173
|
+
const result = await createServiceTerritory(auth, params);
|
|
174
|
+
return resultContent(result);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
server.registerTool("sf_create_work_type", {
|
|
178
|
+
title: "Create Field Service Work Type",
|
|
179
|
+
description: `Creates a Work Type that defines a category of field service job. Work Types set default durations, block times, and skill requirements for work orders.
|
|
180
|
+
|
|
181
|
+
estimatedDuration: expected time to complete the work
|
|
182
|
+
durationType: Minutes, Hours, or Days
|
|
183
|
+
blockTimeBeforeWork: travel/prep time before the appointment
|
|
184
|
+
blockTimeAfterWork: cleanup/travel time after the appointment
|
|
185
|
+
skillRequirements: array of { skillName, skillLevel } — skills required on the resource to perform this work type`,
|
|
186
|
+
inputSchema: CreateWorkTypeSchema,
|
|
187
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
188
|
+
}, async (params) => {
|
|
189
|
+
const auth = await getAuth();
|
|
190
|
+
const result = await createWorkType(auth, params);
|
|
191
|
+
return resultContent(result);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// ─── MESSAGING, CHAT & VOICE ──────────────────────────────────────────────
|
|
195
|
+
server.registerTool("sf_create_messaging_channel", {
|
|
196
|
+
title: "Create Messaging Channel",
|
|
197
|
+
description: `Creates a Messaging Channel for Salesforce digital engagement (SMS, WhatsApp, Facebook Messenger, Apple Messages for Business, etc.).
|
|
198
|
+
|
|
199
|
+
channelType options: SMS, WhatsApp, Facebook, AppleBusinessChat, Line, GoogleBusinessMessages, EinsteinBotChannel, WebChat
|
|
200
|
+
|
|
201
|
+
phoneNumber: E.164 format phone number for SMS/WhatsApp channels (e.g. +15551234567)
|
|
202
|
+
pageId: Facebook Page ID or equivalent external platform identifier
|
|
203
|
+
|
|
204
|
+
routingType: Queue (route to a queue) or Bot (route to an Einstein Bot first)
|
|
205
|
+
queueName: required when routingType=Queue
|
|
206
|
+
botName: required when routingType=Bot (bot handles initial messages)
|
|
207
|
+
|
|
208
|
+
After creating, configure the channel with sf_create_embedded_service to add it to a site.`,
|
|
209
|
+
inputSchema: CreateMessagingChannelSchema,
|
|
210
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
211
|
+
}, async (params) => {
|
|
212
|
+
const auth = await getAuth();
|
|
213
|
+
const result = await createMessagingChannel(auth, params);
|
|
214
|
+
return resultContent(result);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
server.registerTool("sf_create_chat_button", {
|
|
218
|
+
title: "Create Live Agent Chat Button",
|
|
219
|
+
description: `Creates a Live Chat button (LiveChatButton) that can be embedded on websites to start chat sessions with agents.
|
|
220
|
+
|
|
221
|
+
routingType: Choice (skills-based) or Queue (queue-based routing)
|
|
222
|
+
queueName: the Queue to route chats to (for Queue routing)
|
|
223
|
+
botName: an Einstein Bot to handle chats initially (optional)
|
|
224
|
+
windowLanguage: display language for the chat window (e.g. "en_US", "fr", "de")
|
|
225
|
+
inviteRenderer: name of a custom Visualforce page for chat invitations
|
|
226
|
+
customAgentName: agent display name shown to website visitors
|
|
227
|
+
optionsHasTimeoutAlert: show alert if no agent available within timeout period
|
|
228
|
+
|
|
229
|
+
After creating, embed the chat button on a site with sf_create_embedded_service.`,
|
|
230
|
+
inputSchema: CreateChatButtonSchema,
|
|
231
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
232
|
+
}, async (params) => {
|
|
233
|
+
const auth = await getAuth();
|
|
234
|
+
const result = await createChatButton(auth, params);
|
|
235
|
+
return resultContent(result);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
server.registerTool("sf_create_embedded_service", {
|
|
239
|
+
title: "Create Embedded Service Deployment",
|
|
240
|
+
description: `Creates an Embedded Service deployment (EmbeddedServiceConfig) that bundles a chat button or messaging channel into a web snippet for embedding on websites or Experience Cloud sites.
|
|
241
|
+
|
|
242
|
+
channelType: Chat (uses a LiveChatButton) or Messaging (uses a MessagingChannel)
|
|
243
|
+
chatButtonName: required for Chat type — the LiveChatButton API name
|
|
244
|
+
messagingChannelName: required for Messaging type — the MessagingChannel API name
|
|
245
|
+
site: the Experience Cloud site or Salesforce Site API name to associate with
|
|
246
|
+
|
|
247
|
+
Branding:
|
|
248
|
+
- primaryColor: main brand color (hex, e.g. "#0070D2")
|
|
249
|
+
- secondaryColor: secondary/header color
|
|
250
|
+
- fontName: web font name (e.g. "Salesforce Sans")
|
|
251
|
+
|
|
252
|
+
After creation, get the deployment code snippet from Setup → Embedded Service Deployments.`,
|
|
253
|
+
inputSchema: CreateEmbeddedServiceSchema,
|
|
254
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
255
|
+
}, async (params) => {
|
|
256
|
+
const auth = await getAuth();
|
|
257
|
+
const result = await createEmbeddedService(auth, params);
|
|
258
|
+
return resultContent(result);
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
server.registerTool("sf_create_bot_routing", {
|
|
262
|
+
title: "Configure Bot Escalation Routing",
|
|
263
|
+
description: `Configures an Einstein Bot to transfer conversations to a human agent queue when escalation conditions are met. Updates the BotVersion with a Transfer dialog.
|
|
264
|
+
|
|
265
|
+
botName: the Bot API name (DeveloperName)
|
|
266
|
+
transferToQueueName: the Queue API name to transfer escalated conversations to
|
|
267
|
+
transferMessage: message shown to the customer during transfer (default: "Connecting you to an agent...")
|
|
268
|
+
escalationConditions: array of { trigger, action } pairs. Triggers: agentRequested, noResponse, fallback. Actions: TransferToQueue.
|
|
269
|
+
|
|
270
|
+
This tool finds the latest BotVersion for the specified bot and adds the transfer dialog. The bot must already exist (created via Setup or sf_create_agent).`,
|
|
271
|
+
inputSchema: CreateBotRoutingSchema,
|
|
272
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
273
|
+
}, async (params) => {
|
|
274
|
+
const auth = await getAuth();
|
|
275
|
+
const result = await createBotRouting(auth, params);
|
|
276
|
+
return resultContent(result);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
//# sourceMappingURL=omnichannel.js.map
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CreateFlexCardSchema, UpdateFlexCardSchema, ActivateFlexCardSchema, GetFlexCardSchema,
|
|
3
|
+
CreateOmniScriptSchema, UpdateOmniScriptSchema, ActivateOmniScriptSchema, GetOmniScriptSchema,
|
|
4
|
+
CreateDataRaptorSchema, GetDataRaptorSchema,
|
|
5
|
+
CreateIntegrationProcedureSchema, UpdateIntegrationProcedureSchema,
|
|
6
|
+
GetIntegrationProcedureSchema, ActivateIntegrationProcedureSchema,
|
|
7
|
+
CreateCalculationMatrixSchema, CreateCalculationProcedureSchema,
|
|
8
|
+
} from "../schemas/index.js";
|
|
9
|
+
import {
|
|
10
|
+
getAuth,
|
|
11
|
+
createFlexCard, updateFlexCard, activateFlexCard, getFlexCard,
|
|
12
|
+
createOmniScript, updateOmniScript, activateOmniScript, getOmniScript,
|
|
13
|
+
createDataRaptor, getDataRaptor,
|
|
14
|
+
createIntegrationProcedure, updateIntegrationProcedure, activateIntegrationProcedure, getIntegrationProcedure,
|
|
15
|
+
createCalculationMatrix, createCalculationProcedure,
|
|
16
|
+
} from "../services/salesforce.js";
|
|
17
|
+
import { resultContent } from "./utils.js";
|
|
18
|
+
|
|
19
|
+
export function registerOmniStudioTools(server) {
|
|
20
|
+
// ─── FLEXCARDS ────────────────────────────────────────────────────────────
|
|
21
|
+
server.registerTool("sf_create_flexcard", {
|
|
22
|
+
title: "Create OmniStudio FlexCard",
|
|
23
|
+
description: `Creates an OmniStudio FlexCard (OmniUiCard metadata type). FlexCards display contextual data on Lightning pages and Experience Cloud sites.
|
|
24
|
+
|
|
25
|
+
A FlexCard defines:
|
|
26
|
+
- A data source (SOQL query, DataRaptor, Integration Procedure, Apex, or None)
|
|
27
|
+
- Fields to display from the data source
|
|
28
|
+
- Actions the user can take (navigate, launch OmniScript, open URL, start Flow)
|
|
29
|
+
- States (card variations based on data conditions)
|
|
30
|
+
|
|
31
|
+
The card is created in inactive state. Use sf_activate_flexcard to activate it after creation.
|
|
32
|
+
|
|
33
|
+
dataSourceType options:
|
|
34
|
+
- SOQL: provide a dataSourceName with a SOQL query string
|
|
35
|
+
- DataRaptor: provide the DataRaptor interface name
|
|
36
|
+
- IntegrationProcedure: provide the Integration Procedure key (Type_SubType)
|
|
37
|
+
- Apex: provide the Apex class name
|
|
38
|
+
- None: no data source (static card)`,
|
|
39
|
+
inputSchema: CreateFlexCardSchema,
|
|
40
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
41
|
+
}, async (params) => {
|
|
42
|
+
const auth = await getAuth();
|
|
43
|
+
const result = await createFlexCard(auth, params);
|
|
44
|
+
return resultContent(result);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
server.registerTool("sf_update_flexcard", {
|
|
48
|
+
title: "Update OmniStudio FlexCard",
|
|
49
|
+
description: `Updates an existing OmniStudio FlexCard (OmniUiCard). Reads the current definition, merges the provided changes, and redeploys.
|
|
50
|
+
|
|
51
|
+
Provide only the fields you want to change. The card will be deactivated automatically if active — use sf_activate_flexcard to reactivate after the update.
|
|
52
|
+
|
|
53
|
+
All fields arrays (fields, actions, states) are replaced entirely if provided.`,
|
|
54
|
+
inputSchema: UpdateFlexCardSchema,
|
|
55
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
56
|
+
}, async (params) => {
|
|
57
|
+
const auth = await getAuth();
|
|
58
|
+
const result = await updateFlexCard(auth, params);
|
|
59
|
+
return resultContent(result);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
server.registerTool("sf_activate_flexcard", {
|
|
63
|
+
title: "Activate OmniStudio FlexCard",
|
|
64
|
+
description: `Activates an OmniStudio FlexCard so it is visible on Lightning pages and Experience Cloud sites.
|
|
65
|
+
|
|
66
|
+
Reads the existing FlexCard definition and redeploys it with isActive=true. The card must already exist (created with sf_create_flexcard).`,
|
|
67
|
+
inputSchema: ActivateFlexCardSchema,
|
|
68
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
69
|
+
}, async (params) => {
|
|
70
|
+
const auth = await getAuth();
|
|
71
|
+
const result = await activateFlexCard(auth, params);
|
|
72
|
+
return resultContent(result);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
server.registerTool("sf_get_flexcard", {
|
|
76
|
+
title: "Get OmniStudio FlexCard",
|
|
77
|
+
description: `Retrieves the configuration of an OmniStudio FlexCard including its data source, fields, actions, states, and activation status.`,
|
|
78
|
+
inputSchema: GetFlexCardSchema,
|
|
79
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
80
|
+
}, async (params) => {
|
|
81
|
+
const auth = await getAuth();
|
|
82
|
+
const result = await getFlexCard(auth, params);
|
|
83
|
+
return resultContent(result);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// ─── OMNISCRIPTS ──────────────────────────────────────────────────────────
|
|
87
|
+
server.registerTool("sf_create_omniscript", {
|
|
88
|
+
title: "Create OmniStudio OmniScript",
|
|
89
|
+
description: `Creates an OmniStudio OmniScript — a guided interaction flow for collecting data or performing processes.
|
|
90
|
+
|
|
91
|
+
OmniScripts are identified by Type + SubType + Language (e.g. AccountOpening / Personal / English). The fullName becomes Type_SubType_Language.
|
|
92
|
+
|
|
93
|
+
The script is created inactive with the specified elements. Complex element configuration (branching logic, custom LWC overrides, remote actions) should be finalized in the OmniScript Designer after creation.
|
|
94
|
+
|
|
95
|
+
isLwcEnabled: true deploys the script as a Lightning Web Component (recommended for performance).
|
|
96
|
+
isOmniScriptEmbeddable: true allows embedding this script inside other OmniScripts.
|
|
97
|
+
|
|
98
|
+
Use sf_activate_omniscript to activate after creation.`,
|
|
99
|
+
inputSchema: CreateOmniScriptSchema,
|
|
100
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
101
|
+
}, async (params) => {
|
|
102
|
+
const auth = await getAuth();
|
|
103
|
+
const result = await createOmniScript(auth, params);
|
|
104
|
+
return resultContent(result);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
server.registerTool("sf_update_omniscript", {
|
|
108
|
+
title: "Update OmniStudio OmniScript",
|
|
109
|
+
description: `Updates an existing OmniScript's metadata properties (description, LWC mode, embeddable flag). Identified by Type + SubType + Language.
|
|
110
|
+
|
|
111
|
+
Note: OmniScript element/step editing is best done in the OmniScript Designer. This tool updates the container metadata only. The script will be deactivated if currently active — reactivate with sf_activate_omniscript.`,
|
|
112
|
+
inputSchema: UpdateOmniScriptSchema,
|
|
113
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
114
|
+
}, async (params) => {
|
|
115
|
+
const auth = await getAuth();
|
|
116
|
+
const result = await updateOmniScript(auth, params);
|
|
117
|
+
return resultContent(result);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
server.registerTool("sf_activate_omniscript", {
|
|
121
|
+
title: "Activate OmniStudio OmniScript",
|
|
122
|
+
description: `Activates an OmniScript so it can be launched from FlexCards, Experience Cloud, or standalone pages. Identified by Type + SubType + Language.`,
|
|
123
|
+
inputSchema: ActivateOmniScriptSchema,
|
|
124
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
125
|
+
}, async (params) => {
|
|
126
|
+
const auth = await getAuth();
|
|
127
|
+
const result = await activateOmniScript(auth, params);
|
|
128
|
+
return resultContent(result);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
server.registerTool("sf_get_omniscript", {
|
|
132
|
+
title: "Get OmniStudio OmniScript",
|
|
133
|
+
description: `Retrieves the configuration of an OmniScript including its elements, activation status, and LWC settings. Identified by Type + SubType + Language.`,
|
|
134
|
+
inputSchema: GetOmniScriptSchema,
|
|
135
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
136
|
+
}, async (params) => {
|
|
137
|
+
const auth = await getAuth();
|
|
138
|
+
const result = await getOmniScript(auth, params);
|
|
139
|
+
return resultContent(result);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// ─── DATARAPTORS ─────────────────────────────────────────────────────────
|
|
143
|
+
server.registerTool("sf_create_dataraptor", {
|
|
144
|
+
title: "Create OmniStudio DataRaptor",
|
|
145
|
+
description: `Creates a DataRaptor interface for OmniStudio data transformation. DataRaptors handle Extract (read from Salesforce), Transform (convert data formats), and Load (write to Salesforce) operations.
|
|
146
|
+
|
|
147
|
+
interfaceType:
|
|
148
|
+
- Extract: reads data from Salesforce objects using SOQL-like field mappings
|
|
149
|
+
- Transform: converts/maps data between formats (JSON path transformations)
|
|
150
|
+
- Load: writes data to Salesforce objects
|
|
151
|
+
|
|
152
|
+
Each field mapping defines:
|
|
153
|
+
- sourceField: source JSON path or Salesforce field API name
|
|
154
|
+
- targetField: target JSON path or Salesforce field API name
|
|
155
|
+
- dataType: data type (Text, Number, Boolean, Date, etc.)
|
|
156
|
+
- formula: optional transformation formula
|
|
157
|
+
|
|
158
|
+
filterCriteria: SOQL WHERE clause for Extract DataRaptors (e.g. "Id = ':AccountId'")`,
|
|
159
|
+
inputSchema: CreateDataRaptorSchema,
|
|
160
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
161
|
+
}, async (params) => {
|
|
162
|
+
const auth = await getAuth();
|
|
163
|
+
const result = await createDataRaptor(auth, params);
|
|
164
|
+
return resultContent(result);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
server.registerTool("sf_get_dataraptor", {
|
|
168
|
+
title: "Get OmniStudio DataRaptor",
|
|
169
|
+
description: `Retrieves the configuration of a DataRaptor interface including its type, field mappings, and filter criteria.`,
|
|
170
|
+
inputSchema: GetDataRaptorSchema,
|
|
171
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
172
|
+
}, async (params) => {
|
|
173
|
+
const auth = await getAuth();
|
|
174
|
+
const result = await getDataRaptor(auth, params);
|
|
175
|
+
return resultContent(result);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// ─── INTEGRATION PROCEDURES ───────────────────────────────────────────────
|
|
179
|
+
server.registerTool("sf_create_integration_procedure", {
|
|
180
|
+
title: "Create OmniStudio Integration Procedure",
|
|
181
|
+
description: `Creates an OmniStudio Integration Procedure — a server-side process that orchestrates data integration without UI. Integration Procedures run in Apex context and can be invoked from OmniScripts, FlexCards, or APIs.
|
|
182
|
+
|
|
183
|
+
Integration Procedures use the OmniScript metadata type with omniProcessType=IntegrationProcedure. The fullName is ProcedureName_SubType.
|
|
184
|
+
|
|
185
|
+
Element types:
|
|
186
|
+
- DataRaptor: call a DataRaptor for Salesforce CRUD
|
|
187
|
+
- HTTPAction: call an external REST/SOAP API
|
|
188
|
+
- Response: return data to the caller
|
|
189
|
+
- Loop: iterate over a collection
|
|
190
|
+
- Conditional: branch based on conditions
|
|
191
|
+
- SetValues: set variables
|
|
192
|
+
- ExceptionBlock: handle errors
|
|
193
|
+
- Matrix: call a Calculation Matrix
|
|
194
|
+
- OmniScript: call a nested OmniScript
|
|
195
|
+
- Aggregate: combine multiple data sources
|
|
196
|
+
|
|
197
|
+
Set isActive: true to activate immediately after creation.`,
|
|
198
|
+
inputSchema: CreateIntegrationProcedureSchema,
|
|
199
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
200
|
+
}, async (params) => {
|
|
201
|
+
const auth = await getAuth();
|
|
202
|
+
const result = await createIntegrationProcedure(auth, params);
|
|
203
|
+
return resultContent(result);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
server.registerTool("sf_update_integration_procedure", {
|
|
207
|
+
title: "Update OmniStudio Integration Procedure",
|
|
208
|
+
description: `Updates an existing Integration Procedure's metadata (description, active status). Identified by procedureName + subType (fullName = procedureName_subType).
|
|
209
|
+
|
|
210
|
+
For element/step changes, use the OmniStudio Integration Procedure Designer. Set isActive: false to deactivate, then make changes, then sf_activate_integration_procedure.`,
|
|
211
|
+
inputSchema: UpdateIntegrationProcedureSchema,
|
|
212
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
213
|
+
}, async (params) => {
|
|
214
|
+
const auth = await getAuth();
|
|
215
|
+
const result = await updateIntegrationProcedure(auth, params);
|
|
216
|
+
return resultContent(result);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
server.registerTool("sf_get_integration_procedure", {
|
|
220
|
+
title: "Get OmniStudio Integration Procedure",
|
|
221
|
+
description: `Retrieves the configuration of an Integration Procedure including its elements and activation status. Identified by procedureName + subType.`,
|
|
222
|
+
inputSchema: GetIntegrationProcedureSchema,
|
|
223
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
224
|
+
}, async (params) => {
|
|
225
|
+
const auth = await getAuth();
|
|
226
|
+
const result = await getIntegrationProcedure(auth, params);
|
|
227
|
+
return resultContent(result);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
server.registerTool("sf_activate_integration_procedure", {
|
|
231
|
+
title: "Activate OmniStudio Integration Procedure",
|
|
232
|
+
description: `Activates an Integration Procedure so it can be invoked from OmniScripts, FlexCards, and APIs. Identified by procedureName + subType.`,
|
|
233
|
+
inputSchema: ActivateIntegrationProcedureSchema,
|
|
234
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
235
|
+
}, async (params) => {
|
|
236
|
+
const auth = await getAuth();
|
|
237
|
+
const result = await activateIntegrationProcedure(auth, params);
|
|
238
|
+
return resultContent(result);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// ─── CALCULATION MATRIX & PROCEDURE ──────────────────────────────────────
|
|
242
|
+
server.registerTool("sf_create_calculation_matrix", {
|
|
243
|
+
title: "Create OmniStudio Calculation Matrix",
|
|
244
|
+
description: `Creates a Calculation Matrix for rule-based lookups and calculations. Matrices map input combinations to output values — useful for pricing, eligibility, scoring, and decision tables.
|
|
245
|
+
|
|
246
|
+
inputVariables: list of input variable names (columns used for lookups)
|
|
247
|
+
outputVariables: list of output variable names (columns returned)
|
|
248
|
+
rows: array of { inputs: {var: value}, outputs: {var: value} } defining the lookup table
|
|
249
|
+
|
|
250
|
+
Example: a pricing matrix with inputs [ProductType, Region] and outputs [Price, Discount].`,
|
|
251
|
+
inputSchema: CreateCalculationMatrixSchema,
|
|
252
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
253
|
+
}, async (params) => {
|
|
254
|
+
const auth = await getAuth();
|
|
255
|
+
const result = await createCalculationMatrix(auth, params);
|
|
256
|
+
return resultContent(result);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
server.registerTool("sf_create_calculation_procedure", {
|
|
260
|
+
title: "Create OmniStudio Calculation Procedure",
|
|
261
|
+
description: `Creates a Calculation Procedure that orchestrates multi-step calculations using Calculation Matrices, formulas, and logic steps.
|
|
262
|
+
|
|
263
|
+
steps array — each step has:
|
|
264
|
+
- name: step identifier
|
|
265
|
+
- type: MatrixLookup (call a matrix), Formula (expression), Condition (branch), Assignment (set variable)
|
|
266
|
+
- matrixName: required for MatrixLookup steps
|
|
267
|
+
- expression: required for Formula/Condition steps
|
|
268
|
+
- inputMap: maps procedure variables to step inputs
|
|
269
|
+
- outputMap: maps step outputs back to procedure variables
|
|
270
|
+
|
|
271
|
+
Use Calculation Procedures to build complex pricing engines, eligibility calculators, or multi-factor scoring systems.`,
|
|
272
|
+
inputSchema: CreateCalculationProcedureSchema,
|
|
273
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
274
|
+
}, async (params) => {
|
|
275
|
+
const auth = await getAuth();
|
|
276
|
+
const result = await createCalculationProcedure(auth, params);
|
|
277
|
+
return resultContent(result);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=omnistudio.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "salesforce-metadata-mcp",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "The most comprehensive Salesforce MCP server:
|
|
3
|
+
"version": "2.3.0",
|
|
4
|
+
"description": "The most comprehensive Salesforce MCP server: 140+ tools for metadata, Apex, LWC, Agentforce, OmniStudio, OmniChannel, Experience Cloud, Field Service, Messaging, bulk data, users, reports, security, and more",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"type": "module",
|
|
@@ -58,7 +58,19 @@
|
|
|
58
58
|
"bulk-api",
|
|
59
59
|
"visualforce",
|
|
60
60
|
"aura",
|
|
61
|
-
"formula-fields"
|
|
61
|
+
"formula-fields",
|
|
62
|
+
"omnistudio",
|
|
63
|
+
"omniscript",
|
|
64
|
+
"flexcard",
|
|
65
|
+
"dataraptor",
|
|
66
|
+
"integration-procedure",
|
|
67
|
+
"omnichannel",
|
|
68
|
+
"service-cloud",
|
|
69
|
+
"field-service",
|
|
70
|
+
"messaging",
|
|
71
|
+
"live-chat",
|
|
72
|
+
"skill-routing",
|
|
73
|
+
"presence"
|
|
62
74
|
],
|
|
63
75
|
"dependencies": {
|
|
64
76
|
"@modelcontextprotocol/sdk": "1.29.0",
|