@smartbear/mcp 0.42.0 → 0.44.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.
Files changed (56) hide show
  1. package/dist/bearq/api.js +16 -0
  2. package/dist/bearq/client.js +9 -1
  3. package/dist/bearq/tool/tasks/stop-task.js +6 -3
  4. package/dist/bearq/tool/workflows/get-workflow-run.js +31 -0
  5. package/dist/bearq/tool/workflows/list-workflows.js +28 -0
  6. package/dist/bearq/tool/workflows/run-workflow.js +57 -0
  7. package/dist/bearq/tool/workflows/stop-workflow-run.js +33 -0
  8. package/dist/bugsnag/client.js +14 -2
  9. package/dist/common/config-names.js +12 -0
  10. package/dist/common/info.js +2 -0
  11. package/dist/common/list-integrations.js +53 -0
  12. package/dist/common/server.js +64 -2
  13. package/dist/common/transport-http.js +100 -33
  14. package/dist/common/transport-stdio.js +1 -6
  15. package/dist/package.json.js +1 -1
  16. package/dist/pactflow/client/admin-api.js +3 -8
  17. package/dist/pactflow/client/ai.js +34 -0
  18. package/dist/pactflow/client/contract-api.js +2 -0
  19. package/dist/pactflow/client/http-client.js +7 -2
  20. package/dist/pactflow/client/pacticipant-api.js +37 -0
  21. package/dist/pactflow/client/schemas/admin.js +799 -0
  22. package/dist/pactflow/client/schemas/common.js +201 -0
  23. package/dist/pactflow/client/schemas/contract.js +444 -0
  24. package/dist/pactflow/client/schemas/environment.js +94 -0
  25. package/dist/pactflow/client/schemas/output.js +55 -0
  26. package/dist/pactflow/client/schemas/pacticipant.js +290 -0
  27. package/dist/pactflow/client/schemas/webhook.js +164 -0
  28. package/dist/pactflow/client/tools.js +32 -1
  29. package/dist/pactflow/client.js +21 -3
  30. package/dist/qmetry/client/ai-agent.js +3 -0
  31. package/dist/qmetry/client/api/error-handler.js +7 -2
  32. package/dist/qmetry/client/auto-resolve.js +5 -0
  33. package/dist/qmetry/client/handlers.js +2 -1
  34. package/dist/qmetry/client/project.js +19 -1
  35. package/dist/qmetry/client/testsuite.js +207 -2
  36. package/dist/qmetry/client/tools/ai-agent-tools.js +13 -0
  37. package/dist/qmetry/client/tools/issue-tools.js +7 -3
  38. package/dist/qmetry/client/tools/project-tools.js +34 -1
  39. package/dist/qmetry/client/tools/testcase-tools.js +43 -296
  40. package/dist/qmetry/client/tools/testsuite-tools.js +49 -19
  41. package/dist/qmetry/client/udf.js +14 -2
  42. package/dist/qmetry/client.js +2 -1
  43. package/dist/qmetry/config/constants.js +1 -0
  44. package/dist/qmetry/config/rest-endpoints.js +2 -1
  45. package/dist/qmetry/types/ai-agent.js +3 -0
  46. package/dist/qmetry/types/common.js +40 -2
  47. package/dist/qmetry/types/udf.js +1 -20
  48. package/dist/swagger/client/portal-types.js +11 -5
  49. package/dist/swagger/client/registry-types.js +5 -4
  50. package/dist/swagger/client/tools.js +1 -1
  51. package/dist/zephyr/tool/test-case/create-web-link.js +17 -2
  52. package/dist/zephyr/tool/test-cycle/create-web-link.js +18 -2
  53. package/package.json +4 -2
  54. package/plugin/README.md +42 -0
  55. package/src/pactflow/drift/README.md +91 -0
  56. package/dist/pactflow/client/base.js +0 -488
@@ -0,0 +1,16 @@
1
+ async function toProblemDetail(res) {
2
+ try {
3
+ const body = await res.json();
4
+ return typeof body.detail === "string" && body.detail ? body.detail : null;
5
+ } catch {
6
+ return null;
7
+ }
8
+ }
9
+ async function problemSuffix(res) {
10
+ const detail = await toProblemDetail(res);
11
+ return detail ? ` — ${detail}` : "";
12
+ }
13
+ export {
14
+ problemSuffix,
15
+ toProblemDetail
16
+ };
@@ -14,6 +14,10 @@ import { RunTestCases } from "./tool/tasks/run-test-cases.js";
14
14
  import { RunTestsInFunctionalAreas } from "./tool/tasks/run-tests-in-functional-areas.js";
15
15
  import { StopTask } from "./tool/tasks/stop-task.js";
16
16
  import { WaitForTask } from "./tool/tasks/wait-for-task.js";
17
+ import { GetWorkflowRun } from "./tool/workflows/get-workflow-run.js";
18
+ import { ListWorkflows } from "./tool/workflows/list-workflows.js";
19
+ import { RunWorkflow } from "./tool/workflows/run-workflow.js";
20
+ import { StopWorkflowRun } from "./tool/workflows/stop-workflow-run.js";
17
21
  const ConfigurationSchema = z.object({
18
22
  api_token: z.string().describe("BearQ workspace API token (Bearer)."),
19
23
  api_base_url: z.string().optional().describe(
@@ -67,7 +71,11 @@ class BearQClient {
67
71
  new GetTaskStatus(this),
68
72
  new StopTask(this),
69
73
  new WaitForTask(this),
70
- new ListEnvironments(this)
74
+ new ListEnvironments(this),
75
+ new ListWorkflows(this),
76
+ new RunWorkflow(this),
77
+ new GetWorkflowRun(this),
78
+ new StopWorkflowRun(this)
71
79
  ];
72
80
  for (const tool of tools) {
73
81
  register(tool.specification, tool.handle);
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { Tool, ToolError } from "../../../common/tools.js";
3
+ import { problemSuffix } from "../../api.js";
3
4
  const inputSchema = z.object({
4
5
  taskId: z.number().int().positive().describe("BearQ task ID to cancel.")
5
6
  });
@@ -7,7 +8,7 @@ class StopTask extends Tool {
7
8
  specification = {
8
9
  title: "Stop Task",
9
10
  toolset: "Tasks",
10
- summary: "Cancels a running task.",
11
+ summary: "Cancels a pending or running task, returning { taskId, stopped: true }. The public API accepts a stop of an already-finished task as a success no-op, so this does not guarantee the task was running — check the task's status separately if that matters.",
11
12
  inputSchema
12
13
  };
13
14
  handle = async (args) => {
@@ -18,10 +19,12 @@ class StopTask extends Tool {
18
19
  });
19
20
  if (!res.ok)
20
21
  throw new ToolError(
21
- `DELETE /tasks/${taskId} failed: ${res.status} ${res.statusText}`
22
+ `DELETE /tasks/${taskId} failed: ${res.status} ${res.statusText}` + await problemSuffix(res)
22
23
  );
23
24
  return {
24
- content: [{ type: "text", text: JSON.stringify(await res.json()) }]
25
+ content: [
26
+ { type: "text", text: JSON.stringify({ taskId, stopped: true }) }
27
+ ]
25
28
  };
26
29
  };
27
30
  }
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ import { Tool, ToolError } from "../../../common/tools.js";
3
+ const inputSchema = z.object({
4
+ runId: z.number().int().positive().describe("BearQ workflow run ID.")
5
+ });
6
+ class GetWorkflowRun extends Tool {
7
+ specification = {
8
+ title: "Get Workflow Run",
9
+ toolset: "Workflows",
10
+ summary: "Retrieves a workflow run's current status, per-step progress, and stats (tasks, tests, discovery, ACUs). Returns immediately with whatever's available — does not block on the run completing.",
11
+ inputSchema,
12
+ readOnly: true
13
+ };
14
+ handle = async (args) => {
15
+ const { runId } = inputSchema.parse(args);
16
+ const res = await fetch(
17
+ `${this.client.getBaseUrl()}/workflow-runs/${runId}`,
18
+ { method: "GET", headers: this.client.getHeaders() }
19
+ );
20
+ if (!res.ok)
21
+ throw new ToolError(
22
+ `GET /workflow-runs/${runId} failed: ${res.status} ${res.statusText}`
23
+ );
24
+ return {
25
+ content: [{ type: "text", text: JSON.stringify(await res.json()) }]
26
+ };
27
+ };
28
+ }
29
+ export {
30
+ GetWorkflowRun
31
+ };
@@ -0,0 +1,28 @@
1
+ import { z } from "zod";
2
+ import { Tool, ToolError } from "../../../common/tools.js";
3
+ const inputSchema = z.object({});
4
+ class ListWorkflows extends Tool {
5
+ specification = {
6
+ title: "List Workflows",
7
+ toolset: "Workflows",
8
+ summary: "Lists the workflows in the workspace — each with its id, name, description, steps, and last run. Workspaces with more than 100 workflows are truncated; the response's totalCount says how many exist.",
9
+ inputSchema,
10
+ readOnly: true
11
+ };
12
+ handle = async (_args) => {
13
+ const res = await fetch(`${this.client.getBaseUrl()}/workflows?size=100`, {
14
+ method: "GET",
15
+ headers: this.client.getHeaders()
16
+ });
17
+ if (!res.ok)
18
+ throw new ToolError(
19
+ `GET /workflows failed: ${res.status} ${res.statusText}`
20
+ );
21
+ return {
22
+ content: [{ type: "text", text: JSON.stringify(await res.json()) }]
23
+ };
24
+ };
25
+ }
26
+ export {
27
+ ListWorkflows
28
+ };
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ import { Tool, ToolError } from "../../../common/tools.js";
3
+ const inputSchema = z.object({
4
+ workflow: z.string().min(1).describe(
5
+ "Workflow to run: its name (case-insensitive) or its numeric workflow ID."
6
+ )
7
+ });
8
+ async function resolveWorkflowId(client, workflow) {
9
+ if (/^\d+$/.test(workflow)) return Number(workflow);
10
+ const names = [];
11
+ for (let page = 1; ; page++) {
12
+ const res = await fetch(
13
+ `${client.getBaseUrl()}/workflows?page=${page}&size=100`,
14
+ { method: "GET", headers: client.getHeaders() }
15
+ );
16
+ if (!res.ok)
17
+ throw new ToolError(
18
+ `GET /workflows failed: ${res.status} ${res.statusText}`
19
+ );
20
+ const body = await res.json();
21
+ const match = body.workflows.find(
22
+ (candidate) => candidate.name.toLowerCase() === workflow.toLowerCase().trim()
23
+ );
24
+ if (match) return match.id;
25
+ names.push(...body.workflows.map((candidate) => candidate.name));
26
+ if (body.workflows.length === 0 || names.length >= body.totalCount) break;
27
+ }
28
+ throw new ToolError(
29
+ `No BearQ workflow named "${workflow}". Available workflows: ${names.join(", ") || "(none)"}`
30
+ );
31
+ }
32
+ class RunWorkflow extends Tool {
33
+ specification = {
34
+ title: "Run Workflow",
35
+ toolset: "Workflows",
36
+ summary: "Starts a run of a BearQ workflow now and returns the run (id, status, timestamps). If a run of that workflow is already in flight, no new run is started and the in-flight run is returned with started: false. Poll the run's progress with bearq_get_workflow_run.",
37
+ inputSchema
38
+ };
39
+ handle = async (args) => {
40
+ const { workflow } = inputSchema.parse(args);
41
+ const workflowId = await resolveWorkflowId(this.client, workflow);
42
+ const res = await fetch(
43
+ `${this.client.getBaseUrl()}/workflows/${workflowId}/runs`,
44
+ { method: "POST", headers: this.client.getHeaders() }
45
+ );
46
+ if (!res.ok)
47
+ throw new ToolError(
48
+ `POST /workflows/${workflowId}/runs failed: ${res.status} ${res.statusText}`
49
+ );
50
+ return {
51
+ content: [{ type: "text", text: JSON.stringify(await res.json()) }]
52
+ };
53
+ };
54
+ }
55
+ export {
56
+ RunWorkflow
57
+ };
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ import { Tool, ToolError } from "../../../common/tools.js";
3
+ import { problemSuffix } from "../../api.js";
4
+ const inputSchema = z.object({
5
+ runId: z.number().int().positive().describe("BearQ workflow run ID to cancel.")
6
+ });
7
+ class StopWorkflowRun extends Tool {
8
+ specification = {
9
+ title: "Stop Workflow Run",
10
+ toolset: "Workflows",
11
+ summary: "Cancels a workflow run that is in flight, returning { runId, cancelled: true }. Fails with an error when the run has already finished or does not exist.",
12
+ inputSchema
13
+ };
14
+ handle = async (args) => {
15
+ const { runId } = inputSchema.parse(args);
16
+ const res = await fetch(
17
+ `${this.client.getBaseUrl()}/workflow-runs/${runId}`,
18
+ { method: "DELETE", headers: this.client.getHeaders() }
19
+ );
20
+ if (!res.ok)
21
+ throw new ToolError(
22
+ `DELETE /workflow-runs/${runId} failed: ${res.status} ${res.statusText}` + await problemSuffix(res)
23
+ );
24
+ return {
25
+ content: [
26
+ { type: "text", text: JSON.stringify({ runId, cancelled: true }) }
27
+ ]
28
+ };
29
+ };
30
+ }
31
+ export {
32
+ StopWorkflowRun
33
+ };
@@ -2,7 +2,7 @@ import { createHmac } from "node:crypto";
2
2
  import { z } from "zod";
3
3
  import { CacheService } from "../common/cache.js";
4
4
  import { getUserAgent } from "../common/info.js";
5
- import { getRequestHeader } from "../common/request-context.js";
5
+ import { getRequestContext, getRequestHeader } from "../common/request-context.js";
6
6
  import { ToolError } from "../common/tools.js";
7
7
  import { CurrentUserAPI } from "./client/api/CurrentUser.js";
8
8
  import { Configuration } from "./client/api/configuration.js";
@@ -138,9 +138,21 @@ class BugsnagClient {
138
138
  config.endpoint
139
139
  );
140
140
  this._projectApiKey = config.project_api_key;
141
- this._authToken = config.auth_token;
141
+ this._authToken = this.isOperatorToken(config.auth_token) ? config.auth_token : void 0;
142
142
  await this.initializeApis(config);
143
143
  }
144
+ // A session identifier is not a credential, so a token a caller presented while
145
+ // opening an HTTP session must not outlive that request. Only a process-level
146
+ // token (stdio, or the operator's env var) may serve later requests.
147
+ isOperatorToken(token) {
148
+ if (!token) {
149
+ return false;
150
+ }
151
+ if (!getRequestContext()) {
152
+ return true;
153
+ }
154
+ return token === process.env.BUGSNAG_AUTH_TOKEN;
155
+ }
144
156
  getProjectApiKey() {
145
157
  const contextHeader = getRequestHeader("Bugsnag-Project-Api-Key");
146
158
  const requestProjectApiKey = Array.isArray(contextHeader) ? contextHeader[0] : contextHeader;
@@ -0,0 +1,12 @@
1
+ function getEnvVarName(clientPrefix, key) {
2
+ return `${clientPrefix.toUpperCase().replace(/-/g, "_")}_${key.toUpperCase()}`;
3
+ }
4
+ function getHeaderName(clientPrefix, key) {
5
+ return `${clientPrefix}-${key.split("_").map(
6
+ (part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()
7
+ ).join("-")}`;
8
+ }
9
+ export {
10
+ getEnvVarName,
11
+ getHeaderName
12
+ };
@@ -2,6 +2,7 @@ import packageJson from "../package.json.js";
2
2
  import { getCurrentClientIdentity } from "./client-identity.js";
3
3
  const MCP_SERVER_NAME = packageJson.config.mcpServerName;
4
4
  const MCP_SERVER_VERSION = packageJson.version;
5
+ const MCP_SERVER_INSTRUCTIONS = "SmartBear MCP Server: debugging and monitoring (BugSnag), API design and contract testing (Swagger, PactFlow), test management and execution (QMetry, QTM4J, Zephyr, Reflect, BearQ), and code review (Collaborator). Only tools for products with valid, configured credentials are registered. Call smartbear_list_integrations to see what's active and what each unconfigured product needs.";
5
6
  const MCP_TRANSPORT = process.env.MCP_TRANSPORT?.toLowerCase().trim() || "stdio";
6
7
  const USER_AGENT = `${MCP_SERVER_NAME}/${MCP_SERVER_VERSION} ${MCP_TRANSPORT}`;
7
8
  function sanitizeUserAgentToken(value) {
@@ -22,6 +23,7 @@ function getUserAgent() {
22
23
  return appendClientIdentity(USER_AGENT);
23
24
  }
24
25
  export {
26
+ MCP_SERVER_INSTRUCTIONS,
25
27
  MCP_SERVER_NAME,
26
28
  MCP_SERVER_VERSION,
27
29
  MCP_TRANSPORT,
@@ -0,0 +1,53 @@
1
+ import { clientRegistry } from "./client-registry.js";
2
+ import { getHeaderName, getEnvVarName } from "./config-names.js";
3
+ import { getTypeDescription, isOptionalType } from "./zod-utils.js";
4
+ const LIST_INTEGRATIONS_TOOL_NAME = "smartbear_list_integrations";
5
+ const INTEGRATION_DESCRIPTIONS = {
6
+ BugSnag: "Error monitoring and stability data for your applications.",
7
+ Swagger: "API design, hosting and governance with SwaggerHub.",
8
+ "Contract Testing": "Consumer-driven contract testing and can-i-deploy checks with PactFlow.",
9
+ QMetry: "Test case management and execution with QMetry.",
10
+ QTM4J: "Test case management and execution in Jira with QMetry QTM4J.",
11
+ Zephyr: "Test case management and execution tracking.",
12
+ Reflect: "No-code web test automation and test runs.",
13
+ BearQ: "AI-driven test creation and execution.",
14
+ Collaborator: "Peer code and document review."
15
+ };
16
+ function buildIntegrationsReport(server) {
17
+ const added = server.getClients();
18
+ const integrations = clientRegistry.getAll().map((catalogClient) => {
19
+ const product = catalogClient.name;
20
+ const description = INTEGRATION_DESCRIPTIONS[product] ?? "No description available.";
21
+ const active = added.find((c) => c.name === product);
22
+ if (active?.isConfigured()) {
23
+ const toolsets = server.getToolsetStats(product);
24
+ return {
25
+ product,
26
+ description,
27
+ configured: true,
28
+ toolCount: toolsets.reduce(
29
+ (sum, ts) => sum + (ts.enabled ? ts.toolCount : 0),
30
+ 0
31
+ ),
32
+ toolsets
33
+ };
34
+ }
35
+ return {
36
+ product,
37
+ description,
38
+ configured: false,
39
+ setup: Object.entries(catalogClient.config.shape).map(([key, type]) => ({
40
+ envVar: getEnvVarName(catalogClient.configPrefix, key),
41
+ header: getHeaderName(catalogClient.configPrefix, key),
42
+ required: !isOptionalType(type),
43
+ description: getTypeDescription(type) ?? ""
44
+ }))
45
+ };
46
+ });
47
+ return { integrations };
48
+ }
49
+ export {
50
+ INTEGRATION_DESCRIPTIONS,
51
+ LIST_INTEGRATIONS_TOOL_NAME,
52
+ buildIntegrationsReport
53
+ };
@@ -4,7 +4,8 @@ import Bugsnag from "./bugsnag.js";
4
4
  import { errorTypeOf, trackToolCalled } from "./analytics.js";
5
5
  import { isCachingEnabled, CacheService, getConfiguredCacheTtlSeconds } from "./cache.js";
6
6
  import { toClientIdentity, getCurrentClientIdentity } from "./client-identity.js";
7
- import { MCP_SERVER_VERSION, MCP_SERVER_NAME } from "./info.js";
7
+ import { MCP_SERVER_VERSION, MCP_SERVER_NAME, MCP_SERVER_INSTRUCTIONS } from "./info.js";
8
+ import { LIST_INTEGRATIONS_TOOL_NAME, buildIntegrationsReport } from "./list-integrations.js";
8
9
  import { runWithElicitationScope, InputRequiredSignal, executeElicitationOrPolyfill, isElicitationPolyfillResult } from "./pollyfills.js";
9
10
  import { getRequestEra, getRequestClientMeta } from "./request-context.js";
10
11
  import { ToolError } from "./tools.js";
@@ -30,6 +31,8 @@ class SmartBearMcpServer extends McpServer {
30
31
  enabledToolsets;
31
32
  mcpClientIdentity;
32
33
  analyticsSession;
34
+ /** Per client name: every tool the client offered, bucketed by toolset. */
35
+ toolsetStats = /* @__PURE__ */ new Map();
33
36
  constructor(enabledToolsets, era = "legacy") {
34
37
  super(
35
38
  {
@@ -37,6 +40,8 @@ class SmartBearMcpServer extends McpServer {
37
40
  version: MCP_SERVER_VERSION
38
41
  },
39
42
  {
43
+ // Static text, identical for every session, era and transport.
44
+ instructions: MCP_SERVER_INSTRUCTIONS,
40
45
  capabilities: era === "modern" ? {
41
46
  // resources and prompts are supported by some but not all clients.
42
47
  // No `logging`: deprecated by SEP-2577 as of 2026-07-28 (our
@@ -69,6 +74,48 @@ class SmartBearMcpServer extends McpServer {
69
74
  if (enabledToolsets) {
70
75
  this.enabledToolsets = enabledToolsets.split(",").map((s) => s.trim().toLowerCase());
71
76
  }
77
+ this.registerListIntegrationsTool();
78
+ }
79
+ /**
80
+ * Registered unconditionally (not via addClient) so it exists even when no
81
+ * product is configured. Reads only in-memory metadata, so it never needs
82
+ * credentials and never throws a ToolError for missing configuration.
83
+ */
84
+ registerListIntegrationsTool() {
85
+ this.registerTool(
86
+ LIST_INTEGRATIONS_TOOL_NAME,
87
+ {
88
+ title: "SmartBear: List Integrations",
89
+ description: "Lists every SmartBear product this server supports, whether it is configured for this connection, and for unconfigured products the environment variable or HTTP header each setting needs. Only products allowed by the server's MCP_CLIENTS setting are listed. Products that accept per-request OAuth tokens (BearQ, Reflect, QMetry) always show as configured. Takes no parameters.",
90
+ inputSchema: z.object({}),
91
+ annotations: {
92
+ title: "SmartBear: List Integrations",
93
+ readOnlyHint: true,
94
+ destructiveHint: false,
95
+ idempotentHint: true,
96
+ openWorldHint: false
97
+ }
98
+ },
99
+ async () => ({
100
+ content: [
101
+ {
102
+ type: "text",
103
+ text: JSON.stringify(buildIntegrationsReport(this), null, 2)
104
+ }
105
+ ]
106
+ })
107
+ );
108
+ }
109
+ /**
110
+ * Toolset breakdown for a client: the full potential tool count per toolset
111
+ * and whether the toolset is enabled (so hidden tools are visible).
112
+ */
113
+ getToolsetStats(clientName) {
114
+ return [...this.toolsetStats.get(clientName) ?? []].map(([name, { total, enabled }]) => ({
115
+ name,
116
+ toolCount: total,
117
+ enabled: enabled > 0
118
+ })).sort((a, b) => a.name.localeCompare(b.name));
72
119
  }
73
120
  getCache() {
74
121
  return this.cache;
@@ -170,7 +217,9 @@ class SmartBearMcpServer extends McpServer {
170
217
  this.clients.push(client);
171
218
  await client.registerTools(
172
219
  (params, cb) => {
173
- if (!this.isToolEnabled(client, params.toolset)) {
220
+ const enabled = this.isToolEnabled(client, params.toolset);
221
+ this.recordToolset(client.name, params.toolset, enabled);
222
+ if (!enabled) {
174
223
  return null;
175
224
  }
176
225
  const toolName = this.getCapabilityName(client, params.title);
@@ -329,6 +378,19 @@ ${result.instructions}`
329
378
  }
330
379
  this.sortToolsDeterministically();
331
380
  }
381
+ recordToolset(clientName, toolset, enabled) {
382
+ let byToolset = this.toolsetStats.get(clientName);
383
+ if (!byToolset) {
384
+ byToolset = /* @__PURE__ */ new Map();
385
+ this.toolsetStats.set(clientName, byToolset);
386
+ }
387
+ const stats = byToolset.get(toolset) ?? { total: 0, enabled: 0 };
388
+ stats.total++;
389
+ if (enabled) {
390
+ stats.enabled++;
391
+ }
392
+ byToolset.set(toolset, stats);
393
+ }
332
394
  /**
333
395
  * Re-key the SDK's tool registry alphabetically so `tools/list` output is
334
396
  * deterministic regardless of client registration order.