salesforce-metadata-mcp 2.0.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.
Files changed (91) hide show
  1. package/AGENTFORCE.md +125 -0
  2. package/APEX_LWC.md +214 -0
  3. package/CHANGELOG.md +120 -0
  4. package/README.md +207 -0
  5. package/SETUP.md +208 -0
  6. package/TOOLS.md +193 -0
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +53 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/schemas/index.d.ts +3406 -0
  12. package/dist/schemas/index.d.ts.map +1 -0
  13. package/dist/schemas/index.js +992 -0
  14. package/dist/schemas/index.js.map +1 -0
  15. package/dist/services/deployment.d.ts +36 -0
  16. package/dist/services/deployment.d.ts.map +1 -0
  17. package/dist/services/deployment.js +215 -0
  18. package/dist/services/deployment.js.map +1 -0
  19. package/dist/services/mcpgen.d.ts +16 -0
  20. package/dist/services/mcpgen.d.ts.map +1 -0
  21. package/dist/services/mcpgen.js +229 -0
  22. package/dist/services/mcpgen.js.map +1 -0
  23. package/dist/services/salesforce.d.ts +598 -0
  24. package/dist/services/salesforce.d.ts.map +1 -0
  25. package/dist/services/salesforce.js +1317 -0
  26. package/dist/services/salesforce.js.map +1 -0
  27. package/dist/services/tooling.d.ts +23 -0
  28. package/dist/services/tooling.d.ts.map +1 -0
  29. package/dist/services/tooling.js +173 -0
  30. package/dist/services/tooling.js.map +1 -0
  31. package/dist/tools/agentforce.d.ts +3 -0
  32. package/dist/tools/agentforce.d.ts.map +1 -0
  33. package/dist/tools/agentforce.js +73 -0
  34. package/dist/tools/agentforce.js.map +1 -0
  35. package/dist/tools/apex.d.ts +3 -0
  36. package/dist/tools/apex.d.ts.map +1 -0
  37. package/dist/tools/apex.js +95 -0
  38. package/dist/tools/apex.js.map +1 -0
  39. package/dist/tools/automation.d.ts +3 -0
  40. package/dist/tools/automation.d.ts.map +1 -0
  41. package/dist/tools/automation.js +186 -0
  42. package/dist/tools/automation.js.map +1 -0
  43. package/dist/tools/deployment.d.ts +3 -0
  44. package/dist/tools/deployment.d.ts.map +1 -0
  45. package/dist/tools/deployment.js +89 -0
  46. package/dist/tools/deployment.js.map +1 -0
  47. package/dist/tools/experience.d.ts +3 -0
  48. package/dist/tools/experience.d.ts.map +1 -0
  49. package/dist/tools/experience.js +53 -0
  50. package/dist/tools/experience.js.map +1 -0
  51. package/dist/tools/index.d.ts +3 -0
  52. package/dist/tools/index.d.ts.map +1 -0
  53. package/dist/tools/index.js +27 -0
  54. package/dist/tools/index.js.map +1 -0
  55. package/dist/tools/integrations.d.ts +3 -0
  56. package/dist/tools/integrations.d.ts.map +1 -0
  57. package/dist/tools/integrations.js +96 -0
  58. package/dist/tools/integrations.js.map +1 -0
  59. package/dist/tools/lwc.d.ts +3 -0
  60. package/dist/tools/lwc.d.ts.map +1 -0
  61. package/dist/tools/lwc.js +73 -0
  62. package/dist/tools/lwc.js.map +1 -0
  63. package/dist/tools/mcp.d.ts +3 -0
  64. package/dist/tools/mcp.d.ts.map +1 -0
  65. package/dist/tools/mcp.js +44 -0
  66. package/dist/tools/mcp.js.map +1 -0
  67. package/dist/tools/metadata.d.ts +3 -0
  68. package/dist/tools/metadata.d.ts.map +1 -0
  69. package/dist/tools/metadata.js +168 -0
  70. package/dist/tools/metadata.js.map +1 -0
  71. package/dist/tools/objects.d.ts +3 -0
  72. package/dist/tools/objects.d.ts.map +1 -0
  73. package/dist/tools/objects.js +172 -0
  74. package/dist/tools/objects.js.map +1 -0
  75. package/dist/tools/security.d.ts +3 -0
  76. package/dist/tools/security.d.ts.map +1 -0
  77. package/dist/tools/security.js +82 -0
  78. package/dist/tools/security.js.map +1 -0
  79. package/dist/tools/ui.d.ts +3 -0
  80. package/dist/tools/ui.d.ts.map +1 -0
  81. package/dist/tools/ui.js +195 -0
  82. package/dist/tools/ui.js.map +1 -0
  83. package/dist/tools/utils.d.ts +15 -0
  84. package/dist/tools/utils.d.ts.map +1 -0
  85. package/dist/tools/utils.js +7 -0
  86. package/dist/tools/utils.js.map +1 -0
  87. package/dist/types.d.ts +85 -0
  88. package/dist/types.d.ts.map +1 -0
  89. package/dist/types.js +3 -0
  90. package/dist/types.js.map +1 -0
  91. package/package.json +46 -0
@@ -0,0 +1,186 @@
1
+ import { CreateEmailAlertSchema, CreatePlatformEventSchema, CreateAssignmentRuleSchema, CreateEscalationRuleSchema, CreateAutoResponseRuleSchema, CreateMatchingRuleSchema, CreateDuplicateRuleSchema, CreateApexEmailServiceSchema, CreateScheduledJobSchema, } from "../schemas/index.js";
2
+ import { getAuth, createEmailAlert, createPlatformEvent, createAssignmentRule, createAutoResponseRule, createMatchingRule, createDuplicateRule, } from "../services/salesforce.js";
3
+ import { createApexEmailService, createScheduledJob, } from "../services/tooling.js";
4
+ import { resultContent } from "./utils.js";
5
+ export function registerAutomationTools(server) {
6
+ server.registerTool("sf_create_email_alert", {
7
+ title: "Create Workflow Email Alert",
8
+ description: `Creates a Workflow Email Alert action that can be triggered by Flows, Approval Processes, or Workflow Rules. Specify the email template to use and recipients (owner, creator, users, roles, or custom email addresses). Use when you need to send notification emails as part of automation.`,
9
+ inputSchema: CreateEmailAlertSchema,
10
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
11
+ }, async (params) => {
12
+ const auth = await getAuth();
13
+ const result = await createEmailAlert(auth, {
14
+ objectName: params.objectName,
15
+ alertName: params.alertName,
16
+ label: params.label,
17
+ description: params.description,
18
+ template: params.template,
19
+ senderType: params.senderType,
20
+ senderAddress: params.senderAddress,
21
+ recipients: params.recipients,
22
+ protected: params.protected,
23
+ });
24
+ return resultContent(result);
25
+ });
26
+ server.registerTool("sf_create_platform_event", {
27
+ title: "Create Platform Event",
28
+ description: `Creates a Platform Event object (ending in __e) for event-driven architecture. Platform Events enable real-time publish/subscribe communication between systems. Publishers fire events and subscribers (Flows, Apex triggers, external systems) react to them. PublishAfterCommit waits for DML to commit; PublishImmediately fires right away.`,
29
+ inputSchema: CreatePlatformEventSchema,
30
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
31
+ }, async (params) => {
32
+ const auth = await getAuth();
33
+ const result = await createPlatformEvent(auth, {
34
+ fullName: params.fullName,
35
+ label: params.label,
36
+ pluralLabel: params.pluralLabel,
37
+ description: params.description,
38
+ publishBehavior: params.publishBehavior,
39
+ fields: params.fields,
40
+ });
41
+ return resultContent(result);
42
+ });
43
+ server.registerTool("sf_create_assignment_rule", {
44
+ title: "Create Lead or Case Assignment Rule",
45
+ description: `Creates an Assignment Rule for Leads or Cases. Assignment rules automatically route new records to the appropriate owner (user or queue) based on matching criteria. Only one rule can be active at a time per object. Rule entries are evaluated top-to-bottom and the first match wins.`,
46
+ inputSchema: CreateAssignmentRuleSchema,
47
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
48
+ }, async (params) => {
49
+ const auth = await getAuth();
50
+ const result = await createAssignmentRule(auth, {
51
+ objectName: params.objectName,
52
+ ruleName: params.ruleName,
53
+ label: params.label,
54
+ active: params.active,
55
+ ruleEntries: params.ruleEntries,
56
+ });
57
+ return resultContent(result);
58
+ });
59
+ server.registerTool("sf_create_escalation_rule", {
60
+ title: "Create Case Escalation Rule",
61
+ description: `Creates an Escalation Rule for Cases. Escalation rules automatically escalate cases that haven't been closed within a specified time, reassigning them to other users or queues and optionally sending notifications. Based on business hours and a configurable start date (creation time or last modification).`,
62
+ inputSchema: CreateEscalationRuleSchema,
63
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
64
+ }, async (params) => {
65
+ const auth = await getAuth();
66
+ // Build escalation XML manually
67
+ const entriesXml = params.ruleEntries.map(e => {
68
+ const criteriaXml = (e.criteriaItems ?? []).map((c) => `
69
+ <met:criteriaItems>
70
+ <met:field>${c.field}</met:field>
71
+ <met:operation>${c.operation}</met:operation>
72
+ <met:value>${c.value}</met:value>
73
+ </met:criteriaItems>`).join("\n");
74
+ const actionsXml = e.escalationActions.map((a) => `
75
+ <met:escalationAction>
76
+ <met:minutesToEscalation>${a.minutesToEscalation}</met:minutesToEscalation>
77
+ ${a.assignedTo ? `<met:assignedTo>${a.assignedTo}</met:assignedTo><met:assignedToType>${a.assignedToType ?? "Queue"}</met:assignedToType>` : ""}
78
+ ${a.notifyTo ? `<met:notifyTo>${a.notifyTo}</met:notifyTo>` : ""}
79
+ ${a.template ? `<met:template>${a.template}</met:template>` : ""}
80
+ </met:escalationAction>`).join("\n");
81
+ return `<met:ruleEntry>
82
+ ${criteriaXml}
83
+ ${e.formula ? `<met:formula>${e.formula}</met:formula>` : ""}
84
+ <met:businessHours>${e.businessHours}</met:businessHours>
85
+ <met:escalationStartDate>${e.escalationStartDate}</met:escalationStartDate>
86
+ ${actionsXml}
87
+ </met:ruleEntry>`;
88
+ }).join("\n");
89
+ const xml = `<met:metadata xsi:type="met:EscalationRules" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
90
+ <met:fullName>Case</met:fullName>
91
+ <met:escalationRule>
92
+ <met:fullName>${params.ruleName}</met:fullName>
93
+ <met:active>${params.active}</met:active>
94
+ ${entriesXml}
95
+ </met:escalationRule>
96
+ </met:metadata>`;
97
+ const { upsertMetadata } = await import("../services/salesforce.js");
98
+ const result = await upsertMetadata(auth, xml);
99
+ return resultContent(result);
100
+ });
101
+ server.registerTool("sf_create_auto_response_rule", {
102
+ title: "Create Auto-Response Rule",
103
+ description: `Creates an Auto-Response Rule for Web-to-Lead or Web-to-Case. When a lead or case is created via a web form, this rule automatically sends a confirmation email using the specified template. Rule entries define which template to use based on criteria.`,
104
+ inputSchema: CreateAutoResponseRuleSchema,
105
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
106
+ }, async (params) => {
107
+ const auth = await getAuth();
108
+ const result = await createAutoResponseRule(auth, {
109
+ objectName: params.objectName,
110
+ ruleName: params.ruleName,
111
+ label: params.label,
112
+ active: params.active,
113
+ ruleEntries: params.ruleEntries,
114
+ });
115
+ return resultContent(result);
116
+ });
117
+ server.registerTool("sf_create_matching_rule", {
118
+ title: "Create Matching Rule",
119
+ description: `Creates a Matching Rule used by Duplicate Rules to detect potential duplicate records. Define which fields to match on and which matching algorithm to use (Exact, FirstName, LastName, Company, Email, Phone, etc.). Must be created before creating a Duplicate Rule that references it.`,
120
+ inputSchema: CreateMatchingRuleSchema,
121
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
122
+ }, async (params) => {
123
+ const auth = await getAuth();
124
+ const result = await createMatchingRule(auth, {
125
+ objectName: params.objectName,
126
+ ruleName: params.ruleName,
127
+ label: params.label,
128
+ description: params.description,
129
+ matchingRuleItems: params.matchingRuleItems,
130
+ });
131
+ return resultContent(result);
132
+ });
133
+ server.registerTool("sf_create_duplicate_rule", {
134
+ title: "Create Duplicate Rule",
135
+ description: `Creates a Duplicate Rule that uses Matching Rules to detect potential duplicates when records are saved. Can block duplicates, allow with a warning, or allow silently. Works for Leads, Contacts, Accounts, and custom objects. Requires existing Matching Rules.`,
136
+ inputSchema: CreateDuplicateRuleSchema,
137
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
138
+ }, async (params) => {
139
+ const auth = await getAuth();
140
+ const result = await createDuplicateRule(auth, {
141
+ objectName: params.objectName,
142
+ ruleName: params.ruleName,
143
+ label: params.label,
144
+ description: params.description,
145
+ isActive: params.isActive,
146
+ actionOnInsert: params.actionOnInsert,
147
+ actionOnUpdate: params.actionOnUpdate,
148
+ alertMessage: params.alertMessage,
149
+ matchingRules: params.matchingRules,
150
+ });
151
+ return resultContent(result);
152
+ });
153
+ server.registerTool("sf_create_apex_email_service", {
154
+ title: "Create Apex Email Service",
155
+ description: `Creates an Apex Email Service that processes inbound emails via an Apex class implementing Messaging.InboundEmailHandler. Useful for creating support cases from emails, parsing email content, or triggering workflows from inbound messages. The Apex class must exist before creating the service.`,
156
+ inputSchema: CreateApexEmailServiceSchema,
157
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
158
+ }, async (params) => {
159
+ const auth = await getAuth();
160
+ const result = await createApexEmailService(auth, {
161
+ functionName: params.functionName,
162
+ apexClassName: params.apexClassName,
163
+ isActive: params.isActive,
164
+ isAuthenticationRequired: params.isAuthenticationRequired,
165
+ isErrorRoutingEnabled: params.isErrorRoutingEnabled,
166
+ errorRoutingAddress: params.errorRoutingAddress,
167
+ functionInactiveAction: params.functionInactiveAction,
168
+ functionExceptionAction: params.functionExceptionAction,
169
+ overLimitAction: params.overLimitAction,
170
+ authenticationFailureAction: params.authenticationFailureAction,
171
+ attachmentOption: params.attachmentOption,
172
+ });
173
+ return resultContent(result);
174
+ });
175
+ server.registerTool("sf_create_scheduled_job", {
176
+ title: "Create Scheduled Apex Job",
177
+ description: `Schedules an Apex class that implements the Schedulable interface to run on a cron schedule. Use for batch processing, nightly data cleanup, report generation, or any periodic automation. The Apex class must already exist in the org. Example cron: '0 0 2 * * ?' = daily at 2 AM.`,
178
+ inputSchema: CreateScheduledJobSchema,
179
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
180
+ }, async (params) => {
181
+ const auth = await getAuth();
182
+ const result = await createScheduledJob(auth, params.className, params.jobName, params.cronExpression);
183
+ return resultContent(result);
184
+ });
185
+ }
186
+ //# sourceMappingURL=automation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation.js","sourceRoot":"","sources":["../../src/tools/automation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB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AE,aAAa,EAAE,IAAI,EAAE;KACzG,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,MAAM,IAAI,GAAG,MAAM,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;QACvG,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerDeploymentTools(server: McpServer): void;
3
+ //# sourceMappingURL=deployment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../src/tools/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAsBzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAwG/D"}
@@ -0,0 +1,89 @@
1
+ import { CreateOutboundChangeSetSchema, AddToChangeSetSchema, DeployMetadataSchema, CheckDeployStatusSchema, RetrieveMetadataSchema, } from "../schemas/index.js";
2
+ import { getAuth } from "../services/salesforce.js";
3
+ import { buildGenericDeployZip, deployZip, pollDeployStatus, checkDeployStatus, retrieveMetadata, } from "../services/deployment.js";
4
+ import { createOutboundChangeSet, addComponentsToChangeSet, } from "../services/tooling.js";
5
+ import { resultContent } from "./utils.js";
6
+ export function registerDeploymentTools(server) {
7
+ server.registerTool("sf_create_outbound_change_set", {
8
+ title: "Create Outbound Change Set",
9
+ description: `Creates an Outbound Change Set in the org — a container for metadata components that can be deployed to connected orgs (sandbox → production). Optionally adds specified components immediately. Returns the change set ID and a link to view it in Setup. Use this before deploying to production when using the change set deployment model.`,
10
+ inputSchema: CreateOutboundChangeSetSchema,
11
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
12
+ }, async (params) => {
13
+ const auth = await getAuth();
14
+ const csResult = await createOutboundChangeSet(auth, params.changeSetName, params.description);
15
+ if (!csResult.success || !params.components?.length)
16
+ return resultContent(csResult);
17
+ const addResult = await addComponentsToChangeSet(auth, params.changeSetName, params.components);
18
+ return resultContent({
19
+ success: addResult.success,
20
+ message: `${csResult.message}\n${addResult.message}`,
21
+ ...(addResult.success ? { fullName: params.changeSetName, created: true } : {})
22
+ });
23
+ });
24
+ server.registerTool("sf_add_to_change_set", {
25
+ title: "Add Components to Change Set",
26
+ description: `Adds one or more metadata components to an existing Outbound Change Set by change set name. Supports all metadata types: CustomObject, CustomField, ApexClass, ApexTrigger, Flow, ValidationRule, PermissionSet, etc. Use after creating a change set to add the metadata you want to deploy.`,
27
+ inputSchema: AddToChangeSetSchema,
28
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
29
+ }, async (params) => {
30
+ const auth = await getAuth();
31
+ const result = await addComponentsToChangeSet(auth, params.changeSetName, params.components);
32
+ return resultContent(result);
33
+ });
34
+ server.registerTool("sf_deploy_metadata", {
35
+ title: "Deploy Metadata",
36
+ description: `Deploys a set of metadata components directly to the org using the Metadata API SOAP deploy operation. Builds a package.xml and deployment zip in memory. Supports validate-only (checkOnly:true) for pre-deployment validation without making changes. Specify runTests to execute test classes during deployment (required for production). Polls until complete or timeout.`,
37
+ inputSchema: DeployMetadataSchema,
38
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
39
+ }, async (params) => {
40
+ const auth = await getAuth();
41
+ try {
42
+ const base64Zip = await buildGenericDeployZip(params.components, "62.0");
43
+ const deployId = await deployZip(auth, base64Zip, {
44
+ checkOnly: params.checkOnly,
45
+ runTests: params.runTests,
46
+ rollbackOnError: params.rollbackOnError,
47
+ });
48
+ const result = await pollDeployStatus(auth, deployId, params.waitMinutes * 60 * 1000);
49
+ return resultContent({
50
+ success: result.success,
51
+ message: `${params.checkOnly ? "[VALIDATE ONLY] " : ""}${result.message}`,
52
+ ...(result.success ? { fullName: deployId, created: true } : {})
53
+ });
54
+ }
55
+ catch (err) {
56
+ return resultContent({ success: false, message: err instanceof Error ? err.message : String(err) });
57
+ }
58
+ });
59
+ server.registerTool("sf_check_deploy_status", {
60
+ title: "Check Deployment Status",
61
+ description: `Checks the status of an in-progress or recently completed metadata deployment by async job ID. Returns the status (Pending, InProgress, Succeeded, Failed, Canceled), component successes, failures, and test results. Use with the deploy ID returned from sf_deploy_metadata.`,
62
+ inputSchema: CheckDeployStatusSchema,
63
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
64
+ }, async (params) => {
65
+ const auth = await getAuth();
66
+ try {
67
+ const status = await checkDeployStatus(auth, params.deployId);
68
+ return resultContent({
69
+ success: status.done ? status.success : true,
70
+ message: status.message,
71
+ ...(status.done && status.success ? { fullName: params.deployId, created: false } : {})
72
+ });
73
+ }
74
+ catch (err) {
75
+ return resultContent({ success: false, message: err instanceof Error ? err.message : String(err) });
76
+ }
77
+ });
78
+ server.registerTool("sf_retrieve_metadata", {
79
+ title: "Retrieve Metadata",
80
+ description: `Retrieves metadata components from the org by initiating a SOAP retrieve operation. Returns an async job ID. The org will package the requested components — use this to read existing configuration before making changes, back up metadata, or understand the current state of a setup item. Returns the retrieve request ID; the actual zip is available via Metadata API checkRetrieveStatus.`,
81
+ inputSchema: RetrieveMetadataSchema,
82
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
83
+ }, async (params) => {
84
+ const auth = await getAuth();
85
+ const result = await retrieveMetadata(auth, params.components);
86
+ return resultContent(result);
87
+ });
88
+ }
89
+ //# sourceMappingURL=deployment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment.js","sourceRoot":"","sources":["../../src/tools/deployment.ts"],"names":[],"mappings":"AACA,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,EACpB,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YAC9D,OAAO,aAAa,CAAC;gBACnB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;gBAC5C,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACxF,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,OAAO,aAAa,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACtG,CAAC;IACH,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,sBAAsB,EACtB;QACE,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,mYAAmY;QAChZ,WAAW,EAAE,sBAAsB;QACnC,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;KACvG,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,MAAM,IAAI,GAAG,MAAM,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;QAC/D,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerExperienceTools(server: McpServer): void;
3
+ //# sourceMappingURL=experience.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experience.d.ts","sourceRoot":"","sources":["../../src/tools/experience.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAyD/D"}
@@ -0,0 +1,53 @@
1
+ import { CreateExperienceSiteSchema, CreateExperiencePageSchema } from "../schemas/index.js";
2
+ import { getAuth, createExperienceSite } from "../services/salesforce.js";
3
+ import { resultContent } from "./utils.js";
4
+ export function registerExperienceTools(server) {
5
+ server.registerTool("sf_create_experience_site", {
6
+ title: "Create Experience Cloud Site",
7
+ description: `Creates an Experience Cloud site (formerly Community) using a specified template. Supported templates: CustomerService (B2C self-service), Partner (B2B partner portal), LWR (Lightning Web Runtime — high performance), Aloha (App Launcher), Microsites (standalone pages). The urlPathPrefix appears in the site URL (e.g., 'customers' → org.force.com/customers). Site starts in UnderConstruction status by default.`,
8
+ inputSchema: CreateExperienceSiteSchema,
9
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
10
+ }, async (params) => {
11
+ const auth = await getAuth();
12
+ const result = await createExperienceSite(auth, {
13
+ siteName: params.siteName,
14
+ label: params.label,
15
+ template: params.template,
16
+ urlPathPrefix: params.urlPathPrefix,
17
+ description: params.description,
18
+ status: params.status,
19
+ guestUserProfile: params.guestUserProfile,
20
+ });
21
+ return resultContent(result);
22
+ });
23
+ server.registerTool("sf_create_experience_page", {
24
+ title: "Create Experience Cloud Page",
25
+ description: `Creates a page within an existing Experience Cloud site. Pages can be standard (home, login, profile, object detail, object list) or custom. The page URL path is relative to the site's URL prefix. Use after creating the site to add additional pages for different content sections.`,
26
+ inputSchema: CreateExperiencePageSchema,
27
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
28
+ }, async (params) => {
29
+ const auth = await getAuth();
30
+ // Experience pages are created via the Sites REST API
31
+ try {
32
+ const { createClient } = await import("../services/salesforce.js");
33
+ const client = createClient(auth);
34
+ const resp = await client.post(`/connect/communities/${params.siteName}/pages`, {
35
+ name: params.pageName,
36
+ label: params.label,
37
+ type: params.type,
38
+ url: params.url ?? `/${params.pageName.toLowerCase().replace(/\s+/g, "-")}`,
39
+ });
40
+ const data = resp.data;
41
+ return resultContent({
42
+ success: true,
43
+ message: `Experience page '${params.label}' created in site '${params.siteName}'.${data?.id ? ` Page ID: ${data.id}` : ""}`,
44
+ fullName: `${params.siteName}/${params.pageName}`,
45
+ created: true
46
+ });
47
+ }
48
+ catch (err) {
49
+ return resultContent({ success: false, message: err instanceof Error ? err.message : String(err) });
50
+ }
51
+ });
52
+ }
53
+ //# sourceMappingURL=experience.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experience.js","sourceRoot":"","sources":["../../src/tools/experience.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IAEvD,MAAM,CAAC,YAAY,CACjB,2BAA2B,EAC3B;QACE,KAAK,EAAE,8BAA8B;QACrC,WAAW,EAAE,4ZAA4Z;QACza,WAAW,EAAE,0BAA0B;QACvC,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE;KACzG,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,MAAM,IAAI,GAAG,MAAM,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,IAAI,EAAE;YAC9C,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,KAAK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nB,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,oBAAoB,MAAM,CAAC,KAAK,sBAAsB,MAAM,CAAC,QAAQ,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC3H,QAAQ,EAAE,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE;gBACjD,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,OAAO,aAAa,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACtG,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerTools(server: McpServer): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAczE,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAarD"}
@@ -0,0 +1,27 @@
1
+ import { registerMetadataTools } from "./metadata.js";
2
+ import { registerObjectTools } from "./objects.js";
3
+ import { registerAutomationTools } from "./automation.js";
4
+ import { registerSecurityTools } from "./security.js";
5
+ import { registerUiTools } from "./ui.js";
6
+ import { registerApexTools } from "./apex.js";
7
+ import { registerLwcTools } from "./lwc.js";
8
+ import { registerExperienceTools } from "./experience.js";
9
+ import { registerAgentforceTools } from "./agentforce.js";
10
+ import { registerDeploymentTools } from "./deployment.js";
11
+ import { registerMcpTools } from "./mcp.js";
12
+ import { registerIntegrationTools } from "./integrations.js";
13
+ export function registerTools(server) {
14
+ registerMetadataTools(server);
15
+ registerObjectTools(server);
16
+ registerAutomationTools(server);
17
+ registerSecurityTools(server);
18
+ registerUiTools(server);
19
+ registerApexTools(server);
20
+ registerLwcTools(server);
21
+ registerExperienceTools(server);
22
+ registerAgentforceTools(server);
23
+ registerDeploymentTools(server);
24
+ registerMcpTools(server);
25
+ registerIntegrationTools(server);
26
+ }
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,UAAU,aAAa,CAAC,MAAiB;IAC7C,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC9B,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5B,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAChC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC9B,eAAe,CAAC,MAAM,CAAC,CAAC;IACxB,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAChC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAChC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAChC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,wBAAwB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerIntegrationTools(server: McpServer): void;
3
+ //# sourceMappingURL=integrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../src/tools/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAkBzE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAoHhE"}
@@ -0,0 +1,96 @@
1
+ import { CreateConnectedAppSchema, CreateExternalDataSourceSchema, CreateExternalObjectSchema, CreateRemoteSiteSettingSchema, CreateCspSettingSchema, } from "../schemas/index.js";
2
+ import { getAuth, createConnectedApp, createExternalDataSource, createExternalObject, createRemoteSiteSetting, createCspSetting, } from "../services/salesforce.js";
3
+ import { resultContent } from "./utils.js";
4
+ export function registerIntegrationTools(server) {
5
+ server.registerTool("sf_create_connected_app", {
6
+ title: "Create Connected App (OAuth)",
7
+ description: `Creates a Connected App in Salesforce to enable OAuth authentication for external applications. Connected Apps are required for any external system that wants to connect to Salesforce via OAuth 2.0. Specify callback URLs for the OAuth flow, OAuth scopes (api, web, full, offline_access, etc.), and contact email. Used for web apps, mobile apps, desktop apps, or server-to-server integrations.`,
8
+ inputSchema: CreateConnectedAppSchema,
9
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
10
+ }, async (params) => {
11
+ const auth = await getAuth();
12
+ const result = await createConnectedApp(auth, {
13
+ fullName: params.fullName,
14
+ label: params.label,
15
+ description: params.description,
16
+ contactEmail: params.contactEmail,
17
+ callbackUrls: params.callbackUrls,
18
+ scopes: params.scopes,
19
+ consumerKey: params.consumerKey,
20
+ startUrl: params.startUrl,
21
+ accessTokenValidity: params.accessTokenValidity,
22
+ refreshTokenValidity: params.refreshTokenValidity,
23
+ });
24
+ return resultContent(result);
25
+ });
26
+ server.registerTool("sf_create_external_data_source", {
27
+ title: "Create External Data Source",
28
+ description: `Creates an External Data Source for Salesforce Connect, enabling read-write access to data stored outside Salesforce without importing it. Supports OData 2.0/4.0 for standard REST services, SimpleURL for basic access, Apex for custom adapters. The external data then appears as External Objects (__x) in Salesforce.`,
29
+ inputSchema: CreateExternalDataSourceSchema,
30
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
31
+ }, async (params) => {
32
+ const auth = await getAuth();
33
+ const result = await createExternalDataSource(auth, {
34
+ fullName: params.fullName,
35
+ label: params.label,
36
+ type: params.type,
37
+ endpoint: params.endpoint,
38
+ principalType: params.principalType,
39
+ protocol: params.protocol,
40
+ username: params.username,
41
+ description: params.description,
42
+ });
43
+ return resultContent(result);
44
+ });
45
+ server.registerTool("sf_create_external_object", {
46
+ title: "Create External Object",
47
+ description: `Creates an External Object (ending in __x) linked to an External Data Source. External Objects look like regular Salesforce objects but their data lives in an external system. They support lookups from standard/custom objects, appear in related lists, and can be used in reports. Requires an existing External Data Source.`,
48
+ inputSchema: CreateExternalObjectSchema,
49
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
50
+ }, async (params) => {
51
+ const auth = await getAuth();
52
+ const result = await createExternalObject(auth, {
53
+ fullName: params.fullName,
54
+ label: params.label,
55
+ pluralLabel: params.pluralLabel,
56
+ externalDataSource: params.externalDataSource,
57
+ externalName: params.externalName,
58
+ description: params.description,
59
+ fields: params.fields,
60
+ });
61
+ return resultContent(result);
62
+ });
63
+ server.registerTool("sf_create_remote_site_setting", {
64
+ title: "Create Remote Site Setting",
65
+ description: `Creates a Remote Site Setting to whitelist an external URL for Apex callouts. Salesforce blocks outbound HTTP calls by default — adding a Remote Site Setting allows Apex code to call that URL. Required for any external API callout from Apex or Flows. Use with sf_create_named_credential for authenticated callouts.`,
66
+ inputSchema: CreateRemoteSiteSettingSchema,
67
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
68
+ }, async (params) => {
69
+ const auth = await getAuth();
70
+ const result = await createRemoteSiteSetting(auth, {
71
+ fullName: params.fullName,
72
+ name: params.name,
73
+ url: params.url,
74
+ description: params.description,
75
+ isActive: params.isActive,
76
+ disableProtocolSecurity: params.disableProtocolSecurity,
77
+ });
78
+ return resultContent(result);
79
+ });
80
+ server.registerTool("sf_create_csp_setting", {
81
+ title: "Create Content Security Policy (CSP) Trusted Site",
82
+ description: `Creates a Content Security Policy trusted site, allowing LWC components and Visualforce pages to load resources from external URLs. CSP settings are needed when your LWC uses external JavaScript libraries, fonts, images, or APIs. Specify which directives (connect-src, script-src, style-src, img-src, etc.) the URL is trusted for.`,
83
+ inputSchema: CreateCspSettingSchema,
84
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
85
+ }, async (params) => {
86
+ const auth = await getAuth();
87
+ const result = await createCspSetting(auth, {
88
+ endpointUrl: params.endpointUrl,
89
+ cspDirectives: params.cspDirectives,
90
+ description: params.description,
91
+ isActive: params.isActive,
92
+ });
93
+ return resultContent(result);
94
+ });
95
+ }
96
+ //# sourceMappingURL=integrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.js","sourceRoot":"","sources":["../../src/tools/integrations.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,0BAA0B,EAC1B,6BAA6B,EAC7B,sBAAsB,GACvB,MAAM,qBAAqB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M,CAAC,WAAW;YAC/B,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAC;QACH,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerLwcTools(server: McpServer): void;
3
+ //# sourceMappingURL=lwc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lwc.d.ts","sourceRoot":"","sources":["../../src/tools/lwc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA2ExD"}
@@ -0,0 +1,73 @@
1
+ import { CreateLwcSchema, UpdateLwcSchema } from "../schemas/index.js";
2
+ import { getAuth } from "../services/salesforce.js";
3
+ import { buildLwcZip, deployZip, pollDeployStatus } from "../services/deployment.js";
4
+ import { resultContent } from "./utils.js";
5
+ export function registerLwcTools(server) {
6
+ server.registerTool("sf_create_lwc", {
7
+ title: "Create Lightning Web Component",
8
+ description: `Creates and deploys a new Lightning Web Component (LWC) to the Salesforce org. Provide the HTML template, JavaScript controller, optional CSS, and component metadata. The component is packaged into a deployment zip and deployed via the Metadata API. Specify targets to make the component available in Lightning App Builder (AppPage, RecordPage, HomePage), Flow Screen, Utility Bar, or Experience Cloud. Use isExposed:true to make it drag-and-drop in App Builder.`,
9
+ inputSchema: CreateLwcSchema,
10
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
11
+ }, async (params) => {
12
+ const auth = await getAuth();
13
+ try {
14
+ const base64Zip = await buildLwcZip({
15
+ componentName: params.componentName,
16
+ html: params.html,
17
+ javascript: params.javascript,
18
+ css: params.css,
19
+ description: params.description,
20
+ apiVersion: params.apiVersion,
21
+ targets: params.targets,
22
+ isExposed: params.isExposed,
23
+ });
24
+ const deployId = await deployZip(auth, base64Zip);
25
+ const result = await pollDeployStatus(auth, deployId, 5 * 60 * 1000);
26
+ if (result.success) {
27
+ return resultContent({
28
+ success: true,
29
+ message: `LWC '${params.componentName}' deployed successfully.`,
30
+ fullName: params.componentName,
31
+ created: true
32
+ });
33
+ }
34
+ return resultContent(result);
35
+ }
36
+ catch (err) {
37
+ return resultContent({ success: false, message: err instanceof Error ? err.message : String(err) });
38
+ }
39
+ });
40
+ server.registerTool("sf_update_lwc", {
41
+ title: "Update Lightning Web Component",
42
+ description: `Updates an existing Lightning Web Component by redeploying it with updated HTML, JavaScript, or CSS. Provide only the files you want to update — any files omitted will use empty placeholders (so you should provide all files you want to keep). The component is redeployed via the Metadata API.`,
43
+ inputSchema: UpdateLwcSchema,
44
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
45
+ }, async (params) => {
46
+ const auth = await getAuth();
47
+ try {
48
+ const base64Zip = await buildLwcZip({
49
+ componentName: params.componentName,
50
+ html: params.html ?? `<template>\n <!-- ${params.componentName} -->\n</template>`,
51
+ javascript: params.javascript ?? `import { LightningElement } from 'lwc';\nexport default class ${params.componentName.charAt(0).toUpperCase() + params.componentName.slice(1)} extends LightningElement {}`,
52
+ css: params.css,
53
+ apiVersion: params.apiVersion,
54
+ isExposed: true,
55
+ });
56
+ const deployId = await deployZip(auth, base64Zip);
57
+ const result = await pollDeployStatus(auth, deployId, 5 * 60 * 1000);
58
+ if (result.success) {
59
+ return resultContent({
60
+ success: true,
61
+ message: `LWC '${params.componentName}' updated successfully.`,
62
+ fullName: params.componentName,
63
+ created: false
64
+ });
65
+ }
66
+ return resultContent(result);
67
+ }
68
+ catch (err) {
69
+ return resultContent({ success: false, message: err instanceof Error ? err.message : String(err) });
70
+ }
71
+ });
72
+ }
73
+ //# sourceMappingURL=lwc.js.map