salesforce-metadata-mcp 2.5.6 → 2.6.6

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 (55) hide show
  1. package/AGENTFORCE.md +159 -125
  2. package/APEX_LWC.md +214 -214
  3. package/CHANGELOG.md +965 -645
  4. package/LICENSE +21 -21
  5. package/README.md +210 -207
  6. package/SECURITY.md +106 -106
  7. package/SETUP.md +217 -217
  8. package/TOOLS.md +249 -209
  9. package/dist/index.js +4 -4
  10. package/dist/schemas/index.d.ts +281 -95
  11. package/dist/schemas/index.d.ts.map +1 -1
  12. package/dist/schemas/index.js +97 -75
  13. package/dist/schemas/index.js.map +1 -1
  14. package/dist/services/deployment.d.ts +6 -3
  15. package/dist/services/deployment.d.ts.map +1 -1
  16. package/dist/services/deployment.js +83 -49
  17. package/dist/services/deployment.js.map +1 -1
  18. package/dist/services/mcpgen.js +96 -96
  19. package/dist/services/salesforce.d.ts +19 -4
  20. package/dist/services/salesforce.d.ts.map +1 -1
  21. package/dist/services/salesforce.js +2321 -1824
  22. package/dist/services/salesforce.js.map +1 -1
  23. package/dist/tools/admin.js +41 -41
  24. package/dist/tools/agentforce.d.ts.map +1 -1
  25. package/dist/tools/agentforce.js +171 -44
  26. package/dist/tools/agentforce.js.map +1 -1
  27. package/dist/tools/apex.js +4 -4
  28. package/dist/tools/apex.js.map +1 -1
  29. package/dist/tools/audit.js +44 -44
  30. package/dist/tools/automation.d.ts.map +1 -1
  31. package/dist/tools/automation.js +57 -57
  32. package/dist/tools/automation.js.map +1 -1
  33. package/dist/tools/comms.js +12 -12
  34. package/dist/tools/cpq.js +24 -24
  35. package/dist/tools/data.js +52 -52
  36. package/dist/tools/deployment.d.ts.map +1 -1
  37. package/dist/tools/deployment.js +3 -2
  38. package/dist/tools/deployment.js.map +1 -1
  39. package/dist/tools/devops.js +57 -57
  40. package/dist/tools/einstein.js +38 -38
  41. package/dist/tools/flows.d.ts.map +1 -1
  42. package/dist/tools/flows.js +32 -2
  43. package/dist/tools/flows.js.map +1 -1
  44. package/dist/tools/lwc.js +18 -18
  45. package/dist/tools/metadata.d.ts.map +1 -1
  46. package/dist/tools/metadata.js +50 -51
  47. package/dist/tools/metadata.js.map +1 -1
  48. package/dist/tools/monitoring.js +26 -26
  49. package/dist/tools/omnichannel.js +105 -105
  50. package/dist/tools/omnistudio.js +96 -96
  51. package/dist/tools/security.js +22 -22
  52. package/dist/tools/ui.js +21 -21
  53. package/dist/types.d.ts +1 -1
  54. package/dist/types.d.ts.map +1 -1
  55. package/package.json +118 -109
package/AGENTFORCE.md CHANGED
@@ -1,125 +1,159 @@
1
- # Agentforce Guide
2
-
3
- Complete guide for creating Agentforce agents with `salesforce-metadata-mcp`.
4
-
5
- ---
6
-
7
- ## Overview
8
-
9
- Agentforce (Einstein Copilot) agents consist of three components:
10
-
11
- 1. **Agent** — The top-level AI assistant with a persona and instructions
12
- 2. **Topics** — Areas of expertise (what types of requests the agent handles)
13
- 3. **Actions** — Concrete steps the agent takes (powered by Flows, Apex, or Prompt Templates)
14
-
15
- ---
16
-
17
- ## Step 1: Create the Agent
18
-
19
- ```
20
- Create an Agentforce agent called SalesAssistant:
21
- - Label: Sales Assistant
22
- - Persona: A knowledgeable sales expert who helps reps close more deals
23
- - Tone: Professional
24
- - Instructions: Always check opportunity stage before recommending next steps. Be concise.
25
- ```
26
-
27
- This calls `sf_create_agent` with:
28
- ```json
29
- {
30
- "agentName": "SalesAssistant",
31
- "label": "Sales Assistant",
32
- "type": "EinsteinCopilot",
33
- "persona": "A knowledgeable sales expert who helps reps close more deals",
34
- "tone": "Neutral",
35
- "instructions": "Always check opportunity stage before recommending next steps. Be concise."
36
- }
37
- ```
38
-
39
- ---
40
-
41
- ## Step 2: Create Topics
42
-
43
- Topics tell the agent what kinds of user requests it can handle.
44
-
45
- ```
46
- Add a topic called OrderManagement to the SalesAssistant agent:
47
- - Label: Order Management
48
- - Description: Handles all questions about customer orders, quotes, and order status
49
- - Scope: User questions about creating orders, checking order status, updating order quantities
50
- - Instructions: 1. Identify the order or account. 2. Check current status. 3. Take appropriate action.
51
- ```
52
-
53
- ---
54
-
55
- ## Step 3: Create a Flow for the Action
56
-
57
- First, create the Flow that the agent will invoke:
58
-
59
- ```
60
- Create an AutoLaunchedFlow called Get_Account_Orders that:
61
- - Takes an input variable accountId (String, isInput: true)
62
- - Queries related Order__c records using GetRecords
63
- - Returns them in an output variable orders (SObject collection, isOutput: true)
64
- ```
65
-
66
- ---
67
-
68
- ## Step 4: Link the Flow as an Agent Action
69
-
70
- ```
71
- Create an agent action called GetOrders for the SalesAssistant agent's OrderManagement topic:
72
- - Type: Flow
73
- - Reference: Get_Account_Orders
74
- - Description: Retrieves all orders for a given account
75
- - Map input: accountId → {!Agent.Topic.Entities.accountId}
76
- ```
77
-
78
- ---
79
-
80
- ## End-to-End Example
81
-
82
- Full conversation to create a support agent:
83
-
84
- ```
85
- 1. Create an Agentforce agent called SupportAgent with:
86
- - Persona: "A friendly and efficient customer support representative"
87
- - Tone: Formal
88
- - Company: Acme Corp
89
-
90
- 2. Add a topic CaseManagement to SupportAgent:
91
- - Description: Handles customer support cases, status inquiries, and escalations
92
- - Scope: Questions about case status, creating new cases, escalating urgent issues
93
-
94
- 3. Create an AutoLaunchedFlow called Create_Support_Case with:
95
- - Input variables: subject (String), description (String), contactId (String)
96
- - A CreateRecords element creating a Case with these fields
97
- - Output variable: caseId (String)
98
-
99
- 4. Create an agent action CreateCase for SupportAgent.CaseManagement:
100
- - Type: Flow
101
- - Reference: Create_Support_Case
102
- - Description: Creates a new support case for the customer
103
- ```
104
-
105
- ---
106
-
107
- ## Testing Your Agent
108
-
109
- After creating all components:
110
-
111
- 1. **Activate the agent** in Setup → Einstein Copilot → Your Agent → Activate
112
- 2. **Open Copilot** in any Salesforce page (the lightning bolt icon)
113
- 3. **Test a prompt:** "Show me all orders for Acme Corp"
114
-
115
- The agent should route to the OrderManagement topic and invoke the GetOrders action.
116
-
117
- ---
118
-
119
- ## Tips
120
-
121
- - **Be specific in topic descriptions** the AI uses them to route requests
122
- - **Use clear action descriptions** — help the agent know when to invoke each action
123
- - **Start with Flows** — they're easiest to create and debug
124
- - **Test with narrow prompts first** gradually expand scope
125
- - **Use variables consistently** — name them meaningfully for better AI reasoning
1
+ # Agentforce Guide
2
+
3
+ Complete guide for creating Agentforce agents with `salesforce-metadata-mcp`.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ Agentforce (Einstein Copilot) agents consist of four components deployed in this order:
10
+
11
+ 1. **Agent** (`Bot`) — The AI assistant shell with persona and tone
12
+ 2. **Actions** (`GenAiFunction`) Concrete steps powered by Flows, Apex, or Prompt Templates
13
+ 3. **Topics** (`GenAiPlugin`) Areas of expertise; each topic lists which actions it can invoke
14
+ 4. **Planner** (`GenAiPlanner`) — **The critical wiring step** that connects the agent to its topics
15
+
16
+ > **Why the planner matters:** Without step 4, the agent exists in Salesforce but has zero routing capability. It cannot reach any topic or action. `sf_create_agent_planner` is what makes the agent functional.
17
+
18
+ ---
19
+
20
+ ## Step 1: Create the Agent
21
+
22
+ ```
23
+ Create an Agentforce agent called SalesAssistant:
24
+ - Label: Sales Assistant
25
+ - Persona: A knowledgeable sales expert who helps reps close more deals
26
+ - Tone: Professional
27
+ ```
28
+
29
+ This calls `sf_create_agent` with:
30
+ ```json
31
+ {
32
+ "agentName": "SalesAssistant",
33
+ "label": "Sales Assistant",
34
+ "persona": "A knowledgeable sales expert who helps reps close more deals",
35
+ "tone": "Neutral"
36
+ }
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Step 2: Create a Flow for Each Action
42
+
43
+ Create the Flow that the agent will invoke:
44
+
45
+ ```
46
+ Create an AutoLaunchedFlow called Get_Account_Orders that:
47
+ - Takes an input variable accountId (String, isInput: true)
48
+ - Queries related Order__c records using GetRecords
49
+ - Returns them in an output variable orders (SObject collection, isOutput: true)
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Step 3: Create Actions
55
+
56
+ Create a `GenAiFunction` linked to each Flow. **Note the action name — you'll need it in Step 4.**
57
+
58
+ ```
59
+ Create an agent action called GetOrders for the SalesAssistant agent's OrderManagement topic:
60
+ - Type: Flow
61
+ - Reference: Get_Account_Orders
62
+ - Description: Retrieves all orders for a given account
63
+ ```
64
+
65
+ This calls `sf_create_agent_action`. The action is deployed as a standalone `GenAiFunction` — it gets linked to the topic in the next step.
66
+
67
+ ---
68
+
69
+ ## Step 4: Create Topics (with actions listed)
70
+
71
+ Topics are created with their actions already listed. This is what links actions to topics.
72
+
73
+ ```
74
+ Add a topic called OrderManagement to the SalesAssistant agent:
75
+ - Label: Order Management
76
+ - Description: Handles all questions about customer orders, quotes, and order status
77
+ - Scope: User questions about creating orders, checking order status, updating order quantities
78
+ - Instructions: 1. Identify the order or account. 2. Check current status. 3. Take appropriate action.
79
+ - Actions: ["GetOrders"]
80
+ ```
81
+
82
+ This calls `sf_create_agent_topic` with `actions: ["GetOrders"]` — this embeds `<genAiFunctions>` in the topic XML.
83
+
84
+ ---
85
+
86
+ ## Step 5: Wire the Agent to its Topics (the Planner)
87
+
88
+ This is the step that was previously missing. Call `sf_create_agent_planner` after all topics are created:
89
+
90
+ ```
91
+ Wire the SalesAssistant agent to its topics: OrderManagement
92
+ ```
93
+
94
+ This calls `sf_create_agent_planner` with:
95
+ ```json
96
+ {
97
+ "agentName": "SalesAssistant",
98
+ "label": "Sales Assistant",
99
+ "topicNames": ["OrderManagement"]
100
+ }
101
+ ```
102
+
103
+ This deploys a `GenAiPlanner` record that routes user requests from the agent to the correct topic.
104
+
105
+ > If you add more topics later, call `sf_create_agent_planner` again with the **full updated list** of topic names — it will overwrite the planner with the new configuration.
106
+
107
+ ---
108
+
109
+ ## End-to-End Example
110
+
111
+ Full conversation to create a support agent:
112
+
113
+ ```
114
+ 1. Create an Agentforce agent called SupportAgent with:
115
+ - Persona: "A friendly and efficient customer support representative"
116
+ - Tone: Formal
117
+ - Company: Acme Corp
118
+
119
+ 2. Create an AutoLaunchedFlow called Create_Support_Case with:
120
+ - Input variables: subject (String), description (String), contactId (String)
121
+ - A CreateRecords element creating a Case with inputAssignments for those fields
122
+ - Output variable: caseId (String)
123
+
124
+ 3. Create an agent action CreateCase for SupportAgent.CaseManagement:
125
+ - Type: Flow
126
+ - Reference: Create_Support_Case
127
+ - Description: Creates a new support case for the customer
128
+
129
+ 4. Add a topic CaseManagement to SupportAgent:
130
+ - Description: Handles customer support cases, status inquiries, and escalations
131
+ - Scope: Questions about case status, creating new cases, escalating urgent issues
132
+ - Actions: ["CreateCase"]
133
+
134
+ 5. Wire SupportAgent to its topics:
135
+ - topicNames: ["CaseManagement"]
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Testing Your Agent
141
+
142
+ After completing all steps:
143
+
144
+ 1. **Activate the agent** in Setup → Agents → Your Agent → Activate
145
+ 2. **Open Copilot** in any Salesforce page (the lightning bolt icon)
146
+ 3. **Test a prompt:** "I need to create a support case for a billing issue"
147
+
148
+ The agent should route to the CaseManagement topic and invoke the CreateCase action.
149
+
150
+ ---
151
+
152
+ ## Tips
153
+
154
+ - **Create actions before topics** — topics need to list their action names upfront
155
+ - **Always run sf_create_agent_planner last** — it's the step that activates routing
156
+ - **Adding a new topic?** Re-run `sf_create_agent_planner` with all topic names (existing + new)
157
+ - **Be specific in topic descriptions** — the AI uses them to route requests
158
+ - **Use clear action descriptions** — help the agent know when to invoke each action
159
+ - **Start with Flows** — they're easiest to create and debug