@salesforce/mcp 0.17.1-dev.0 → 0.17.1
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/lib/index.js +2 -85
- package/lib/modules/platform-cli/index.d.ts +16 -0
- package/lib/modules/platform-cli/index.js +32 -0
- package/lib/{tools/users → modules/platform-cli}/sf-assign-permission-set.d.ts +5 -5
- package/lib/{tools/users → modules/platform-cli}/sf-assign-permission-set.js +1 -1
- package/lib/{tools/orgs → modules/platform-cli}/sf-create-org-snapshot.d.ts +2 -2
- package/lib/{tools/orgs → modules/platform-cli}/sf-create-org-snapshot.js +1 -1
- package/lib/{tools/orgs → modules/platform-cli}/sf-create-scratch-org.d.ts +5 -5
- package/lib/{tools/orgs → modules/platform-cli}/sf-create-scratch-org.js +1 -1
- package/lib/{tools/orgs → modules/platform-cli}/sf-delete-org.d.ts +3 -3
- package/lib/{tools/orgs → modules/platform-cli}/sf-delete-org.js +1 -1
- package/lib/{tools/metadata → modules/platform-cli}/sf-deploy-metadata.d.ts +3 -3
- package/lib/{tools/metadata → modules/platform-cli}/sf-deploy-metadata.js +1 -1
- package/lib/modules/platform-cli/sf-enable-tools.d.ts +2 -0
- package/lib/{tools/dynamic → modules/platform-cli}/sf-enable-tools.js +3 -3
- package/lib/{tools/core → modules/platform-cli}/sf-get-username.d.ts +2 -2
- package/lib/{tools/core → modules/platform-cli}/sf-get-username.js +1 -1
- package/lib/{tools/orgs → modules/platform-cli}/sf-list-all-orgs.d.ts +1 -1
- package/lib/{tools/orgs → modules/platform-cli}/sf-list-all-orgs.js +1 -1
- package/lib/modules/platform-cli/sf-list-tools.d.ts +2 -0
- package/lib/{tools/dynamic → modules/platform-cli}/sf-list-tools.js +2 -2
- package/lib/{tools/orgs → modules/platform-cli}/sf-org-open.d.ts +3 -3
- package/lib/{tools/orgs → modules/platform-cli}/sf-org-open.js +1 -1
- package/lib/{tools/data → modules/platform-cli}/sf-query-org.d.ts +3 -3
- package/lib/{tools/data → modules/platform-cli}/sf-query-org.js +1 -1
- package/lib/{tools/core → modules/platform-cli}/sf-resume.d.ts +3 -3
- package/lib/{tools/core → modules/platform-cli}/sf-resume.js +1 -1
- package/lib/modules/platform-cli/sf-retrieve-metadata.d.ts +2 -0
- package/lib/{tools/metadata → modules/platform-cli}/sf-retrieve-metadata.js +1 -1
- package/lib/{tools/core → modules/platform-cli}/sf-suggest-cli-command.d.ts +1 -1
- package/lib/{tools/core → modules/platform-cli}/sf-suggest-cli-command.js +1 -1
- package/lib/{tools/testing → modules/platform-cli}/sf-test-agents.d.ts +3 -3
- package/lib/{tools/testing → modules/platform-cli}/sf-test-agents.js +1 -1
- package/lib/{tools/testing → modules/platform-cli}/sf-test-apex.d.ts +3 -3
- package/lib/{tools/testing → modules/platform-cli}/sf-test-apex.js +1 -1
- package/lib/modules/platform-cli/utils/tools.d.ts +41 -0
- package/lib/{shared → modules/platform-cli/utils}/tools.js +1 -70
- package/lib/{shared/tools.d.ts → registry.d.ts} +2 -41
- package/lib/registry.js +130 -0
- package/lib/sf-mcp-server.js +2 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -3
- package/lib/tools/core/index.d.ts +0 -3
- package/lib/tools/core/index.js +0 -19
- package/lib/tools/data/index.d.ts +0 -1
- package/lib/tools/data/index.js +0 -17
- package/lib/tools/dynamic/index.d.ts +0 -2
- package/lib/tools/dynamic/index.js +0 -18
- package/lib/tools/dynamic/sf-enable-tools.d.ts +0 -2
- package/lib/tools/dynamic/sf-list-tools.d.ts +0 -2
- package/lib/tools/metadata/index.d.ts +0 -2
- package/lib/tools/metadata/index.js +0 -18
- package/lib/tools/metadata/sf-retrieve-metadata.d.ts +0 -2
- package/lib/tools/orgs/index.d.ts +0 -5
- package/lib/tools/orgs/index.js +0 -21
- package/lib/tools/testing/index.d.ts +0 -2
- package/lib/tools/testing/index.js +0 -18
- package/lib/tools/users/index.d.ts +0 -1
- package/lib/tools/users/index.js +0 -17
- package/npm-shrinkwrap.json +0 -18827
package/lib/index.js
CHANGED
|
@@ -16,18 +16,11 @@
|
|
|
16
16
|
/* eslint-disable no-console */
|
|
17
17
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
18
18
|
import { Command, Flags, ux } from '@oclif/core';
|
|
19
|
-
import * as core from './tools/core/index.js';
|
|
20
|
-
import * as orgs from './tools/orgs/index.js';
|
|
21
|
-
import * as data from './tools/data/index.js';
|
|
22
|
-
import * as users from './tools/users/index.js';
|
|
23
|
-
import * as testing from './tools/testing/index.js';
|
|
24
|
-
import * as metadata from './tools/metadata/index.js';
|
|
25
|
-
import * as dynamic from './tools/dynamic/index.js';
|
|
26
19
|
import Cache from './shared/cache.js';
|
|
27
20
|
import { Telemetry } from './telemetry.js';
|
|
28
21
|
import { SfMcpServer } from './sf-mcp-server.js';
|
|
29
22
|
import { maybeBuildIndex } from './assets.js';
|
|
30
|
-
import {
|
|
23
|
+
import { TOOLSETS, registerToolsets } from './registry.js';
|
|
31
24
|
/**
|
|
32
25
|
* Sanitizes an array of org usernames by replacing specific orgs with a placeholder.
|
|
33
26
|
* Special values (DEFAULT_TARGET_ORG, DEFAULT_TARGET_DEV_HUB, ALLOW_ALL_ORGS) are preserved.
|
|
@@ -140,83 +133,7 @@ You can also use special values to control access to orgs:
|
|
|
140
133
|
dynamicTools: flags['dynamic-tools'] ?? false,
|
|
141
134
|
});
|
|
142
135
|
await maybeBuildIndex(this.config.dataDir);
|
|
143
|
-
|
|
144
|
-
// ************************
|
|
145
|
-
// CORE TOOLS (always on)
|
|
146
|
-
// If you're adding a new tool to the core toolset, you MUST add it to the `CORE_TOOLS` array in shared/tools.ts
|
|
147
|
-
// otherwise SfMcpServer will not register it.
|
|
148
|
-
//
|
|
149
|
-
// Long term, we will want to consider a more elegant solution for registering core tools.
|
|
150
|
-
// ************************
|
|
151
|
-
this.logToStderr('Registering core tools');
|
|
152
|
-
// get username
|
|
153
|
-
core.registerToolGetUsername(server);
|
|
154
|
-
core.registerToolResume(server);
|
|
155
|
-
core.registerToolSuggestCliCommand(server);
|
|
156
|
-
// DYNAMIC TOOLSETS
|
|
157
|
-
// ************************
|
|
158
|
-
if (toolsetsToEnable.dynamic) {
|
|
159
|
-
this.logToStderr('Registering dynamic tools');
|
|
160
|
-
// Individual tool management
|
|
161
|
-
dynamic.registerToolEnableTools(server);
|
|
162
|
-
dynamic.registerToolListTools(server);
|
|
163
|
-
}
|
|
164
|
-
// ************************
|
|
165
|
-
// ORG TOOLS
|
|
166
|
-
// ************************
|
|
167
|
-
if (toolsetsToEnable.orgs) {
|
|
168
|
-
this.logToStderr('Registering org tools');
|
|
169
|
-
// list all orgs
|
|
170
|
-
orgs.registerToolListAllOrgs(server);
|
|
171
|
-
}
|
|
172
|
-
// ************************
|
|
173
|
-
// DATA TOOLS
|
|
174
|
-
// ************************
|
|
175
|
-
if (toolsetsToEnable.data) {
|
|
176
|
-
this.logToStderr('Registering data tools');
|
|
177
|
-
// query org
|
|
178
|
-
data.registerToolQueryOrg(server);
|
|
179
|
-
}
|
|
180
|
-
// ************************
|
|
181
|
-
// USER TOOLS
|
|
182
|
-
// ************************
|
|
183
|
-
if (toolsetsToEnable.users) {
|
|
184
|
-
this.logToStderr('Registering user tools');
|
|
185
|
-
// assign permission set
|
|
186
|
-
users.registerToolAssignPermissionSet(server);
|
|
187
|
-
}
|
|
188
|
-
// ************************
|
|
189
|
-
// testing TOOLS
|
|
190
|
-
// ************************
|
|
191
|
-
if (toolsetsToEnable.testing) {
|
|
192
|
-
this.logToStderr('Registering testing tools');
|
|
193
|
-
testing.registerToolTestApex(server);
|
|
194
|
-
testing.registerToolTestAgent(server);
|
|
195
|
-
}
|
|
196
|
-
// ************************
|
|
197
|
-
// METADATA TOOLS
|
|
198
|
-
// ************************
|
|
199
|
-
if (toolsetsToEnable.metadata) {
|
|
200
|
-
this.logToStderr('Registering metadata tools');
|
|
201
|
-
// deploy metadata
|
|
202
|
-
metadata.registerToolDeployMetadata(server);
|
|
203
|
-
// retrieve metadata
|
|
204
|
-
metadata.registerToolRetrieveMetadata(server);
|
|
205
|
-
}
|
|
206
|
-
// ************************
|
|
207
|
-
// EXPERIMENTAL TOOLS
|
|
208
|
-
//
|
|
209
|
-
// This toolset needs to be explicitly enabled ('all' will not include it)
|
|
210
|
-
// Tools don't need to be in an 'experimental' directory, only registered here
|
|
211
|
-
// ************************
|
|
212
|
-
if (toolsetsToEnable.experimental) {
|
|
213
|
-
this.logToStderr('Registering experimental tools');
|
|
214
|
-
orgs.registerToolOrgOpen(server);
|
|
215
|
-
// Add any experimental tools here
|
|
216
|
-
orgs.registerToolCreateScratchOrg(server);
|
|
217
|
-
orgs.registerToolDeleteOrg(server);
|
|
218
|
-
orgs.registerToolCreateOrgSnapshot(server);
|
|
219
|
-
}
|
|
136
|
+
registerToolsets(flags.toolsets ?? ['all'], flags['dynamic-tools'] ?? false, server);
|
|
220
137
|
const transport = new StdioServerTransport();
|
|
221
138
|
await server.connect(transport);
|
|
222
139
|
console.error(`✅ Salesforce MCP Server v${this.config.version} running on stdio`);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { assignPermissionSet } from './sf-assign-permission-set.js';
|
|
2
|
+
export { createOrgSnapshot } from './sf-create-org-snapshot.js';
|
|
3
|
+
export { createScratchOrg } from './sf-create-scratch-org.js';
|
|
4
|
+
export { deleteOrg } from './sf-delete-org.js';
|
|
5
|
+
export { deployMetadata } from './sf-deploy-metadata.js';
|
|
6
|
+
export { enableTools } from './sf-enable-tools.js';
|
|
7
|
+
export { getUsername } from './sf-get-username.js';
|
|
8
|
+
export { listAllOrgs } from './sf-list-all-orgs.js';
|
|
9
|
+
export { listTools } from './sf-list-tools.js';
|
|
10
|
+
export { orgOpen } from './sf-org-open.js';
|
|
11
|
+
export { queryOrg } from './sf-query-org.js';
|
|
12
|
+
export { resume } from './sf-resume.js';
|
|
13
|
+
export { retrieveMetadata } from './sf-retrieve-metadata.js';
|
|
14
|
+
export { suggestCliCommand } from './sf-suggest-cli-command.js';
|
|
15
|
+
export { testAgent } from './sf-test-agents.js';
|
|
16
|
+
export { testApex } from './sf-test-apex.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { assignPermissionSet } from './sf-assign-permission-set.js';
|
|
17
|
+
export { createOrgSnapshot } from './sf-create-org-snapshot.js';
|
|
18
|
+
export { createScratchOrg } from './sf-create-scratch-org.js';
|
|
19
|
+
export { deleteOrg } from './sf-delete-org.js';
|
|
20
|
+
export { deployMetadata } from './sf-deploy-metadata.js';
|
|
21
|
+
export { enableTools } from './sf-enable-tools.js';
|
|
22
|
+
export { getUsername } from './sf-get-username.js';
|
|
23
|
+
export { listAllOrgs } from './sf-list-all-orgs.js';
|
|
24
|
+
export { listTools } from './sf-list-tools.js';
|
|
25
|
+
export { orgOpen } from './sf-org-open.js';
|
|
26
|
+
export { queryOrg } from './sf-query-org.js';
|
|
27
|
+
export { resume } from './sf-resume.js';
|
|
28
|
+
export { retrieveMetadata } from './sf-retrieve-metadata.js';
|
|
29
|
+
export { suggestCliCommand } from './sf-suggest-cli-command.js';
|
|
30
|
+
export { testAgent } from './sf-test-agents.js';
|
|
31
|
+
export { testApex } from './sf-test-apex.js';
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -6,15 +6,15 @@ export declare const assignPermissionSetParamsSchema: z.ZodObject<{
|
|
|
6
6
|
onBehalfOf: z.ZodOptional<z.ZodString>;
|
|
7
7
|
directory: z.ZodEffects<z.ZodString, string, string>;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
directory: string;
|
|
10
|
-
usernameOrAlias: string;
|
|
11
9
|
permissionSetName: string;
|
|
10
|
+
usernameOrAlias: string;
|
|
11
|
+
directory: string;
|
|
12
12
|
onBehalfOf?: string | undefined;
|
|
13
13
|
}, {
|
|
14
|
-
directory: string;
|
|
15
|
-
usernameOrAlias: string;
|
|
16
14
|
permissionSetName: string;
|
|
15
|
+
usernameOrAlias: string;
|
|
16
|
+
directory: string;
|
|
17
17
|
onBehalfOf?: string | undefined;
|
|
18
18
|
}>;
|
|
19
19
|
export type AssignPermissionSetOptions = z.infer<typeof assignPermissionSetParamsSchema>;
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const assignPermissionSet: (server: SfMcpServer) => void;
|
|
@@ -56,7 +56,7 @@ Set the permission set MyPermSet on behalf of test-3uyb8kmftiu@example.com.
|
|
|
56
56
|
Set the permission set MyPermSet on behalf of my-alias.`),
|
|
57
57
|
directory: directoryParam,
|
|
58
58
|
});
|
|
59
|
-
export const
|
|
59
|
+
export const assignPermissionSet = (server) => {
|
|
60
60
|
server.tool('sf-assign-permission-set', 'Assign a permission set to one or more org users.', assignPermissionSetParamsSchema.shape, {
|
|
61
61
|
title: 'Assign Permission Set',
|
|
62
62
|
openWorldHint: false,
|
|
@@ -16,8 +16,8 @@ export declare const createOrgSnapshotParams: z.ZodObject<{
|
|
|
16
16
|
directory: string;
|
|
17
17
|
devHub: string;
|
|
18
18
|
sourceOrg: string;
|
|
19
|
-
name?: string | undefined;
|
|
20
19
|
description?: string | undefined;
|
|
20
|
+
name?: string | undefined;
|
|
21
21
|
}>;
|
|
22
22
|
export type CreateOrgSnapshotOptions = z.infer<typeof createOrgSnapshotParams>;
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const createOrgSnapshot: (server: McpServer) => void;
|
|
@@ -37,7 +37,7 @@ export const createOrgSnapshotParams = z.object({
|
|
|
37
37
|
description: z.string().describe(' Description of snapshot.').optional(),
|
|
38
38
|
name: z.string().describe('Unique name of snapshot').max(15).default(Date.now().toString().substring(0, 15)),
|
|
39
39
|
});
|
|
40
|
-
export const
|
|
40
|
+
export const createOrgSnapshot = (server) => {
|
|
41
41
|
server.tool('sf-create-org-snapshot', `Creates a new snapshot of an org
|
|
42
42
|
|
|
43
43
|
AGENT INSTRUCTIONS:
|
|
@@ -21,30 +21,30 @@ export declare const createScratchOrgParams: z.ZodObject<{
|
|
|
21
21
|
duration: number;
|
|
22
22
|
definitionFile: string;
|
|
23
23
|
async: boolean;
|
|
24
|
-
username?: string | undefined;
|
|
25
24
|
description?: string | undefined;
|
|
25
|
+
username?: string | undefined;
|
|
26
26
|
snapshot?: string | undefined;
|
|
27
27
|
alias?: string | undefined;
|
|
28
|
+
sourceOrg?: string | undefined;
|
|
28
29
|
edition?: "group" | "developer" | "enterprise" | "professional" | "partner-developer" | "partner-enterprise" | "partner-group" | "partner-professional" | undefined;
|
|
29
30
|
setDefault?: boolean | undefined;
|
|
30
|
-
sourceOrg?: string | undefined;
|
|
31
31
|
orgName?: string | undefined;
|
|
32
32
|
adminEmail?: string | undefined;
|
|
33
33
|
}, {
|
|
34
34
|
directory: string;
|
|
35
35
|
devHub: string;
|
|
36
|
-
username?: string | undefined;
|
|
37
36
|
description?: string | undefined;
|
|
37
|
+
username?: string | undefined;
|
|
38
38
|
snapshot?: string | undefined;
|
|
39
39
|
alias?: string | undefined;
|
|
40
|
+
sourceOrg?: string | undefined;
|
|
40
41
|
duration?: number | undefined;
|
|
41
42
|
edition?: "group" | "developer" | "enterprise" | "professional" | "partner-developer" | "partner-enterprise" | "partner-group" | "partner-professional" | undefined;
|
|
42
43
|
definitionFile?: string | undefined;
|
|
43
44
|
async?: boolean | undefined;
|
|
44
45
|
setDefault?: boolean | undefined;
|
|
45
|
-
sourceOrg?: string | undefined;
|
|
46
46
|
orgName?: string | undefined;
|
|
47
47
|
adminEmail?: string | undefined;
|
|
48
48
|
}>;
|
|
49
49
|
export type CreateScratchOrgOptions = z.infer<typeof createScratchOrgParams>;
|
|
50
|
-
export declare const
|
|
50
|
+
export declare const createScratchOrg: (server: McpServer) => void;
|
|
@@ -81,7 +81,7 @@ export const createScratchOrgParams = z.object({
|
|
|
81
81
|
orgName: z.string().describe('Name of the scratch org').optional(),
|
|
82
82
|
adminEmail: z.string().describe("Email address that will be applied to the org's admin user.").optional(),
|
|
83
83
|
});
|
|
84
|
-
export const
|
|
84
|
+
export const createScratchOrg = (server) => {
|
|
85
85
|
server.tool('sf-create-scratch-org', `Creates a scratch org with the specified parameters.
|
|
86
86
|
|
|
87
87
|
AGENT INSTRUCTIONS:
|
|
@@ -4,11 +4,11 @@ export declare const deleteOrgParams: z.ZodObject<{
|
|
|
4
4
|
directory: z.ZodEffects<z.ZodString, string, string>;
|
|
5
5
|
usernameOrAlias: z.ZodString;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
directory: string;
|
|
8
7
|
usernameOrAlias: string;
|
|
9
|
-
}, {
|
|
10
8
|
directory: string;
|
|
9
|
+
}, {
|
|
11
10
|
usernameOrAlias: string;
|
|
11
|
+
directory: string;
|
|
12
12
|
}>;
|
|
13
13
|
export type DeleteOrgOptions = z.infer<typeof deleteOrgParams>;
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const deleteOrg: (server: McpServer) => void;
|
|
@@ -31,7 +31,7 @@ export const deleteOrgParams = z.object({
|
|
|
31
31
|
directory: directoryParam,
|
|
32
32
|
usernameOrAlias: usernameOrAliasParam,
|
|
33
33
|
});
|
|
34
|
-
export const
|
|
34
|
+
export const deleteOrg = (server) => {
|
|
35
35
|
server.tool('sf-delete-org', `Deletes specified salesforce org.
|
|
36
36
|
|
|
37
37
|
AGENT INSTRUCTIONS:
|
|
@@ -8,20 +8,20 @@ declare const deployMetadataParams: z.ZodObject<{
|
|
|
8
8
|
usernameOrAlias: z.ZodString;
|
|
9
9
|
directory: z.ZodEffects<z.ZodString, string, string>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
directory: string;
|
|
12
11
|
usernameOrAlias: string;
|
|
12
|
+
directory: string;
|
|
13
13
|
sourceDir?: string[] | undefined;
|
|
14
14
|
manifest?: string | undefined;
|
|
15
15
|
apexTestLevel?: "NoTestRun" | "RunLocalTests" | "RunAllTestsInOrg" | undefined;
|
|
16
16
|
apexTests?: string[] | undefined;
|
|
17
17
|
}, {
|
|
18
|
-
directory: string;
|
|
19
18
|
usernameOrAlias: string;
|
|
19
|
+
directory: string;
|
|
20
20
|
sourceDir?: string[] | undefined;
|
|
21
21
|
manifest?: string | undefined;
|
|
22
22
|
apexTestLevel?: "NoTestRun" | "RunLocalTests" | "RunAllTestsInOrg" | undefined;
|
|
23
23
|
apexTests?: string[] | undefined;
|
|
24
24
|
}>;
|
|
25
25
|
export type DeployMetadata = z.infer<typeof deployMetadataParams>;
|
|
26
|
-
export declare const
|
|
26
|
+
export declare const deployMetadata: (server: SfMcpServer) => void;
|
|
27
27
|
export {};
|
|
@@ -70,7 +70,7 @@ Set this param if the user ask an Apex test to be run during deployment.
|
|
|
70
70
|
* Returns:
|
|
71
71
|
* - textResponse: Deploy result.
|
|
72
72
|
*/
|
|
73
|
-
export const
|
|
73
|
+
export const deployMetadata = (server) => {
|
|
74
74
|
server.tool('sf-deploy-metadata', `Deploy metadata to an org from your local project.
|
|
75
75
|
|
|
76
76
|
AGENT INSTRUCTIONS:
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { z } from 'zod';
|
|
17
17
|
import { textResponse } from '../../shared/utils.js';
|
|
18
|
-
import { enableTools } from '
|
|
18
|
+
import { enableTools as utilEnableTools } from './utils/tools.js';
|
|
19
19
|
const enableToolsParamsSchema = z.object({
|
|
20
20
|
tools: z.array(z.string()).describe('The names of the tools to enable'),
|
|
21
21
|
});
|
|
22
|
-
export function
|
|
22
|
+
export function enableTools(server) {
|
|
23
23
|
server.tool('sf-enable-tools', `Enable one or more of the tools the Salesforce MCP server provides.
|
|
24
24
|
|
|
25
25
|
AGENT INSTRUCTIONS:
|
|
@@ -32,7 +32,7 @@ Once you have enabled the tool, you MUST invoke that tool to accomplish the user
|
|
|
32
32
|
if (tools.length === 0) {
|
|
33
33
|
return textResponse('No tools specified to enable.', true);
|
|
34
34
|
}
|
|
35
|
-
const results = await
|
|
35
|
+
const results = await utilEnableTools(tools);
|
|
36
36
|
server.sendToolListChanged();
|
|
37
37
|
const hasError = results.some((result) => !result.success);
|
|
38
38
|
const resultMessages = results.map((result) => result.message).join('\n');
|
|
@@ -5,13 +5,13 @@ export declare const getUsernameParamsSchema: z.ZodObject<{
|
|
|
5
5
|
defaultDevHub: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
6
6
|
directory: z.ZodEffects<z.ZodString, string, string>;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
directory: string;
|
|
8
9
|
defaultTargetOrg: boolean;
|
|
9
10
|
defaultDevHub: boolean;
|
|
10
|
-
directory: string;
|
|
11
11
|
}, {
|
|
12
12
|
directory: string;
|
|
13
13
|
defaultTargetOrg?: boolean | undefined;
|
|
14
14
|
defaultDevHub?: boolean | undefined;
|
|
15
15
|
}>;
|
|
16
16
|
export type GetUsernameParamsSchema = z.infer<typeof getUsernameParamsSchema>;
|
|
17
|
-
export declare const
|
|
17
|
+
export declare const getUsername: (server: SfMcpServer) => void;
|
|
@@ -50,7 +50,7 @@ Get username for my default dev hub
|
|
|
50
50
|
...for my default devhub`),
|
|
51
51
|
directory: directoryParam,
|
|
52
52
|
});
|
|
53
|
-
export const
|
|
53
|
+
export const getUsername = (server) => {
|
|
54
54
|
server.tool('sf-get-username', `Intelligently determines the appropriate username or alias for Salesforce operations.
|
|
55
55
|
|
|
56
56
|
AGENT/LLM INSTRUCTIONS:
|
|
@@ -8,4 +8,4 @@ export declare const listAllOrgsParamsSchema: z.ZodObject<{
|
|
|
8
8
|
directory: string;
|
|
9
9
|
}>;
|
|
10
10
|
export type ListAllOrgsOptions = z.infer<typeof listAllOrgsParamsSchema>;
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const listAllOrgs: (server: McpServer) => void;
|
|
@@ -31,7 +31,7 @@ import { directoryParam } from '../../shared/params.js';
|
|
|
31
31
|
export const listAllOrgsParamsSchema = z.object({
|
|
32
32
|
directory: directoryParam,
|
|
33
33
|
});
|
|
34
|
-
export const
|
|
34
|
+
export const listAllOrgs = (server) => {
|
|
35
35
|
server.tool('sf-list-all-orgs', `Lists all configured Salesforce orgs.
|
|
36
36
|
|
|
37
37
|
AGENT INSTRUCTIONS:
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { textResponse } from '../../shared/utils.js';
|
|
17
|
-
import { listAllTools } from '
|
|
18
|
-
export function
|
|
17
|
+
import { listAllTools } from './utils/tools.js';
|
|
18
|
+
export function listTools(server) {
|
|
19
19
|
server.tool('sf-list-tools', `List all available tools this Salesforce MCP server can offer, providing the enabled status and description of each.
|
|
20
20
|
|
|
21
21
|
AGENT INSTRUCTIONS:
|
|
@@ -5,13 +5,13 @@ export declare const orgOpenParamsSchema: z.ZodObject<{
|
|
|
5
5
|
usernameOrAlias: z.ZodString;
|
|
6
6
|
directory: z.ZodEffects<z.ZodString, string, string>;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
directory: string;
|
|
9
8
|
usernameOrAlias: string;
|
|
9
|
+
directory: string;
|
|
10
10
|
filePath?: string | undefined;
|
|
11
11
|
}, {
|
|
12
|
-
directory: string;
|
|
13
12
|
usernameOrAlias: string;
|
|
13
|
+
directory: string;
|
|
14
14
|
filePath?: string | undefined;
|
|
15
15
|
}>;
|
|
16
16
|
export type OrgOpenParamsSchema = z.infer<typeof orgOpenParamsSchema>;
|
|
17
|
-
export declare const
|
|
17
|
+
export declare const orgOpen: (server: SfMcpServer) => void;
|
|
@@ -27,7 +27,7 @@ export const orgOpenParamsSchema = z.object({
|
|
|
27
27
|
usernameOrAlias: usernameOrAliasParam,
|
|
28
28
|
directory: directoryParam,
|
|
29
29
|
});
|
|
30
|
-
export const
|
|
30
|
+
export const orgOpen = (server) => {
|
|
31
31
|
server.tool('sf-org-open', `Open a Salesforce org in the browser.
|
|
32
32
|
|
|
33
33
|
You can specify a metadata file you want to open.
|
|
@@ -7,14 +7,14 @@ export declare const queryOrgParamsSchema: z.ZodObject<{
|
|
|
7
7
|
useToolingApi: z.ZodOptional<z.ZodBoolean>;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
9
|
query: string;
|
|
10
|
-
directory: string;
|
|
11
10
|
usernameOrAlias: string;
|
|
11
|
+
directory: string;
|
|
12
12
|
useToolingApi?: boolean | undefined;
|
|
13
13
|
}, {
|
|
14
14
|
query: string;
|
|
15
|
-
directory: string;
|
|
16
15
|
usernameOrAlias: string;
|
|
16
|
+
directory: string;
|
|
17
17
|
useToolingApi?: boolean | undefined;
|
|
18
18
|
}>;
|
|
19
19
|
export type QueryOrgOptions = z.infer<typeof queryOrgParamsSchema>;
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const queryOrg: (server: SfMcpServer) => void;
|
|
@@ -35,7 +35,7 @@ export const queryOrgParamsSchema = z.object({
|
|
|
35
35
|
directory: directoryParam,
|
|
36
36
|
useToolingApi: useToolingApiParam,
|
|
37
37
|
});
|
|
38
|
-
export const
|
|
38
|
+
export const queryOrg = (server) => {
|
|
39
39
|
server.tool('sf-query-org', 'Run a SOQL query against a Salesforce org.', queryOrgParamsSchema.shape, {
|
|
40
40
|
title: 'Query Org',
|
|
41
41
|
openWorldHint: false,
|
|
@@ -6,15 +6,15 @@ export declare const resumeParamsSchema: z.ZodObject<{
|
|
|
6
6
|
usernameOrAlias: z.ZodString;
|
|
7
7
|
directory: z.ZodEffects<z.ZodString, string, string>;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
usernameOrAlias: string;
|
|
9
10
|
directory: string;
|
|
10
11
|
jobId: string;
|
|
11
12
|
wait: number;
|
|
12
|
-
usernameOrAlias: string;
|
|
13
13
|
}, {
|
|
14
|
+
usernameOrAlias: string;
|
|
14
15
|
directory: string;
|
|
15
16
|
jobId: string;
|
|
16
|
-
usernameOrAlias: string;
|
|
17
17
|
wait?: number | undefined;
|
|
18
18
|
}>;
|
|
19
19
|
export type ResumeParamsSchema = z.infer<typeof resumeParamsSchema>;
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const resume: (server: McpServer) => void;
|
|
@@ -51,7 +51,7 @@ export const resumeParamsSchema = z.object({
|
|
|
51
51
|
usernameOrAlias: usernameOrAliasParam,
|
|
52
52
|
directory: directoryParam,
|
|
53
53
|
});
|
|
54
|
-
export const
|
|
54
|
+
export const resume = (server) => {
|
|
55
55
|
server.tool('sf-resume', `Resume a long running operation that was not completed by another tool.
|
|
56
56
|
|
|
57
57
|
AGENT INSTRUCTIONS:
|
|
@@ -43,7 +43,7 @@ const retrieveMetadataParams = z.object({
|
|
|
43
43
|
* Returns:
|
|
44
44
|
* - textResponse: Retrieve result.
|
|
45
45
|
*/
|
|
46
|
-
export const
|
|
46
|
+
export const retrieveMetadata = (server) => {
|
|
47
47
|
server.tool('sf-retrieve-metadata', `Retrieve metadata from an org to your local project.
|
|
48
48
|
|
|
49
49
|
AGENT INSTRUCTIONS:
|
|
@@ -2,4 +2,4 @@ import { SfMcpServer } from '../../sf-mcp-server.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Suggest a Salesforce CLI (sf) command based on user input.
|
|
4
4
|
*/
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const suggestCliCommand: (server: SfMcpServer) => void;
|
|
@@ -22,7 +22,7 @@ const suggestCliCommandParamsSchema = z.object({
|
|
|
22
22
|
/**
|
|
23
23
|
* Suggest a Salesforce CLI (sf) command based on user input.
|
|
24
24
|
*/
|
|
25
|
-
export const
|
|
25
|
+
export const suggestCliCommand = (server) => {
|
|
26
26
|
server.tool('sf-suggest-cli-command', `Suggests an \`sf\` CLI command based on a natural language query. It finds relevant commands from a local index and uses an LLM to construct the final, precise command to fulfill the user's request.
|
|
27
27
|
|
|
28
28
|
AGENT INSTRUCTIONS:
|
|
@@ -6,16 +6,16 @@ declare const runAgentTestsParam: z.ZodObject<{
|
|
|
6
6
|
directory: z.ZodEffects<z.ZodString, string, string>;
|
|
7
7
|
async: z.ZodDefault<z.ZodBoolean>;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
directory: string;
|
|
10
9
|
usernameOrAlias: string;
|
|
10
|
+
directory: string;
|
|
11
11
|
async: boolean;
|
|
12
12
|
agentApiName: string;
|
|
13
13
|
}, {
|
|
14
|
-
directory: string;
|
|
15
14
|
usernameOrAlias: string;
|
|
15
|
+
directory: string;
|
|
16
16
|
agentApiName: string;
|
|
17
17
|
async?: boolean | undefined;
|
|
18
18
|
}>;
|
|
19
19
|
export type AgentRunTests = z.infer<typeof runAgentTestsParam>;
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const testAgent: (server: SfMcpServer) => void;
|
|
21
21
|
export {};
|
|
@@ -42,7 +42,7 @@ const runAgentTestsParam = z.object({
|
|
|
42
42
|
* Returns:
|
|
43
43
|
* - textResponse: Test result.
|
|
44
44
|
*/
|
|
45
|
-
export const
|
|
45
|
+
export const testAgent = (server) => {
|
|
46
46
|
server.tool('sf-test-agents', `Run Agent tests in an org.
|
|
47
47
|
|
|
48
48
|
AGENT INSTRUCTIONS:
|
|
@@ -15,8 +15,8 @@ declare const runApexTestsParam: z.ZodObject<{
|
|
|
15
15
|
}, "strip", z.ZodTypeAny, {
|
|
16
16
|
codeCoverage: boolean;
|
|
17
17
|
testLevel: TestLevel;
|
|
18
|
-
directory: string;
|
|
19
18
|
usernameOrAlias: string;
|
|
19
|
+
directory: string;
|
|
20
20
|
async: boolean;
|
|
21
21
|
verbose: boolean;
|
|
22
22
|
classNames?: string[] | undefined;
|
|
@@ -25,8 +25,8 @@ declare const runApexTestsParam: z.ZodObject<{
|
|
|
25
25
|
testRunId?: string | undefined;
|
|
26
26
|
}, {
|
|
27
27
|
testLevel: TestLevel;
|
|
28
|
-
directory: string;
|
|
29
28
|
usernameOrAlias: string;
|
|
29
|
+
directory: string;
|
|
30
30
|
codeCoverage?: boolean | undefined;
|
|
31
31
|
async?: boolean | undefined;
|
|
32
32
|
classNames?: string[] | undefined;
|
|
@@ -36,5 +36,5 @@ declare const runApexTestsParam: z.ZodObject<{
|
|
|
36
36
|
verbose?: boolean | undefined;
|
|
37
37
|
}>;
|
|
38
38
|
export type ApexRunTests = z.infer<typeof runApexTestsParam>;
|
|
39
|
-
export declare const
|
|
39
|
+
export declare const testApex: (server: SfMcpServer) => void;
|
|
40
40
|
export {};
|
|
@@ -69,7 +69,7 @@ RunSpecifiedTests="Run the Apex tests I specify, these will be specified in the
|
|
|
69
69
|
* Returns:
|
|
70
70
|
* - textResponse: Test result.
|
|
71
71
|
*/
|
|
72
|
-
export const
|
|
72
|
+
export const testApex = (server) => {
|
|
73
73
|
server.tool('sf-test-apex', `Run Apex tests in an org.
|
|
74
74
|
|
|
75
75
|
AGENT INSTRUCTIONS:
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
/**
|
|
3
|
+
* Add a tool to the cache
|
|
4
|
+
*/
|
|
5
|
+
export declare function addTool(tool: RegisteredTool, name: string): Promise<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
message: string;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Enable an individual tool
|
|
11
|
+
*/
|
|
12
|
+
export declare function enableTool(toolName: string): Promise<{
|
|
13
|
+
success: boolean;
|
|
14
|
+
message: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function enableTools(tools: string[]): Promise<Array<{
|
|
17
|
+
success: boolean;
|
|
18
|
+
message: string;
|
|
19
|
+
}>>;
|
|
20
|
+
/**
|
|
21
|
+
* Disable an individual tool
|
|
22
|
+
*/
|
|
23
|
+
export declare function disableTool(toolName: string): Promise<{
|
|
24
|
+
success: boolean;
|
|
25
|
+
message: string;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Get individual tool status
|
|
29
|
+
*/
|
|
30
|
+
export declare function getToolStatus(toolName: string): Promise<{
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
description: string;
|
|
33
|
+
} | undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* List all individual tools with their status
|
|
36
|
+
*/
|
|
37
|
+
export declare function listAllTools(): Promise<Array<{
|
|
38
|
+
name: string;
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
description: string;
|
|
41
|
+
}>>;
|