@browserstack/mcp-server 1.2.22 → 1.2.23-beta.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.
@@ -1,5 +1,5 @@
1
1
  import { apiClient } from "../../../lib/apiClient.js";
2
- import { TCG_TRIGGER_URL, TCG_POLL_URL, FETCH_DETAILS_URL, FORM_FIELDS_URL, BULK_CREATE_URL, } from "./config.js";
2
+ import { TCG_TRIGGER_URL, TCG_POLL_URL, FETCH_DETAILS_URL, FORM_FIELDS_URL, BULK_CREATE_URL, TC_DETAILS_MAX_BATCH, } from "./config.js";
3
3
  import { createTestCasePayload } from "./helpers.js";
4
4
  import { getBrowserStackAuth } from "../../../lib/get-auth.js";
5
5
  import { getTMBaseURL } from "../../../lib/tm-base-url.js";
@@ -165,11 +165,11 @@ export async function pollScenariosTestDetails(args, traceId, context, documentI
165
165
  if (msg.type === "testcase") {
166
166
  const sc = msg.data.scenario;
167
167
  if (sc) {
168
- const array = Array.isArray(msg.data.testcases)
168
+ const array = (Array.isArray(msg.data.testcases)
169
169
  ? msg.data.testcases
170
170
  : msg.data.testcases
171
171
  ? [msg.data.testcases]
172
- : [];
172
+ : []).slice(0, TC_DETAILS_MAX_BATCH);
173
173
  const ids = array.map((tc) => tc.id || tc.test_case_id);
174
174
  const reqId = await fetchTestCaseDetails(documentId, folderId, projectReferenceId, ids, source, config);
175
175
  detailPromises.push(pollTestCaseDetails(reqId, config));
@@ -228,12 +228,13 @@ export async function bulkCreateTestCases(scenariosMap, projectId, folderId, fie
228
228
  const tmBaseUrl = await getTMBaseURL(config);
229
229
  const BULK_CREATE_URL_VALUE = BULK_CREATE_URL(tmBaseUrl, projectId, folderId);
230
230
  for (const { id, testcases } of Object.values(scenariosMap)) {
231
- const testCaseLength = testcases.length;
231
+ const cappedTestcases = testcases.slice(0, TC_DETAILS_MAX_BATCH);
232
+ const testCaseLength = cappedTestcases.length;
232
233
  testCaseCount += testCaseLength;
233
234
  if (testCaseLength === 0)
234
235
  continue;
235
236
  const payload = {
236
- test_cases: testcases.map((tc) => createTestCasePayload(tc, id, folderId, fieldMaps, documentId, booleanFieldId, traceId)),
237
+ test_cases: cappedTestcases.map((tc) => createTestCasePayload(tc, id, folderId, fieldMaps, documentId, booleanFieldId, traceId)),
237
238
  };
238
239
  try {
239
240
  const resp = await apiClient.post({
@@ -1,3 +1,4 @@
1
+ export declare const TC_DETAILS_MAX_BATCH = 10;
1
2
  export declare const TCG_TRIGGER_URL: (baseUrl: string) => string;
2
3
  export declare const TCG_POLL_URL: (baseUrl: string) => string;
3
4
  export declare const FETCH_DETAILS_URL: (baseUrl: string) => string;
@@ -1,3 +1,4 @@
1
+ export const TC_DETAILS_MAX_BATCH = 10;
1
2
  export const TCG_TRIGGER_URL = (baseUrl) => `${baseUrl}/api/v1/integration/tcg/test-generation/suggest-test-cases`;
2
3
  export const TCG_POLL_URL = (baseUrl) => `${baseUrl}/api/v1/integration/tcg/test-generation/test-cases-polling`;
3
4
  export const FETCH_DETAILS_URL = (baseUrl) => `${baseUrl}/api/v1/integration/tcg/test-generation/fetch-test-case-details`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserstack/mcp-server",
3
- "version": "1.2.22",
3
+ "version": "1.2.23-beta.1",
4
4
  "description": "BrowserStack's Official MCP Server",
5
5
  "mcpName": "io.github.browserstack/mcp-server",
6
6
  "main": "dist/index.js",