Skip to content

Commit ce845f8

Browse files
fix: improve sf-get-username instructions W-19472383 (#181)
* fix: improve sf-get-username instructions * chore(release): mcp-provider-dx-core@0.2.2 [skip ci] * chore: bump @salesforce/mcp-provider-dx-core to 0.2.2 --no-verify Auto-update dependency after provider package publish. Related release: mcp-provider-dx-core@0.2.2 * chore(release): 0.19.1-dev.0 [skip ci] --------- Co-authored-by: svc-cli-bot <Svc_cli_bot@salesforce.com>
1 parent 7423241 commit ce845f8

File tree

6 files changed

+31
-47
lines changed

6 files changed

+31
-47
lines changed

packages/mcp-provider-dx-core/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## [0.2.2](https://github.com/salesforcecli/mcp/compare/mcp-provider-dx-core@0.2.1...mcp-provider-dx-core@0.2.2) (2025-09-02)
2+
3+
4+
### Bug Fixes
5+
6+
* improve sf-get-username instructions ([2c5a63f](https://github.com/salesforcecli/mcp/commit/2c5a63f541108fcae0dbd2f5620c7279b616bb26))
7+
8+
9+
110
## [0.2.1](https://github.com/salesforcecli/mcp/compare/mcp-provider-dx-core@0.2.0...mcp-provider-dx-core@0.2.1) (2025-08-29)
211

312

packages/mcp-provider-dx-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@salesforce/mcp-provider-dx-core",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"description": "MCP provider for core Salesforce DX functionality",
55
"types": "lib/index.d.ts",
66
"license": "Apache-2.0",

packages/mcp-provider-dx-core/src/shared/params.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ import { sanitizePath } from './utils.js';
2424
export const usernameOrAliasParam = z.string()
2525
.describe(`The username or alias for the Salesforce org to run this tool against.
2626
27-
AGENT INSTRUCTIONS:
28-
If it is not clear what username or alias is, run the #sf-get-username tool.
29-
NEVER guess or make-up a username or alias, use #sf-get-username if you are not sure.
30-
DO NOT use #sf-get-username if the user mentions an alias or username, like "for my an-alias org" or "for my test-prgelc2petd9@example.com org".
31-
32-
USAGE:
33-
...for the my-alias org
34-
...for my 'my-alias' user
35-
...for alias myAlias
36-
...for my 'test@example.com' user
37-
...for the 'test@example.com' org`);
27+
A username follows the <name@domain.com> format.
28+
If the user refers to an org with a string not following that format, it can be a valid alias.
29+
30+
IMPORTANT:
31+
- If it is not clear what the username or alias is, run the #sf-get-username tool to resolve it.
32+
- NEVER guess or make-up a username or alias.
33+
`);
3834

3935
export const useToolingApiParam = z.boolean().optional().describe('Use Tooling API for the operation');
4036

packages/mcp-provider-dx-core/src/tools/sf-get-username.ts

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,8 @@ export async function suggestUsername(orgService: OrgService): Promise<{
7878
*/
7979

8080
export const getUsernameParamsSchema = z.object({
81-
defaultTargetOrg: z.boolean().optional().default(false).describe(`Try to find default org
82-
AGENT INSTRUCTIONS:
83-
ONLY SET TO TRUE when the user explicitly asks for the default org or default target org.
84-
Leave it as false when the user is vague and says something like "for my org" or "for my-alias".
85-
86-
USAGE EXAMPLE:
87-
Get username for my default org
88-
...for my default target org`),
89-
defaultDevHub: z.boolean().optional().default(false).describe(`Try to find default dev hub
90-
AGENT INSTRUCTIONS:
91-
ONLY SET TO TRUE when the user explicitly asks for the default dev hub or default target devhub.
92-
Leave it as false when the user is vague and says something like "for my org" or "for my-alias".
93-
94-
USAGE EXAMPLE:
95-
Get username for my default dev hub
96-
...for my default target dev hub
97-
...for my default devhub`),
81+
defaultTargetOrg: z.boolean().optional().default(false).describe('Resolve the default target org username'),
82+
defaultDevHub: z.boolean().optional().default(false).describe('Resolve the default target devhub org username'),
9883
directory: directoryParam,
9984
});
10085

@@ -124,23 +109,13 @@ export class GetUsernameMcpTool extends McpTool<InputArgsShape, OutputArgsShape>
124109
title: 'Get Username',
125110
description: `Intelligently determines the appropriate username or alias for Salesforce operations.
126111
127-
AGENT/LLM INSTRUCTIONS:
128-
Use this tool when uncertain which username/org a user wants for Salesforce operations.
129-
This tool handles three distinct scenarios:
112+
WHEN TO USE THIS TOOL:
113+
- When uncertain which org username a user wants for Salesforce operations.
130114
131-
1. When defaultTargetOrg=true: Fetches the default target org configuration
132-
- Use when user says "for my default org" or "for my default target org"
133-
134-
2. When defaultDevHub=true: Fetches the default dev hub configuration
135-
- Use when user says "for my default dev hub" or "for my default target dev hub"
136-
137-
3. When both are false (default): Uses suggestUsername to intelligently determine the appropriate org
138-
- Use when user is vague and says something like "for my org" or doesn't specify
139-
140-
EXAMPLE USAGE:
141-
- When user says "Do X for my org" → defaultTargetOrg=false, defaultDevHub=false
142-
- When user says "For my default org" → defaultTargetOrg=true
143-
- When user says "For my default dev hub" → defaultDevHub=true`,
115+
To resolve the default org username, set the defaultTargetOrg param to true and defaultDevHub to false.
116+
To resole the default devhub org username, set the defaultTargetOrg param to false and defaultDevHub to true.
117+
If it's not clear which type of org to resolve, set both defaultTargetOrg and defaultDevHub to false to an allow-listed org username available.
118+
`,
144119
inputSchema: getUsernameParamsSchema.shape,
145120
outputSchema: undefined,
146121
annotations: {

packages/mcp/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [0.19.1-dev.0](https://github.com/salesforcecli/mcp/compare/0.19.0...0.19.1-dev.0) (2025-09-02)
2+
3+
4+
15
# [0.19.0](https://github.com/salesforcecli/mcp/compare/0.18.0...0.19.0) (2025-08-29)
26

37

packages/mcp/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@salesforce/mcp",
3-
"version": "0.19.0",
3+
"version": "0.19.1-dev.0",
44
"description": "MCP Server for interacting with Salesforce instances",
55
"bin": {
66
"sf-mcp-server": "bin/run.js"
@@ -48,7 +48,7 @@
4848
"@salesforce/core": "^8.18.0",
4949
"@salesforce/kit": "^3.1.6",
5050
"@salesforce/mcp-provider-api": "0.2.0",
51-
"@salesforce/mcp-provider-dx-core": "0.2.1",
51+
"@salesforce/mcp-provider-dx-core": "0.2.2",
5252
"@salesforce/mcp-provider-code-analyzer": "0.0.2",
5353
"@salesforce/source-deploy-retrieve": "^12.22.0",
5454
"@salesforce/source-tracking": "^7.4.8",

0 commit comments

Comments
 (0)