@salesforce/b2c-dx-mcp 1.3.3 → 1.4.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.
@@ -9,26 +9,30 @@ import { getRegistry } from './session-registry.js';
9
9
  export function createDebugListSessionsTool(loadServices, serverContext) {
10
10
  return createToolAdapter({
11
11
  name: 'debug_list_sessions',
12
- description: 'List active script debugger sessions with their breakpoints and any halted threads. ' +
13
- 'Use this to discover orphaned sessions, check whether breakpoints are armed, and poll for halted threads in the non-blocking debug workflow.',
12
+ description: 'List active script debugger sessions with their breakpoints, any halted threads, and the session_cookie (e.g. dwsid). ' +
13
+ 'Use this to discover orphaned sessions, check whether breakpoints are armed, poll for halted threads in the non-blocking debug workflow, and retrieve the session cookie to pin a triggering request (Cookie: <name>=<value>) to the app server holding the session.',
14
14
  toolsets: ['CARTRIDGES', 'DIAGNOSTICS', 'SCAPI'],
15
15
  inputSchema: {},
16
16
  async execute(_args, context) {
17
17
  const registry = getRegistry(context);
18
18
  const entries = registry.listSessions();
19
19
  return {
20
- sessions: entries.map((entry) => ({
21
- session_id: entry.sessionId,
22
- hostname: entry.hostname,
23
- client_id: entry.clientId,
24
- halted_threads: entry.manager
25
- .getKnownThreads()
26
- .filter((t) => t.status === 'halted')
27
- .map((t) => t.id),
28
- breakpoints: entry.breakpoints.map((bp) => projectBreakpoint(bp, entry.sourceMapper)),
29
- created_at: new Date(entry.createdAt).toISOString(),
30
- last_activity_at: new Date(entry.lastActivityAt).toISOString(),
31
- })),
20
+ sessions: entries.map((entry) => {
21
+ const dwsid = entry.manager.getSessionCookie();
22
+ return {
23
+ session_id: entry.sessionId,
24
+ hostname: entry.hostname,
25
+ client_id: entry.clientId,
26
+ halted_threads: entry.manager
27
+ .getKnownThreads()
28
+ .filter((t) => t.status === 'halted')
29
+ .map((t) => t.id),
30
+ breakpoints: entry.breakpoints.map((bp) => projectBreakpoint(bp, entry.sourceMapper)),
31
+ session_cookie: dwsid ? { name: 'dwsid', value: dwsid } : null,
32
+ created_at: new Date(entry.createdAt).toISOString(),
33
+ last_activity_at: new Date(entry.lastActivityAt).toISOString(),
34
+ };
35
+ }),
32
36
  };
33
37
  },
34
38
  formatOutput: (output) => jsonResult(output),
@@ -13,6 +13,7 @@ export function createDebugStartSessionTool(loadServices, serverContext) {
13
13
  name: 'debug_start_session',
14
14
  description: 'Start a script debugger session on a B2C Commerce instance to debug SFRA controllers, custom API scripts, hooks, jobs, or any server-side script. ' +
15
15
  'Returns a session_id for use with other debug tools, plus discovered cartridge mappings. ' +
16
+ 'Also returns session_cookie (e.g. dwsid): to reliably hit a breakpoint on a multi-app-server instance, send the request that triggers your code (storefront page load, SCAPI/OCAPI call) with this cookie (Cookie: <name>=<value>) so it lands on the same app server holding the debug session. ' +
16
17
  'WARNING: Debug sessions halt remote request threads on the instance. Always call debug_end_session when finished. ' +
17
18
  'Requires Basic auth credentials (username/password) and the script debugger enabled in Business Manager.',
18
19
  toolsets: ['CARTRIDGES', 'DIAGNOSTICS', 'SCAPI'],
@@ -60,11 +61,16 @@ export function createDebugStartSessionTool(loadServices, serverContext) {
60
61
  const cartridgeMappings = {};
61
62
  for (const c of cartridges)
62
63
  cartridgeMappings[c.name] = c.src;
64
+ const dwsid = manager.getSessionCookie();
65
+ if (!dwsid) {
66
+ warnings.push('No session cookie (dwsid) was returned by the debugger. Requests cannot be pinned to this app server; breakpoints may not be hit on multi-app-server instances.');
67
+ }
63
68
  return {
64
69
  session_id: entry.sessionId,
65
70
  hostname,
66
71
  cartridges: cartridges.map((c) => c.name),
67
72
  cartridge_mappings: cartridgeMappings,
73
+ session_cookie: dwsid ? { name: 'dwsid', value: dwsid } : null,
68
74
  warnings,
69
75
  };
70
76
  },
@@ -420,5 +420,5 @@
420
420
  "enableJsonFlag": false
421
421
  }
422
422
  },
423
- "version": "1.3.3"
423
+ "version": "1.4.1"
424
424
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/b2c-dx-mcp",
3
3
  "description": "MCP server for B2C Commerce developer experience tools",
4
- "version": "1.3.3",
4
+ "version": "1.4.1",
5
5
  "author": "Salesforce",
6
6
  "license": "Apache-2.0",
7
7
  "repository": "SalesforceCommerceCloud/b2c-developer-tooling",
@@ -80,7 +80,7 @@
80
80
  "yaml": "2.9.0",
81
81
  "postcss": "8.5.15",
82
82
  "zod": "3.25.76",
83
- "@salesforce/b2c-tooling-sdk": "1.15.1"
83
+ "@salesforce/b2c-tooling-sdk": "1.17.0"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@eslint/compat": "^1",