@salesforce/mcp 0.11.4 → 0.13.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,31 @@
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
+ import { textResponse } from '../../shared/utils.js';
17
+ import { listAllTools } from '../../shared/tools.js';
18
+ export function registerToolListTools(server) {
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
+
21
+ AGENT INSTRUCTIONS:
22
+ Use this when a task could be achieved with a MCP tool and the currently available tools aren't enough.
23
+ If there's a tool that can accomplish the user's request, do not use this tool.
24
+ Once you find the tool you want to enable, call sf-enable-tool with the tool name.
25
+ Once you have enabled the tool, you can invoke the tool to accomplish the user's request.`, {
26
+ title: 'List all individual tools',
27
+ readOnlyHint: true,
28
+ openWorldHint: false,
29
+ }, async () => textResponse(JSON.stringify(await listAllTools(), null, 2)));
30
+ }
31
+ //# sourceMappingURL=sf-list-tools.js.map
@@ -1 +1,2 @@
1
1
  export * from './sf-list-all-orgs.js';
2
+ export * from './sf-org-open.js';
@@ -14,4 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export * from './sf-list-all-orgs.js';
17
+ export * from './sf-org-open.js';
17
18
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { SfMcpServer } from '../../sf-mcp-server.js';
3
+ export declare const orgOpenParamsSchema: z.ZodObject<{
4
+ filePath: z.ZodOptional<z.ZodString>;
5
+ usernameOrAlias: z.ZodString;
6
+ directory: z.ZodEffects<z.ZodString, string, string>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ directory: string;
9
+ usernameOrAlias: string;
10
+ filePath?: string | undefined;
11
+ }, {
12
+ directory: string;
13
+ usernameOrAlias: string;
14
+ filePath?: string | undefined;
15
+ }>;
16
+ export type OrgOpenParamsSchema = z.infer<typeof orgOpenParamsSchema>;
17
+ export declare const registerToolOrgOpen: (server: SfMcpServer) => void;
@@ -0,0 +1,57 @@
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
+ import { z } from 'zod';
17
+ import { Org } from '@salesforce/core';
18
+ import { MetadataResolver } from '@salesforce/source-deploy-retrieve';
19
+ import open from 'open';
20
+ import { textResponse } from '../../shared/utils.js';
21
+ import { directoryParam, usernameOrAliasParam } from '../../shared/params.js';
22
+ export const orgOpenParamsSchema = z.object({
23
+ filePath: z
24
+ .string()
25
+ .optional()
26
+ .describe('File path of the metadata to open. This should be an existent file path in the project.'),
27
+ usernameOrAlias: usernameOrAliasParam,
28
+ directory: directoryParam,
29
+ });
30
+ export const registerToolOrgOpen = (server) => {
31
+ server.tool('sf-org-open', `Open a Salesforce org in the browser.
32
+
33
+ You can specify a metadata file you want to open.
34
+ `, orgOpenParamsSchema.shape, {
35
+ title: 'Open Org in Browser',
36
+ readOnlyHint: true,
37
+ openWorldHint: false,
38
+ }, async ({ usernameOrAlias, filePath, directory }) => {
39
+ process.chdir(directory);
40
+ const org = await Org.create({
41
+ aliasOrUsername: usernameOrAlias,
42
+ });
43
+ if (filePath) {
44
+ const metadataResolver = new MetadataResolver();
45
+ const components = metadataResolver.getComponentsFromPath(filePath);
46
+ const typeName = components[0]?.type?.name;
47
+ const metadataBuilderUrl = await org.getMetadataUIURL(typeName, filePath);
48
+ await open(metadataBuilderUrl);
49
+ return textResponse(metadataBuilderUrl.includes('FlexiPageList')
50
+ ? "Opened the org in your browser. This metadata file doesn't have a builder UI, opened Lightning App Builder instead."
51
+ : 'Opened this metadata in your browser');
52
+ }
53
+ await open(await org.getFrontDoorUrl());
54
+ return textResponse('Opened the org in your browser.');
55
+ });
56
+ };
57
+ //# sourceMappingURL=sf-org-open.js.map