salesforce-metadata-mcp 2.2.0 → 2.4.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.
@@ -0,0 +1,96 @@
1
+ import {
2
+ GetSetupAuditTrailSchema, GetLoginHistorySchema, GetEventLogsSchema, GetFieldHistorySchema,
3
+ } from "../schemas/index.js";
4
+ import { getAuth, getSetupAuditTrail, getLoginHistory, getEventLogs, getFieldHistory } from "../services/salesforce.js";
5
+ import { resultContent } from "./utils.js";
6
+
7
+ export function registerAuditTools(server) {
8
+ server.registerTool("sf_get_setup_audit_trail", {
9
+ title: "Get Setup Audit Trail",
10
+ description: `Queries the SetupAuditTrail object to see who made what configuration changes to the org, and when. Covers the last 6 months of setup activity.
11
+
12
+ Returns records with: date, username, section, action, display (human-readable description)
13
+
14
+ section filter examples: 'Custom Fields', 'Profiles', 'Flows', 'Apex Classes', 'Permission Sets', 'Connected Apps', 'Users'
15
+
16
+ Useful for:
17
+ - Security audits (who changed profiles or permissions)
18
+ - Debugging unexpected configuration changes
19
+ - Compliance reporting on org configuration changes`,
20
+ inputSchema: GetSetupAuditTrailSchema,
21
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
22
+ }, async (params) => {
23
+ const auth = await getAuth();
24
+ const result = await getSetupAuditTrail(auth, params);
25
+ return resultContent(result);
26
+ });
27
+
28
+ server.registerTool("sf_get_login_history", {
29
+ title: "Get Login History",
30
+ description: `Queries LoginHistory to see user login activity — who logged in, from where, and whether they succeeded.
31
+
32
+ Returns records with: loginTime, username, sourceIp, browser, platform, status, loginType
33
+
34
+ status values: 'Success', 'Failed', 'No Password', 'Blocked', 'No Cookie'
35
+ loginType values: 'Application', 'API', 'SAML', 'OAuth', 'LightningLogin', 'Chatter'
36
+
37
+ Useful for:
38
+ - Security monitoring (failed logins, unusual IP addresses)
39
+ - Compliance auditing (who accessed the org and when)
40
+ - Investigating suspicious account activity
41
+
42
+ Note: LoginHistory covers the past 6 months.`,
43
+ inputSchema: GetLoginHistorySchema,
44
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
45
+ }, async (params) => {
46
+ const auth = await getAuth();
47
+ const result = await getLoginHistory(auth, params);
48
+ return resultContent(result);
49
+ });
50
+
51
+ server.registerTool("sf_get_event_logs", {
52
+ title: "Get Event Log Files",
53
+ description: `Queries EventLogFile for detailed activity logs. Event logs capture granular org activity for security monitoring and performance analysis.
54
+
55
+ Common eventType values:
56
+ - Login — login attempts and results
57
+ - API — SOAP/REST API calls
58
+ - Report — report executions
59
+ - Flow — Flow runs and executions
60
+ - ApexExecution — Apex code executions
61
+ - LightningPageView — Lightning page views
62
+ - RestApi — REST API requests
63
+ - VisualforceRequest — Visualforce page requests
64
+ - URI — general HTTP requests
65
+ - LightningError — Lightning component errors
66
+
67
+ Returns parsed CSV log entries (up to 20 rows per log file, up to 3 files per call).
68
+
69
+ Requires Event Monitoring add-on OR Agentforce debug logs to be enabled.`,
70
+ inputSchema: GetEventLogsSchema,
71
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
72
+ }, async (params) => {
73
+ const auth = await getAuth();
74
+ const result = await getEventLogs(auth, params);
75
+ return resultContent(result);
76
+ });
77
+
78
+ server.registerTool("sf_get_field_history", {
79
+ title: "Get Field History for a Record",
80
+ description: `Queries the {Object}History object to retrieve a field-level change history for a specific record. Shows what changed, when, the old and new values, and who made the change.
81
+
82
+ Returns records with: date, field, oldValue, newValue, changedBy
83
+
84
+ objectApiName: the SObject with history tracking enabled, e.g. 'Account', 'Opportunity', 'Case'
85
+ recordId: the specific record to retrieve history for
86
+
87
+ Note: Field history tracking must be enabled for the object and for each field you want to track (Setup → Object Manager → {Object} → Fields & Relationships → Field History Tracking). History is retained for up to 18 months.`,
88
+ inputSchema: GetFieldHistorySchema,
89
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
90
+ }, async (params) => {
91
+ const auth = await getAuth();
92
+ const result = await getFieldHistory(auth, params);
93
+ return resultContent(result);
94
+ });
95
+ }
96
+ //# sourceMappingURL=audit.js.map
@@ -1,5 +1,5 @@
1
- import { CreateUserSchema, UpdateUserSchema, AssignQueueMemberSchema, CreatePublicGroupSchema, QueryRecordsSchema, CreateRecordSchema, UpdateRecordSchema, BulkImportRecordsSchema, } from "../schemas/index.js";
2
- import { getAuth, createUser, updateUser, assignQueueMember, createPublicGroup, queryRecords, createRecord, updateRecord, bulkImportRecords, } from "../services/salesforce.js";
1
+ import { CreateUserSchema, UpdateUserSchema, AssignQueueMemberSchema, CreatePublicGroupSchema, QueryRecordsSchema, CreateRecordSchema, UpdateRecordSchema, BulkImportRecordsSchema, DeleteRecordSchema, SendEmailSchema, } from "../schemas/index.js";
2
+ import { getAuth, createUser, updateUser, assignQueueMember, createPublicGroup, queryRecords, createRecord, updateRecord, bulkImportRecords, deleteRecord, sendEmail, } from "../services/salesforce.js";
3
3
  import { resultContent } from "./utils.js";
4
4
  export function registerDataTools(server) {
5
5
  server.registerTool("sf_create_user", {
@@ -82,5 +82,36 @@ export function registerDataTools(server) {
82
82
  const result = await bulkImportRecords(auth, params);
83
83
  return resultContent(result);
84
84
  });
85
+ server.registerTool("sf_delete_record", {
86
+ title: "Delete SObject Record",
87
+ description: `Deletes a single SObject record by record ID via the Salesforce REST API. The deletion is permanent and cannot be undone (the record goes to the Recycle Bin for objects that support it, from where it can be undeleted within 15 days).
88
+
89
+ Provide the object API name and the 15 or 18 character record ID. For bulk deletions (100+ records), use sf_bulk_import_records with operation='delete'.`,
90
+ inputSchema: DeleteRecordSchema,
91
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },
92
+ }, async (params) => {
93
+ const auth = await getAuth();
94
+ const result = await deleteRecord(auth, params);
95
+ return resultContent(result);
96
+ });
97
+ server.registerTool("sf_send_email", {
98
+ title: "Send Email via Salesforce",
99
+ description: `Sends an email from Salesforce using the emailSimple invocable action. The email is sent from the running user's email address through Salesforce's email infrastructure (respects org email deliverability settings).
100
+
101
+ toAddresses: one or more recipient email addresses
102
+ body / htmlBody: email body content (htmlBody takes precedence)
103
+ templateName: use an existing email template instead of providing body text
104
+ whatId: related record ID (e.g. Opportunity, Case) — links the email as an activity
105
+ whoId: Contact or Lead ID — links the email to the person record
106
+ saveAsActivity: saves the email as an EmailMessage activity (default: true)
107
+
108
+ Note: Salesforce email limits apply (daily email limits based on org edition). Mass emails should use list email features instead.`,
109
+ inputSchema: SendEmailSchema,
110
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
111
+ }, async (params) => {
112
+ const auth = await getAuth();
113
+ const result = await sendEmail(auth, params);
114
+ return resultContent(result);
115
+ });
85
116
  }
86
117
  //# sourceMappingURL=data.js.map
@@ -1,5 +1,5 @@
1
- import { CreateOutboundChangeSetSchema, AddToChangeSetSchema, DeployMetadataSchema, CheckDeployStatusSchema, RetrieveMetadataSchema, ValidateDeploymentSchema, ListMetadataSchema, } from "../schemas/index.js";
2
- import { getAuth, listMetadataForTool } from "../services/salesforce.js";
1
+ import { CreateOutboundChangeSetSchema, AddToChangeSetSchema, DeployMetadataSchema, CheckDeployStatusSchema, RetrieveMetadataSchema, ValidateDeploymentSchema, ListMetadataSchema, CompareOrgsSchema, } from "../schemas/index.js";
2
+ import { getAuth, listMetadataForTool, compareOrgs } from "../services/salesforce.js";
3
3
  import { buildGenericDeployZip, deployZip, pollDeployStatus, checkDeployStatus, retrieveMetadata, } from "../services/deployment.js";
4
4
  import { createOutboundChangeSet, addComponentsToChangeSet, } from "../services/tooling.js";
5
5
  import { resultContent } from "./utils.js";
@@ -121,5 +121,25 @@ export function registerDeploymentTools(server) {
121
121
  const result = await listMetadataForTool(auth, params.metadataType);
122
122
  return resultContent(result);
123
123
  });
124
+ server.registerTool("sf_compare_orgs", {
125
+ title: "Compare Metadata Between Two Orgs",
126
+ description: `Compares metadata components of specified types between two Salesforce orgs using their SF CLI aliases. Returns components that exist only in the source, only in the target, or differ between both.
127
+
128
+ Requires the Salesforce CLI to be installed and both org aliases to be authenticated (run: sf org list to see available aliases).
129
+
130
+ sourceAlias / targetAlias: SF CLI org aliases (letters, numbers, hyphens, underscores only)
131
+ metadataTypes: list of metadata types to compare — defaults to common types (ApexClass, Flow, CustomObject, PermissionSet, LightningComponentBundle)
132
+
133
+ Returns:
134
+ - onlyInSource: components in source that don't exist in target
135
+ - onlyInTarget: components in target that don't exist in source
136
+ - differentInBoth: components that exist in both but have different lastModifiedDate
137
+ - summary: counts for each category`,
138
+ inputSchema: CompareOrgsSchema,
139
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
140
+ }, async (params) => {
141
+ const result = await compareOrgs(params);
142
+ return resultContent(result);
143
+ });
124
144
  }
125
145
  //# sourceMappingURL=deployment.js.map
@@ -0,0 +1,79 @@
1
+ import {
2
+ CreateEinsteinPredictionSchema, CreateNextBestActionSchema, CreateEinsteinBotSchema,
3
+ } from "../schemas/index.js";
4
+ import { getAuth, createEinsteinPrediction, createNextBestAction, createEinsteinBot } from "../services/salesforce.js";
5
+ import { resultContent } from "./utils.js";
6
+
7
+ export function registerEinsteinTools(server) {
8
+ server.registerTool("sf_create_einstein_prediction", {
9
+ title: "Create Einstein Prediction (ML Prediction Definition)",
10
+ description: `Creates an Einstein Prediction Builder prediction definition (MLPredictionDefinition metadata type). Predictions analyze historical Salesforce data to score or classify records automatically.
11
+
12
+ predictionType:
13
+ - BinaryClassification: predict a yes/no outcome (e.g. Will this opportunity close? Is this lead likely to convert?)
14
+ - Regression: predict a numeric value (e.g. Expected revenue, likelihood score)
15
+
16
+ targetField: the field the prediction is based on (e.g. 'IsWon' for BinaryClassification on Opportunity)
17
+ pushbackField: an existing custom field to write the prediction score to automatically
18
+
19
+ IMPORTANT: Einstein Prediction Builder requires an Einstein Analytics license or the Einstein Platform add-on. If the org lacks this license, the metadata deployment will succeed but the prediction cannot be trained or activated. This tool creates the definition — training happens in Setup → Einstein → Prediction Builder.
20
+
21
+ The prediction is created in Draft status. Activate it from Setup after training is complete.`,
22
+ inputSchema: CreateEinsteinPredictionSchema,
23
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
24
+ }, async (params) => {
25
+ const auth = await getAuth();
26
+ const result = await createEinsteinPrediction(auth, params);
27
+ return resultContent(result);
28
+ });
29
+
30
+ server.registerTool("sf_create_next_best_action", {
31
+ title: "Create Next Best Action Strategy",
32
+ description: `Creates a Next Best Action (NBA) recommendation strategy (RecommendationStrategy metadata type). NBA strategies surface contextual recommendations to agents and customers on record pages, communities, and chatbots.
33
+
34
+ A strategy defines:
35
+ - contextObjectApiName: the record type that provides context (e.g. 'Account', 'Case', 'Opportunity')
36
+ - recommendations: a list of actions the agent can offer, each with Accept/Decline buttons and an optional Flow to execute on acceptance
37
+
38
+ NBA strategies can be displayed via:
39
+ - Einstein Next Best Action component on a Lightning Record Page
40
+ - OmniScripts and FlexCards
41
+ - Service Console
42
+
43
+ After creating, add the "Einstein Next Best Action" Lightning component to a record page and configure it to use this strategy.`,
44
+ inputSchema: CreateNextBestActionSchema,
45
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
46
+ }, async (params) => {
47
+ const auth = await getAuth();
48
+ const result = await createNextBestAction(auth, params);
49
+ return resultContent(result);
50
+ });
51
+
52
+ server.registerTool("sf_create_einstein_bot", {
53
+ title: "Create Einstein Bot (Classic)",
54
+ description: `Creates a classic Einstein Bot (Bot + BotVersion metadata types) with one or more conversation dialogs. Classic Einstein Bots handle chat and messaging channels via rule-based and ML-powered conversation flows.
55
+
56
+ Note: For AI-first agents using large language models, use sf_create_agent (Agentforce/Einstein Service Agent) instead. Classic Einstein Bots are best suited for:
57
+ - Structured FAQ automation
58
+ - Simple data collection workflows
59
+ - Channels that don't support Agentforce (SMS, WhatsApp via classic routing)
60
+
61
+ Each dialog defines:
62
+ - name/label: the dialog identifier
63
+ - utterances: training phrases that trigger this dialog
64
+ - messages: bot responses shown to the user
65
+ - type: Main (user-facing), System (internal), Rule (condition-based)
66
+
67
+ The bot is created with an ML domain for intent classification. After creation:
68
+ 1. Train the bot in Setup → Einstein Bots → {BotName} → Train
69
+ 2. Activate the bot
70
+ 3. Connect it to a messaging channel or chat button`,
71
+ inputSchema: CreateEinsteinBotSchema,
72
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
73
+ }, async (params) => {
74
+ const auth = await getAuth();
75
+ const result = await createEinsteinBot(auth, params);
76
+ return resultContent(result);
77
+ });
78
+ }
79
+ //# sourceMappingURL=einstein.js.map
@@ -12,6 +12,10 @@ 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";
17
+ import { registerAuditTools } from "./audit.js";
18
+ import { registerEinsteinTools } from "./einstein.js";
15
19
  export function registerTools(server) {
16
20
  registerMetadataTools(server);
17
21
  registerObjectTools(server);
@@ -27,5 +31,9 @@ export function registerTools(server) {
27
31
  registerIntegrationTools(server);
28
32
  registerReportTools(server);
29
33
  registerDataTools(server);
34
+ registerOmniStudioTools(server);
35
+ registerOmniChannelTools(server);
36
+ registerAuditTools(server);
37
+ registerEinsteinTools(server);
30
38
  }
31
39
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import { CreateConnectedAppSchema, CreateExternalDataSourceSchema, CreateExternalObjectSchema, CreateRemoteSiteSettingSchema, CreateCspSettingSchema, CreateOutboundMessageSchema, CreateAuthProviderSchema, } from "../schemas/index.js";
2
- import { getAuth, createConnectedApp, createExternalDataSource, createExternalObject, createRemoteSiteSetting, createCspSetting, createOutboundMessage, createAuthProvider, } from "../services/salesforce.js";
1
+ import { CreateConnectedAppSchema, CreateExternalDataSourceSchema, CreateExternalObjectSchema, CreateRemoteSiteSettingSchema, CreateCspSettingSchema, CreateOutboundMessageSchema, CreateAuthProviderSchema, CreateCertificateSchema, CreateEventRelaySchema, } from "../schemas/index.js";
2
+ import { getAuth, createConnectedApp, createExternalDataSource, createExternalObject, createRemoteSiteSetting, createCspSetting, createOutboundMessage, createAuthProvider, createCertificate, createEventRelay, } from "../services/salesforce.js";
3
3
  import { resultContent } from "./utils.js";
4
4
  export function registerIntegrationTools(server) {
5
5
  server.registerTool("sf_create_connected_app", {
@@ -112,5 +112,42 @@ export function registerIntegrationTools(server) {
112
112
  const result = await createAuthProvider(auth, params);
113
113
  return resultContent(result);
114
114
  });
115
+ server.registerTool("sf_create_certificate", {
116
+ title: "Create Self-Signed Certificate",
117
+ description: `Creates a self-signed certificate in Salesforce (Certificate metadata type). Certificates are used for:
118
+ - Signing outbound callouts (mutual TLS / client certificate authentication)
119
+ - Signing SAML assertions for SSO
120
+ - Encrypting/decrypting data in Named Credentials
121
+
122
+ keySize: 2048 (standard) or 4096 (high security)
123
+ expirationDate: optional ISO date for the certificate expiry (e.g. '2030-01-01')
124
+ privateKeyExportable: set true only if you need to export the private key (not recommended for production)
125
+
126
+ After creation, the certificate can be referenced in Named Credentials and Connected Apps.`,
127
+ inputSchema: CreateCertificateSchema,
128
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
129
+ }, async (params) => {
130
+ const auth = await getAuth();
131
+ const result = await createCertificate(auth, params);
132
+ return resultContent(result);
133
+ });
134
+ server.registerTool("sf_create_event_relay", {
135
+ title: "Create Event Relay Configuration",
136
+ description: `Creates an EventRelayConfig that relays Salesforce Platform Events or Change Data Capture events to an external event bus (Amazon EventBridge or another Salesforce event bus).
137
+
138
+ eventChannel: the Platform Event or CDC channel to relay, e.g. 'MyEvent__e', 'AccountChangeEvent', or 'data/ChangeEvents' for all CDC
139
+ destinationType: AmazonEventBridge or EventBus
140
+ destinationResourceName: ARN for Amazon EventBridge (e.g. 'arn:aws:events:us-east-1:123456789:event-bus/my-bus') or target event bus name
141
+
142
+ state: RUN (immediately start relaying), STOP (create but don't relay), PAUSE (temporarily paused)
143
+
144
+ Requires Event Relay entitlement in the org. For Amazon EventBridge, the AWS partner event source must be set up first.`,
145
+ inputSchema: CreateEventRelaySchema,
146
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
147
+ }, async (params) => {
148
+ const auth = await getAuth();
149
+ const result = await createEventRelay(auth, params);
150
+ return resultContent(result);
151
+ });
115
152
  }
116
153
  //# sourceMappingURL=integrations.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