@applitools/mcp 0.5.3 → 0.5.5
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.
- package/CHANGELOG.md +29 -0
- package/dist/index.js +748 -83
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -38,6 +38,7 @@ const TOOL_NAMES = {
|
|
|
38
38
|
EYES_ADD_CHECKPOINTS: 'eyes_add_checkpoints_to_test',
|
|
39
39
|
EYES_GET_BATCH_URL: 'eyes_get_batch_url',
|
|
40
40
|
EYES_FETCH_VISUAL_RESULTS: 'eyes_fetch_visual_results',
|
|
41
|
+
EYES_ANALYZE_BATCH: 'eyes_analyze_batch',
|
|
41
42
|
};
|
|
42
43
|
const DEFAULT_SERVER_URL = 'https://eyes.applitools.com';
|
|
43
44
|
const TRANSPORT_MODE = 'stdio';
|
|
@@ -693,7 +694,7 @@ function getAutomationFramework(workingDirectory, activeFile) {
|
|
|
693
694
|
|
|
694
695
|
var name = "@applitools/mcp";
|
|
695
696
|
var mcpName = "io.github.applitools/applitools";
|
|
696
|
-
var version = "0.5.
|
|
697
|
+
var version = "0.5.5";
|
|
697
698
|
var description = "Applitools MCP server for AI coding assistants";
|
|
698
699
|
var main = "./dist/index.js";
|
|
699
700
|
var bin = "./dist/index.js";
|
|
@@ -974,6 +975,35 @@ class ApiClient {
|
|
|
974
975
|
this.timeout = options.timeout || 30000;
|
|
975
976
|
this.retryConfig = (_a = options.retryConfig) !== null && _a !== void 0 ? _a : DEFAULT_RETRY_CONFIG;
|
|
976
977
|
}
|
|
978
|
+
/**
|
|
979
|
+
* Perform a GET request, returning the raw response for custom status-code
|
|
980
|
+
* handling. Retries and auth headers are still applied automatically.
|
|
981
|
+
*
|
|
982
|
+
* Unlike `get()`, this method does NOT throw on non-2xx responses other
|
|
983
|
+
* than 401 — the caller is responsible for inspecting `response.status` and
|
|
984
|
+
* `response.ok`. 401 is mapped to `InvalidApiKeyError` for symmetry with
|
|
985
|
+
* `get()`/`post()`, so a rotated/expired API key fails loudly instead of
|
|
986
|
+
* being silently absorbed by callers that treat "no diffs" as a normal
|
|
987
|
+
* outcome.
|
|
988
|
+
*/
|
|
989
|
+
async getRaw(endpoint) {
|
|
990
|
+
if (!this.apiKey) {
|
|
991
|
+
throw new MissingApiKeyError();
|
|
992
|
+
}
|
|
993
|
+
const response = await req.req(`${this.baseUrl}/${endpoint}`, {
|
|
994
|
+
method: 'GET',
|
|
995
|
+
headers: {
|
|
996
|
+
'X-Eyes-Api-Key': this.apiKey,
|
|
997
|
+
Accept: 'application/json',
|
|
998
|
+
},
|
|
999
|
+
requestTimeout: this.timeout,
|
|
1000
|
+
retry: this.retryConfig,
|
|
1001
|
+
});
|
|
1002
|
+
if (response.status === 401) {
|
|
1003
|
+
throw new InvalidApiKeyError(this.apiKey);
|
|
1004
|
+
}
|
|
1005
|
+
return response;
|
|
1006
|
+
}
|
|
977
1007
|
/**
|
|
978
1008
|
* Perform a GET request with automatic retry on failures
|
|
979
1009
|
*/
|
|
@@ -1106,8 +1136,8 @@ async function verifyApiKeyWithServer(params) {
|
|
|
1106
1136
|
}
|
|
1107
1137
|
|
|
1108
1138
|
/** Authentication Tools - Verify API Key */
|
|
1109
|
-
const TOOL_NAME$
|
|
1110
|
-
const TOOL_DESCRIPTION$
|
|
1139
|
+
const TOOL_NAME$6 = TOOL_NAMES.EYES_VERIFY_API_KEY;
|
|
1140
|
+
const TOOL_DESCRIPTION$6 = 'Validate your Applitools API key and optional server URL. Searches for API key in .env, applitools.config.js/ts/cjs/mjs, and playwright.config.js/ts/cjs/mjs files.';
|
|
1111
1141
|
const VerifyApiKeyInputSchema = zod.z.object({
|
|
1112
1142
|
apiKey: zod.z.string().optional().describe('Optional API key to validate (will search config files if not provided)'),
|
|
1113
1143
|
serverUrl: zod.z.string().optional().describe('Optional Applitools server URL (defaults to https://eyes.applitools.com)'),
|
|
@@ -1183,11 +1213,11 @@ async function verifyApiKey(input = {}) {
|
|
|
1183
1213
|
/** Verify API Key Tool - MCP Tool Object Export */
|
|
1184
1214
|
/** MCP Tool Object for verify_api_key */
|
|
1185
1215
|
const verifyApiKeyTool = {
|
|
1186
|
-
name: TOOL_NAME$
|
|
1187
|
-
description: TOOL_DESCRIPTION$
|
|
1216
|
+
name: TOOL_NAME$6,
|
|
1217
|
+
description: TOOL_DESCRIPTION$6,
|
|
1188
1218
|
inputSchema: VerifyApiKeyInputSchema,
|
|
1189
1219
|
handler: createToolHandler({
|
|
1190
|
-
name: TOOL_NAME$
|
|
1220
|
+
name: TOOL_NAME$6,
|
|
1191
1221
|
input: VerifyApiKeyInputSchema,
|
|
1192
1222
|
}, async (params) => {
|
|
1193
1223
|
const result = await verifyApiKey(params);
|
|
@@ -1284,8 +1314,8 @@ function validateCommonInput(input) {
|
|
|
1284
1314
|
}
|
|
1285
1315
|
|
|
1286
1316
|
const TILDA_WARNING_MESSAGE$2 = `[CORE REQUIREMENT: URL INTEGRITY] Playwright visual results return URLs ending in ~~. These are not typos. You are strictly forbidden from stripping trailing tildes from these links. Use markdown [Visual Test results](URL with tildes) for links. Output the raw, verbatim URL string exactly as captured from the test output.`;
|
|
1287
|
-
const TOOL_NAME$
|
|
1288
|
-
const TOOL_DESCRIPTION$
|
|
1317
|
+
const TOOL_NAME$5 = TOOL_NAMES.EYES_SETUP_PROJECT;
|
|
1318
|
+
const TOOL_DESCRIPTION$5 = `Get step-by-step instructions to set up a Playwright JS project with Applitools Eyes (Fixtures variant)
|
|
1289
1319
|
|
|
1290
1320
|
${TILDA_WARNING_MESSAGE$2}`;
|
|
1291
1321
|
const PlaywrightJsSetupProjectInputSchema = commonInputSchema.extend({
|
|
@@ -1540,11 +1570,11 @@ You can use the mcp tool "${TOOL_NAMES.EYES_SETUP_UFG}" to accomplish that.`;
|
|
|
1540
1570
|
}
|
|
1541
1571
|
|
|
1542
1572
|
const eyesSetupProjectTool = {
|
|
1543
|
-
name: TOOL_NAME$
|
|
1544
|
-
description: TOOL_DESCRIPTION$
|
|
1573
|
+
name: TOOL_NAME$5,
|
|
1574
|
+
description: TOOL_DESCRIPTION$5,
|
|
1545
1575
|
inputSchema: PlaywrightJsSetupProjectClientInputSchema,
|
|
1546
1576
|
handler: createToolHandler({
|
|
1547
|
-
name: TOOL_NAME$
|
|
1577
|
+
name: TOOL_NAME$5,
|
|
1548
1578
|
input: PlaywrightJsSetupProjectInputSchema,
|
|
1549
1579
|
}, async (params) => {
|
|
1550
1580
|
const result = await eyesSetupProject(params);
|
|
@@ -1560,8 +1590,8 @@ const eyesSetupProjectTool = {
|
|
|
1560
1590
|
};
|
|
1561
1591
|
|
|
1562
1592
|
const TILDA_WARNING_MESSAGE$1 = `[CORE REQUIREMENT: URL INTEGRITY] Playwright visual results return URLs ending in ~~. These are not typos. You are strictly forbidden from stripping trailing tildes from these links. Use markdown [Visual Test results](URL with tildes) for links. Output the raw, verbatim URL string exactly as captured from the test output.`;
|
|
1563
|
-
const TOOL_NAME$
|
|
1564
|
-
const TOOL_DESCRIPTION$
|
|
1593
|
+
const TOOL_NAME$4 = TOOL_NAMES.EYES_SETUP_UFG;
|
|
1594
|
+
const TOOL_DESCRIPTION$4 = `Configure Ultrafast Grid (UFG) for cross-browser and cross-device testing
|
|
1565
1595
|
|
|
1566
1596
|
${TILDA_WARNING_MESSAGE$1}`;
|
|
1567
1597
|
const PlaywrightJsSetupUfgInputSchema = commonInputSchema.extend({
|
|
@@ -1644,11 +1674,11 @@ When the playwright-report/index.html is not available use the MCP tool "${TOOL_
|
|
|
1644
1674
|
}
|
|
1645
1675
|
|
|
1646
1676
|
const eyesSetupUfgTool = {
|
|
1647
|
-
name: TOOL_NAME$
|
|
1648
|
-
description: TOOL_DESCRIPTION$
|
|
1677
|
+
name: TOOL_NAME$4,
|
|
1678
|
+
description: TOOL_DESCRIPTION$4,
|
|
1649
1679
|
inputSchema: PlaywrightJsSetupUfgClientInputSchema,
|
|
1650
1680
|
handler: createToolHandler({
|
|
1651
|
-
name: TOOL_NAME$
|
|
1681
|
+
name: TOOL_NAME$4,
|
|
1652
1682
|
input: PlaywrightJsSetupUfgInputSchema,
|
|
1653
1683
|
}, async (params) => {
|
|
1654
1684
|
const result = await eyesSetupUfg(params);
|
|
@@ -1663,8 +1693,8 @@ const eyesSetupUfgTool = {
|
|
|
1663
1693
|
}),
|
|
1664
1694
|
};
|
|
1665
1695
|
|
|
1666
|
-
const TOOL_NAME$
|
|
1667
|
-
const TOOL_DESCRIPTION$
|
|
1696
|
+
const TOOL_NAME$3 = TOOL_NAMES.EYES_ADD_CHECKPOINTS;
|
|
1697
|
+
const TOOL_DESCRIPTION$3 = 'Add visual checkpoints to existing Playwright tests following best practices';
|
|
1668
1698
|
const PlaywrightJsAddCheckpointsInputSchema = commonInputSchema.extend({
|
|
1669
1699
|
filePath: zod.z
|
|
1670
1700
|
.string()
|
|
@@ -1862,11 +1892,11 @@ You can use the MCP tool "${TOOL_NAMES.EYES_SETUP_UFG}" to setup the UFG for the
|
|
|
1862
1892
|
}
|
|
1863
1893
|
|
|
1864
1894
|
const eyesAddCheckpointsToTestTool = {
|
|
1865
|
-
name: TOOL_NAME$
|
|
1866
|
-
description: TOOL_DESCRIPTION$
|
|
1895
|
+
name: TOOL_NAME$3,
|
|
1896
|
+
description: TOOL_DESCRIPTION$3,
|
|
1867
1897
|
inputSchema: PlaywrightJsAddCheckpointsClientInputSchema,
|
|
1868
1898
|
handler: createToolHandler({
|
|
1869
|
-
name: TOOL_NAME$
|
|
1899
|
+
name: TOOL_NAME$3,
|
|
1870
1900
|
input: PlaywrightJsAddCheckpointsInputSchema,
|
|
1871
1901
|
}, async (params) => {
|
|
1872
1902
|
const result = await eyesAddCheckpointsToTest(params);
|
|
@@ -1882,8 +1912,8 @@ const eyesAddCheckpointsToTestTool = {
|
|
|
1882
1912
|
};
|
|
1883
1913
|
|
|
1884
1914
|
/** Get Batch URL from Output Tool */
|
|
1885
|
-
const TOOL_NAME$
|
|
1886
|
-
const TOOL_DESCRIPTION$
|
|
1915
|
+
const TOOL_NAME$2 = TOOL_NAMES.EYES_GET_BATCH_URL;
|
|
1916
|
+
const TOOL_DESCRIPTION$2 = `═══════════════════════════════════════
|
|
1887
1917
|
📋 SHOW THIS MESSAGE TO USER AS-IS
|
|
1888
1918
|
═══════════════════════════════════════
|
|
1889
1919
|
|
|
@@ -1990,12 +2020,12 @@ async function getBatchUrlFromOutput(input) {
|
|
|
1990
2020
|
/** Get Batch URL from Output Tool - MCP Tool Object Export */
|
|
1991
2021
|
/** MCP Tool Object for get_batch_url */
|
|
1992
2022
|
const getBatchUrlFromOutputTool = {
|
|
1993
|
-
name: TOOL_NAME$
|
|
1994
|
-
description: TOOL_DESCRIPTION$
|
|
2023
|
+
name: TOOL_NAME$2,
|
|
2024
|
+
description: TOOL_DESCRIPTION$2,
|
|
1995
2025
|
inputSchema: GetBatchUrlFromOutputInputSchema,
|
|
1996
2026
|
outputSchema: BatchUrlToolResultSchema,
|
|
1997
2027
|
handler: createToolHandler({
|
|
1998
|
-
name: TOOL_NAME$
|
|
2028
|
+
name: TOOL_NAME$2,
|
|
1999
2029
|
input: GetBatchUrlFromOutputInputSchema,
|
|
2000
2030
|
output: BatchUrlToolResultSchema,
|
|
2001
2031
|
}, async (params) => {
|
|
@@ -2071,8 +2101,105 @@ function fixEyesUrl(url) {
|
|
|
2071
2101
|
function ensureTrailingSlash(url) {
|
|
2072
2102
|
return url.endsWith('/') ? url : `${url}/`;
|
|
2073
2103
|
}
|
|
2104
|
+
/**
|
|
2105
|
+
* Trailing-tilde token ("~~") that the Eyes dashboard appends to deep-link
|
|
2106
|
+
* URLs (test results, sessions, batches). The dashboard parses these tildes
|
|
2107
|
+
* as a sentinel that means "no access token attached"; LLMs and clients
|
|
2108
|
+
* frequently strip them as if they were typos, which breaks the link.
|
|
2109
|
+
*
|
|
2110
|
+
* Always render visual-results URLs by going through {@link buildSessionUrl}
|
|
2111
|
+
* and the existing batch-URL helpers so the convention lives in exactly one
|
|
2112
|
+
* place. The corresponding warning surfaced in tool descriptions also lives
|
|
2113
|
+
* here ({@link TILDA_URL_WARNING}) so both tools share identical wording.
|
|
2114
|
+
*/
|
|
2115
|
+
const SESSION_URL_TILDA_SUFFIX = '~~';
|
|
2116
|
+
/**
|
|
2117
|
+
* The reusable tool-description fragment that warns the LLM not to strip the
|
|
2118
|
+
* trailing `~~` from session/batch URLs. Both `eyes_fetch_visual_results`
|
|
2119
|
+
* and `eyes_analyze_batch` embed this verbatim in their tool description so
|
|
2120
|
+
* the wording, and the underlying convention, never drift.
|
|
2121
|
+
*/
|
|
2122
|
+
const TILDA_URL_WARNING = '[CORE REQUIREMENT: URL INTEGRITY] Visual-results URLs returned by Eyes end with `~~`. ' +
|
|
2123
|
+
'These tildes are a dashboard sentinel, not typos. You are strictly forbidden from stripping ' +
|
|
2124
|
+
'trailing tildes from these links. Render them with markdown ' +
|
|
2125
|
+
'`[Visual Test results](URL with tildes)` and output the raw, verbatim URL.';
|
|
2126
|
+
/**
|
|
2127
|
+
* Build the canonical Eyes dashboard URL for a single test session.
|
|
2128
|
+
*
|
|
2129
|
+
* Output shape: `{serverUrl}/app/test-results/{batchId}/{sessionId}~~`
|
|
2130
|
+
*
|
|
2131
|
+
* The trailing `~~` ({@link SESSION_URL_TILDA_SUFFIX}) is required by the
|
|
2132
|
+
* Eyes dashboard URL format — it signals "no access token attached" so the
|
|
2133
|
+
* dashboard falls back to the viewer's own login. Stripping it produces a
|
|
2134
|
+
* 404. Centralized here so callers cannot accidentally omit it.
|
|
2135
|
+
*/
|
|
2136
|
+
function buildSessionUrl(serverUrl, batchId, sessionId) {
|
|
2137
|
+
return `${serverUrl}/app/test-results/${batchId}/${sessionId}${SESSION_URL_TILDA_SUFFIX}`;
|
|
2138
|
+
}
|
|
2139
|
+
/**
|
|
2140
|
+
* Build the canonical Eyes dashboard URL for a whole batch.
|
|
2141
|
+
*
|
|
2142
|
+
* Output shape: `{serverUrl}/app/test-results/{batchId}`
|
|
2143
|
+
*/
|
|
2144
|
+
function buildBatchUrl(serverUrl, batchId) {
|
|
2145
|
+
return `${serverUrl}/app/test-results/${batchId}`;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
/**
|
|
2149
|
+
* Canonical visual-test status set, shared by every part of the MCP package
|
|
2150
|
+
* that produces or consumes a per-test status string.
|
|
2151
|
+
*
|
|
2152
|
+
* Single source of truth for:
|
|
2153
|
+
* - the Zod enum on `VisualTestResultSchema.status`
|
|
2154
|
+
* ([[../dtos/visual-results-result.ts]])
|
|
2155
|
+
* - the runtime `normalizeStatus()` helper used by `eyes_analyze_batch`
|
|
2156
|
+
* ([[../tools/eyes-analyze-batch/tool.ts]]) to coerce arbitrary BE
|
|
2157
|
+
* strings into the canonical set
|
|
2158
|
+
* - the `STATUS_PRIORITY` ordering used by `eyes_fetch_visual_results`
|
|
2159
|
+
* ([[../tools/eyes-fetch-visual-results/batch-processor.ts]]) when it
|
|
2160
|
+
* reconciles per-step results into a single test status
|
|
2161
|
+
* - the per-status counters in `buildVisualResultsResult`
|
|
2162
|
+
* ([[../utils/build-visual-results-result.ts]])
|
|
2163
|
+
*
|
|
2164
|
+
* Adding a new status: append it to {@link CANONICAL_STATUSES} and the rest
|
|
2165
|
+
* of the package picks it up automatically.
|
|
2166
|
+
*/
|
|
2167
|
+
/**
|
|
2168
|
+
* Tuple of every status the MCP tools may return on a per-test basis. Keep
|
|
2169
|
+
* this as a `readonly` tuple (not a plain array) so we can derive both the
|
|
2170
|
+
* Zod enum and the TypeScript union without re-declaring the values.
|
|
2171
|
+
*/
|
|
2172
|
+
const CANONICAL_STATUSES = ['passed', 'failed', 'unresolved', 'new', 'aborted', 'running', 'empty'];
|
|
2173
|
+
/** Set form of {@link CANONICAL_STATUSES} for O(1) membership checks. */
|
|
2174
|
+
const CANONICAL_STATUS_SET = new Set(CANONICAL_STATUSES);
|
|
2175
|
+
/**
|
|
2176
|
+
* Reconciliation order for `determineStatus()` in
|
|
2177
|
+
* [[../tools/eyes-fetch-visual-results/batch-processor.ts]] — the lowest
|
|
2178
|
+
* index wins when multiple statuses are observed for the same test across
|
|
2179
|
+
* retries / chunks.
|
|
2180
|
+
*
|
|
2181
|
+
* Aborted / empty / new are decided by boolean flags before this list is
|
|
2182
|
+
* consulted, so they don't appear here.
|
|
2183
|
+
*/
|
|
2184
|
+
const STATUS_PRIORITY = [
|
|
2185
|
+
'running',
|
|
2186
|
+
'passed',
|
|
2187
|
+
'failed',
|
|
2188
|
+
'unresolved',
|
|
2189
|
+
];
|
|
2190
|
+
/** Default fallback when an unrecognised status string arrives from the BE. */
|
|
2191
|
+
const DEFAULT_UNKNOWN_STATUS = 'unresolved';
|
|
2192
|
+
/**
|
|
2193
|
+
* Coerce an arbitrary status string from the Eyes BE into the canonical set
|
|
2194
|
+
* the MCP tools expose on the wire. Case-insensitive; unknown values fall
|
|
2195
|
+
* back to {@link DEFAULT_UNKNOWN_STATUS} so the schema parse never throws on
|
|
2196
|
+
* unexpected BE input (forward-compatible with new server-side states).
|
|
2197
|
+
*/
|
|
2198
|
+
function normalizeStatus(status) {
|
|
2199
|
+
const lower = status.toLowerCase();
|
|
2200
|
+
return CANONICAL_STATUS_SET.has(lower) ? lower : DEFAULT_UNKNOWN_STATUS;
|
|
2201
|
+
}
|
|
2074
2202
|
|
|
2075
|
-
const STATUS_PRIORITY = ['running', 'passed', 'failed', 'unresolved'];
|
|
2076
2203
|
function filterToLastRetry(eyesResults) {
|
|
2077
2204
|
if (eyesResults.length === 0) {
|
|
2078
2205
|
return [];
|
|
@@ -2182,6 +2309,19 @@ async function processBatches(testResultsData, fallbackApiKey) {
|
|
|
2182
2309
|
result.isAborted = serverStatus.isAborted;
|
|
2183
2310
|
}
|
|
2184
2311
|
const finalStatus = determineStatus(result);
|
|
2312
|
+
// Extract diff descriptions from actualAppOutput
|
|
2313
|
+
const stepDiffs = [];
|
|
2314
|
+
if (serverStatus === null || serverStatus === void 0 ? void 0 : serverStatus.actualAppOutput) {
|
|
2315
|
+
serverStatus.actualAppOutput.forEach((output, index) => {
|
|
2316
|
+
if (output.diffDescriptions && output.diffDescriptions.length > 0) {
|
|
2317
|
+
stepDiffs.push({
|
|
2318
|
+
stepIndex: index,
|
|
2319
|
+
stepName: output.tag || `Step ${index + 1}`,
|
|
2320
|
+
diffDescriptions: output.diffDescriptions,
|
|
2321
|
+
});
|
|
2322
|
+
}
|
|
2323
|
+
});
|
|
2324
|
+
}
|
|
2185
2325
|
tests.push({
|
|
2186
2326
|
testName: result.name,
|
|
2187
2327
|
batchName: result.batchName,
|
|
@@ -2190,6 +2330,7 @@ async function processBatches(testResultsData, fallbackApiKey) {
|
|
|
2190
2330
|
steps: result.steps,
|
|
2191
2331
|
retryAttempt: (_a = result.playwrightRetry) !== null && _a !== void 0 ? _a : 0,
|
|
2192
2332
|
browser: result.hostApp,
|
|
2333
|
+
...(stepDiffs.length > 0 ? { stepDiffs } : {}),
|
|
2193
2334
|
});
|
|
2194
2335
|
});
|
|
2195
2336
|
processedBatches.push({
|
|
@@ -2202,6 +2343,13 @@ async function processBatches(testResultsData, fallbackApiKey) {
|
|
|
2202
2343
|
return processedBatches;
|
|
2203
2344
|
}
|
|
2204
2345
|
|
|
2346
|
+
/**
|
|
2347
|
+
* Tool-agnostic builder that turns an array of `ProcessedBatch` into the
|
|
2348
|
+
* `VisualResultsToolResult` shape (message + structured results + summary).
|
|
2349
|
+
*
|
|
2350
|
+
* Used by both `eyes_fetch_visual_results` and `eyes_analyze_batch` so they
|
|
2351
|
+
* produce identical output structures from different upstream sources.
|
|
2352
|
+
*/
|
|
2205
2353
|
function calculateSummary(batches) {
|
|
2206
2354
|
let totalTests = 0;
|
|
2207
2355
|
let passed = 0;
|
|
@@ -2234,6 +2382,15 @@ function calculateSummary(batches) {
|
|
|
2234
2382
|
aborted,
|
|
2235
2383
|
};
|
|
2236
2384
|
}
|
|
2385
|
+
function formatDiffDescriptions(test) {
|
|
2386
|
+
if (!test.stepDiffs || test.stepDiffs.length === 0)
|
|
2387
|
+
return '';
|
|
2388
|
+
const lines = test.stepDiffs.flatMap(step => [
|
|
2389
|
+
` **${step.stepName}:**`,
|
|
2390
|
+
...step.diffDescriptions.map(d => ` - ${d.category}: "${d.baselineValue}" → "${d.checkpointValue}"`),
|
|
2391
|
+
]);
|
|
2392
|
+
return `\n **Visual differences:**\n${lines.join('\n')}`;
|
|
2393
|
+
}
|
|
2237
2394
|
function formatMessage(batches, summary) {
|
|
2238
2395
|
return wrapText(`✅ Fetched visual test results from ${batches.length} batch(es):\n\n` +
|
|
2239
2396
|
`**Summary:**\n` +
|
|
@@ -2245,13 +2402,18 @@ function formatMessage(batches, summary) {
|
|
|
2245
2402
|
`- Aborted: ${summary.aborted}\n\n` +
|
|
2246
2403
|
batches
|
|
2247
2404
|
.map((batch, i) => {
|
|
2405
|
+
const testsWithDiffs = batch.tests.filter(t => t.stepDiffs && t.stepDiffs.length > 0);
|
|
2406
|
+
const testLines = testsWithDiffs
|
|
2407
|
+
.map(t => ` - **${t.testName}** (${t.browser}) — ${t.status}${formatDiffDescriptions(t)}`)
|
|
2408
|
+
.join('\n');
|
|
2248
2409
|
return (`**Batch ${i + 1}: ${batch.batchName}**\n` +
|
|
2249
2410
|
`- [View Batch](${batch.batchUrl})\n` +
|
|
2250
|
-
`- Tests: ${batch.tests.length}\n`
|
|
2411
|
+
`- Tests: ${batch.tests.length}\n` +
|
|
2412
|
+
(testLines ? `- Tests with visual differences:\n${testLines}\n` : ''));
|
|
2251
2413
|
})
|
|
2252
2414
|
.join('\n'), 'prefix');
|
|
2253
2415
|
}
|
|
2254
|
-
function
|
|
2416
|
+
function buildVisualResultsResult(batches) {
|
|
2255
2417
|
const summary = calculateSummary(batches);
|
|
2256
2418
|
const results = batches.map(batch => ({
|
|
2257
2419
|
batchId: batch.batchId,
|
|
@@ -2265,6 +2427,7 @@ function buildToolResult(batches) {
|
|
|
2265
2427
|
steps: test.steps,
|
|
2266
2428
|
retryAttempt: test.retryAttempt,
|
|
2267
2429
|
browser: test.browser,
|
|
2430
|
+
...(test.stepDiffs && test.stepDiffs.length > 0 ? { stepDiffs: test.stepDiffs } : {}),
|
|
2268
2431
|
})),
|
|
2269
2432
|
}));
|
|
2270
2433
|
const message = formatMessage(results, summary);
|
|
@@ -2283,9 +2446,108 @@ function buildToolResult(batches) {
|
|
|
2283
2446
|
};
|
|
2284
2447
|
}
|
|
2285
2448
|
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2449
|
+
/**
|
|
2450
|
+
* Shared Zod schemas describing the "visual results" tool output shape.
|
|
2451
|
+
*
|
|
2452
|
+
* Both `eyes_fetch_visual_results` (Playwright report flow) and
|
|
2453
|
+
* `eyes_analyze_batch` (paste-batch-URL flow) return data in this shape, so
|
|
2454
|
+
* the schemas live here rather than inside either tool. Each tool re-exports
|
|
2455
|
+
* them under tool-specific aliases for stable public names.
|
|
2456
|
+
*/
|
|
2457
|
+
const DiffDescriptionSchema = zod.z.object({
|
|
2458
|
+
baselineValue: zod.z.string().describe('Original value from the baseline snapshot'),
|
|
2459
|
+
checkpointValue: zod.z.string().describe('New value from the checkpoint snapshot'),
|
|
2460
|
+
category: zod.z
|
|
2461
|
+
.string()
|
|
2462
|
+
.describe('Diff category code emitted by the Eyes BE. Canonical set: ' +
|
|
2463
|
+
'"ContentTextShort" (text changed ≤10 words), ' +
|
|
2464
|
+
'"ContentTextLong" (text changed >10 words), ' +
|
|
2465
|
+
'"FontColor" (font foreground color), ' +
|
|
2466
|
+
'"FontSize" (font size), ' +
|
|
2467
|
+
'"FontFamily" (font family), ' +
|
|
2468
|
+
'"FontStyle" (bold / italic / underline), ' +
|
|
2469
|
+
'"BackgroundColor" (element background color), ' +
|
|
2470
|
+
'"BorderStyle" (border style / color / width), ' +
|
|
2471
|
+
'"GraphicChanged" (image / icon / SVG content). ' +
|
|
2472
|
+
'New BE-side categories are passed through verbatim.'),
|
|
2473
|
+
});
|
|
2474
|
+
const StepDiffSchema = zod.z.object({
|
|
2475
|
+
stepIndex: zod.z.number().describe('Zero-based index of the step within the test'),
|
|
2476
|
+
stepName: zod.z.string().describe('Name/label of the visual checkpoint'),
|
|
2477
|
+
diffDescriptions: zod.z
|
|
2478
|
+
.array(DiffDescriptionSchema)
|
|
2479
|
+
.describe('List of textual descriptions of visual differences detected in this step'),
|
|
2480
|
+
});
|
|
2481
|
+
const VisualTestResultSchema = zod.z.object({
|
|
2482
|
+
testName: zod.z.string().describe('Name of the visual test'),
|
|
2483
|
+
batchName: zod.z.string().describe('Name of the batch this test belongs to'),
|
|
2484
|
+
status: zod.z
|
|
2485
|
+
.enum(CANONICAL_STATUSES)
|
|
2486
|
+
.describe('Visual test status: "passed" - all checkpoints match baseline, ' +
|
|
2487
|
+
'"failed" - visual differences detected, ' +
|
|
2488
|
+
'"unresolved" - differences need review, ' +
|
|
2489
|
+
'"new" - first-time checkpoint with no baseline, ' +
|
|
2490
|
+
'"aborted" - test terminated prematurely, ' +
|
|
2491
|
+
'"running" - test still executing, ' +
|
|
2492
|
+
'"empty" - test completed with zero checkpoints.'),
|
|
2493
|
+
sessionUrl: zod.z
|
|
2494
|
+
.string()
|
|
2495
|
+
.describe('URL to the visual test results in the Eyes dashboard. The trailing `~~` is a required ' +
|
|
2496
|
+
'dashboard sentinel meaning "no access token attached" — see SESSION_URL_TILDA_SUFFIX in ' +
|
|
2497
|
+
'utils/url-utils.ts. Do not strip it.'),
|
|
2498
|
+
steps: zod.z.number().describe('Number of visual checkpoints in this test'),
|
|
2499
|
+
retryAttempt: zod.z.number().describe('Retry attempt number (0 for first attempt)'),
|
|
2500
|
+
browser: zod.z.string().describe('Browser/device configuration this test ran on'),
|
|
2501
|
+
stepDiffs: zod.z
|
|
2502
|
+
.array(StepDiffSchema)
|
|
2503
|
+
.optional()
|
|
2504
|
+
.describe('Textual descriptions of visual differences for steps with diffs. Only present for tests where DOM-based diff analysis detected categorized differences.'),
|
|
2505
|
+
});
|
|
2506
|
+
const BatchResultSchema = zod.z.object({
|
|
2507
|
+
// batchId/batchUrl are intentionally part of the public response shape:
|
|
2508
|
+
// - `batchId` is the stable identifier the LLM/agent uses to correlate
|
|
2509
|
+
// this result with prior tool calls (e.g. the stale-report check in
|
|
2510
|
+
// `eyes_fetch_visual_results` reads `batchId` to verify expected vs
|
|
2511
|
+
// observed batches) and to disambiguate multiple batches in one run.
|
|
2512
|
+
// - `batchUrl` is rendered as a `[View Batch]` link in the human message
|
|
2513
|
+
// and is what the user clicks to open the dashboard.
|
|
2514
|
+
// Removing either would force every consumer to reconstruct the URL from
|
|
2515
|
+
// the server URL + ID, so they stay.
|
|
2516
|
+
batchId: zod.z
|
|
2517
|
+
.string()
|
|
2518
|
+
.describe('Stable batch identifier; used by clients to correlate, deduplicate, and detect stale reports.'),
|
|
2519
|
+
batchName: zod.z.string().describe('Human-readable batch label as shown in the Eyes dashboard.'),
|
|
2520
|
+
batchUrl: zod.z.string().describe('Full Eyes dashboard URL for this batch; rendered as a `[View Batch]` link.'),
|
|
2521
|
+
tests: zod.z.array(VisualTestResultSchema).describe('All visual tests within this batch'),
|
|
2522
|
+
});
|
|
2523
|
+
const VisualResultsToolResultSchema = zod.z.object({
|
|
2524
|
+
message: zod.z.string().describe('Human-readable summary of the visual test results'),
|
|
2525
|
+
results: zod.z.array(BatchResultSchema).optional().describe('Detailed results grouped by batch'),
|
|
2526
|
+
summary: zod.z
|
|
2527
|
+
.object({
|
|
2528
|
+
totalBatches: zod.z.number().describe('Total number of batches'),
|
|
2529
|
+
totalTests: zod.z.number().describe('Total number of visual tests across all batches'),
|
|
2530
|
+
passed: zod.z
|
|
2531
|
+
.number()
|
|
2532
|
+
.describe('Number of tests where all visual checkpoints matched the baseline (no differences detected)'),
|
|
2533
|
+
failed: zod.z.number().describe('Number of tests with visual differences that were marked as failures after review'),
|
|
2534
|
+
unresolved: zod.z
|
|
2535
|
+
.number()
|
|
2536
|
+
.describe('Number of tests with visual differences that require human review and acceptance/rejection'),
|
|
2537
|
+
new: zod.z
|
|
2538
|
+
.number()
|
|
2539
|
+
.describe('Number of tests running for the first time with no existing baseline to compare against'),
|
|
2540
|
+
aborted: zod.z.number().describe('Number of tests that were terminated prematurely before completion'),
|
|
2541
|
+
})
|
|
2542
|
+
.optional()
|
|
2543
|
+
.describe('Aggregated statistics summarizing test results across all batches. Counts tests by their visual comparison status.'),
|
|
2544
|
+
});
|
|
2545
|
+
|
|
2546
|
+
// Shared with `eyes_analyze_batch` so the wording (and the underlying URL
|
|
2547
|
+
// convention) stays in lock-step. See SESSION_URL_TILDA_SUFFIX in url-utils.
|
|
2548
|
+
const TILDA_WARNING_MESSAGE = TILDA_URL_WARNING;
|
|
2549
|
+
const TOOL_NAME$1 = TOOL_NAMES.EYES_FETCH_VISUAL_RESULTS;
|
|
2550
|
+
const TOOL_DESCRIPTION$1 = `Fetch current up-to-date visual test results from the Playwright HTML report and the Eyes server.
|
|
2289
2551
|
|
|
2290
2552
|
IMPORTANT:
|
|
2291
2553
|
- This tool reads the Playwright HTML report directly from disk.
|
|
@@ -2324,45 +2586,6 @@ const PlaywrightFetchVisualResultsInputSchema = commonInputSchema.extend({
|
|
|
2324
2586
|
.describe('Optional list of batch IDs extracted from the Playwright run output. When provided, the tool verifies these IDs appear in the report to confirm it is current and not stale from a previous run.'),
|
|
2325
2587
|
});
|
|
2326
2588
|
const PlaywrightFetchVisualResultsClientInputSchema = createClientInputSchema(PlaywrightFetchVisualResultsInputSchema);
|
|
2327
|
-
const VisualTestResultSchema = zod.z.object({
|
|
2328
|
-
testName: zod.z.string().describe('Name of the visual test'),
|
|
2329
|
-
batchName: zod.z.string().describe('Name of the batch this test belongs to'),
|
|
2330
|
-
status: zod.z
|
|
2331
|
-
.enum(['passed', 'failed', 'unresolved', 'new', 'aborted', 'running', 'empty'])
|
|
2332
|
-
.describe('Visual test status: "passed" - all checkpoints match baseline, "failed" - visual differences detected, "unresolved" - differences need review, "new" - first-time checkpoint with no baseline, "aborted" - test terminated prematurely'),
|
|
2333
|
-
sessionUrl: zod.z.string().describe('URL to the visual test results in the Eyes dashboard (may end with ~~)'),
|
|
2334
|
-
steps: zod.z.number().describe('Number of visual checkpoints in this test'),
|
|
2335
|
-
retryAttempt: zod.z.number().describe('Retry attempt number (0 for first attempt)'),
|
|
2336
|
-
browser: zod.z.string().describe('Browser/device configuration this test ran on'),
|
|
2337
|
-
});
|
|
2338
|
-
const BatchResultSchema = zod.z.object({
|
|
2339
|
-
batchId: zod.z.string().describe('Unique identifier for the batch'),
|
|
2340
|
-
batchName: zod.z.string().describe('Name of the batch'),
|
|
2341
|
-
batchUrl: zod.z.string().describe('URL to the batch results in the Eyes dashboard'),
|
|
2342
|
-
tests: zod.z.array(VisualTestResultSchema).describe('All visual tests within this batch'),
|
|
2343
|
-
});
|
|
2344
|
-
const FetchVisualResultsToolResultSchema = zod.z.object({
|
|
2345
|
-
message: zod.z.string().describe('Human-readable summary of the visual test results'),
|
|
2346
|
-
results: zod.z.array(BatchResultSchema).optional().describe('Detailed results grouped by batch'),
|
|
2347
|
-
summary: zod.z
|
|
2348
|
-
.object({
|
|
2349
|
-
totalBatches: zod.z.number().describe('Total number of batches'),
|
|
2350
|
-
totalTests: zod.z.number().describe('Total number of visual tests across all batches'),
|
|
2351
|
-
passed: zod.z
|
|
2352
|
-
.number()
|
|
2353
|
-
.describe('Number of tests where all visual checkpoints matched the baseline (no differences detected)'),
|
|
2354
|
-
failed: zod.z.number().describe('Number of tests with visual differences that were marked as failures after review'),
|
|
2355
|
-
unresolved: zod.z
|
|
2356
|
-
.number()
|
|
2357
|
-
.describe('Number of tests with visual differences that require human review and acceptance/rejection'),
|
|
2358
|
-
new: zod.z
|
|
2359
|
-
.number()
|
|
2360
|
-
.describe('Number of tests running for the first time with no existing baseline to compare against'),
|
|
2361
|
-
aborted: zod.z.number().describe('Number of tests that were terminated prematurely before completion'),
|
|
2362
|
-
})
|
|
2363
|
-
.optional()
|
|
2364
|
-
.describe('Aggregated statistics summarizing test results across all batches. Counts tests by their visual comparison status.'),
|
|
2365
|
-
});
|
|
2366
2589
|
function buildStaleReportWarning(expectedBatchIds, processedBatches) {
|
|
2367
2590
|
const reportBatchIds = new Set(processedBatches.map(b => b.batchId));
|
|
2368
2591
|
const missingBatchIds = expectedBatchIds.filter(id => !reportBatchIds.has(id));
|
|
@@ -2393,7 +2616,7 @@ async function playwrightFetchVisualResults(input) {
|
|
|
2393
2616
|
`2. Tests are using the Eyes fixture: import { test } from '@applitools/eyes-playwright/fixture'\n` +
|
|
2394
2617
|
`3. Visual checkpoints are added: await eyes.check('label')`, 'prefix'),
|
|
2395
2618
|
};
|
|
2396
|
-
return
|
|
2619
|
+
return VisualResultsToolResultSchema.parse(result);
|
|
2397
2620
|
}
|
|
2398
2621
|
throw parseError;
|
|
2399
2622
|
}
|
|
@@ -2407,10 +2630,10 @@ async function playwrightFetchVisualResults(input) {
|
|
|
2407
2630
|
message: wrapText(`${warning}Found Eyes test results but no sessions to query.\n\n` +
|
|
2408
2631
|
`This can happen if tests haven't completed yet.`, 'prefix'),
|
|
2409
2632
|
};
|
|
2410
|
-
return
|
|
2633
|
+
return VisualResultsToolResultSchema.parse(result);
|
|
2411
2634
|
}
|
|
2412
2635
|
// Step 4: Build final response
|
|
2413
|
-
const result =
|
|
2636
|
+
const result = buildVisualResultsResult(processedBatches);
|
|
2414
2637
|
if (warning)
|
|
2415
2638
|
result.message = warning + result.message;
|
|
2416
2639
|
// Step 5: Optionally verify expected batch IDs to detect stale reports
|
|
@@ -2419,7 +2642,7 @@ async function playwrightFetchVisualResults(input) {
|
|
|
2419
2642
|
if (staleWarning)
|
|
2420
2643
|
result.message = staleWarning + result.message;
|
|
2421
2644
|
}
|
|
2422
|
-
return
|
|
2645
|
+
return VisualResultsToolResultSchema.parse(result);
|
|
2423
2646
|
}
|
|
2424
2647
|
catch (error) {
|
|
2425
2648
|
// Handle file read errors
|
|
@@ -2428,32 +2651,32 @@ async function playwrightFetchVisualResults(input) {
|
|
|
2428
2651
|
message: wrapText(`${warning}Error reading Playwright report: ${error.message}\n\n` +
|
|
2429
2652
|
`Make sure the report exists at: ${reportPath}`, 'prefix'),
|
|
2430
2653
|
};
|
|
2431
|
-
return
|
|
2654
|
+
return VisualResultsToolResultSchema.parse(result);
|
|
2432
2655
|
}
|
|
2433
2656
|
// Handle parsing errors
|
|
2434
2657
|
if (error instanceof Error && error.message.includes('Malformed JSON')) {
|
|
2435
2658
|
const result = {
|
|
2436
2659
|
message: wrapText(`${warning}Error parsing Eyes test results from report: ${error.message}`, 'prefix'),
|
|
2437
2660
|
};
|
|
2438
|
-
return
|
|
2661
|
+
return VisualResultsToolResultSchema.parse(result);
|
|
2439
2662
|
}
|
|
2440
2663
|
// Generic error handling
|
|
2441
2664
|
const result = {
|
|
2442
2665
|
message: wrapText(`${warning}Error processing visual test results: ${error instanceof Error ? error.message : String(error)}`, 'prefix'),
|
|
2443
2666
|
};
|
|
2444
|
-
return
|
|
2667
|
+
return VisualResultsToolResultSchema.parse(result);
|
|
2445
2668
|
}
|
|
2446
2669
|
}
|
|
2447
2670
|
|
|
2448
2671
|
const playwrightFetchVisualResultsTool = {
|
|
2449
|
-
name: TOOL_NAME,
|
|
2450
|
-
description: TOOL_DESCRIPTION,
|
|
2672
|
+
name: TOOL_NAME$1,
|
|
2673
|
+
description: TOOL_DESCRIPTION$1,
|
|
2451
2674
|
inputSchema: PlaywrightFetchVisualResultsClientInputSchema,
|
|
2452
|
-
outputSchema:
|
|
2675
|
+
outputSchema: VisualResultsToolResultSchema,
|
|
2453
2676
|
handler: createToolHandler({
|
|
2454
|
-
name: TOOL_NAME,
|
|
2677
|
+
name: TOOL_NAME$1,
|
|
2455
2678
|
input: PlaywrightFetchVisualResultsInputSchema,
|
|
2456
|
-
output:
|
|
2679
|
+
output: VisualResultsToolResultSchema,
|
|
2457
2680
|
}, async (params) => {
|
|
2458
2681
|
const result = await playwrightFetchVisualResults(params);
|
|
2459
2682
|
return {
|
|
@@ -2468,6 +2691,447 @@ const playwrightFetchVisualResultsTool = {
|
|
|
2468
2691
|
}),
|
|
2469
2692
|
};
|
|
2470
2693
|
|
|
2694
|
+
/**
|
|
2695
|
+
* API client for the "Paste Batch URL" flow (AD-13206 Part 2).
|
|
2696
|
+
*
|
|
2697
|
+
* Uses two public v1 API endpoints:
|
|
2698
|
+
* 1. GET /api/v1/batches/{batchId}?steps=true — batch results with step-level diffs count
|
|
2699
|
+
* 2. GET /api/v1/batches/{batchId}/{sessionId}/{stepIndex}/diff — per-step diff descriptions
|
|
2700
|
+
*
|
|
2701
|
+
* Both authenticate with `X-Eyes-Api-Key` header only (no session tokens required).
|
|
2702
|
+
* Delegates HTTP concerns (retry, auth headers, timeouts) to the shared `ApiClient`.
|
|
2703
|
+
*
|
|
2704
|
+
* ## Concurrency cap (vs. pagination / throttling)
|
|
2705
|
+
*
|
|
2706
|
+
* The fan-out helper {@link fetchStepDiffsWithCap} caps the number of
|
|
2707
|
+
* **simultaneous in-flight** per-step `/diff` requests at
|
|
2708
|
+
* {@link DEFAULT_STEP_DIFF_CONCURRENCY} (10 by default). It is **not**:
|
|
2709
|
+
*
|
|
2710
|
+
* - **Pagination.** The Eyes BE returns the full diff for one
|
|
2711
|
+
* `(batchId, sessionId, stepIndex)` in one response — there is no page
|
|
2712
|
+
* cursor, no `nextPage`, no partial result; `stepIndex` is an identity
|
|
2713
|
+
* coordinate, not an offset. We always issue exactly one request per
|
|
2714
|
+
* step that has diffs and the BE never asks us to ask again.
|
|
2715
|
+
* - **Server-side throttling.** The Eyes BE does not advertise a per-key
|
|
2716
|
+
* concurrency budget for these endpoints; the cap is purely client-side
|
|
2717
|
+
* courtesy so that batches with hundreds of failing steps don't open
|
|
2718
|
+
* hundreds of sockets at once. Real throttling (HTTP 429) is handled
|
|
2719
|
+
* transparently by the shared `ApiClient` retry policy.
|
|
2720
|
+
*
|
|
2721
|
+
* In other words: we always request "all the data in one go", but we drip
|
|
2722
|
+
* the requests through a fixed-size worker pool.
|
|
2723
|
+
*/
|
|
2724
|
+
// ─── URL helpers ─────────────────────────────────────────────────────────────
|
|
2725
|
+
/**
|
|
2726
|
+
* Extract a batch ID from a full Applitools dashboard URL or return the value
|
|
2727
|
+
* as-is if it already looks like a plain batch ID.
|
|
2728
|
+
*
|
|
2729
|
+
* The regex anchors on `/app/test-results/` and captures everything up to
|
|
2730
|
+
* the next `/`, `?`, `#`, or whitespace, so deep links into a specific
|
|
2731
|
+
* session/step inside the batch resolve to the **batch ID** — not the
|
|
2732
|
+
* session ID — which is what every downstream API call expects.
|
|
2733
|
+
*
|
|
2734
|
+
* Examples:
|
|
2735
|
+
* https://eyes.applitools.com/app/test-results/00000251626130890241 → 00000251626130890241
|
|
2736
|
+
* https://eyes.applitools.com/app/test-results/00000251626130890241?some=param → 00000251626130890241
|
|
2737
|
+
* https://eyes.applitools.com/app/test-results/00000251626130890241#anchor → 00000251626130890241
|
|
2738
|
+
* https://eyes.applitools.com/app/test-results/00000251626130890241/00000251626130890242 → 00000251626130890241
|
|
2739
|
+
* https://eyes.applitools.com/app/test-results/00000251626130890241/00000251626130890242/other → 00000251626130890241
|
|
2740
|
+
* 00000251626130890241 → 00000251626130890241 (passthrough)
|
|
2741
|
+
*/
|
|
2742
|
+
function extractBatchId(urlOrId) {
|
|
2743
|
+
const match = urlOrId.match(/\/app\/test-results\/([^/?#\s]+)/);
|
|
2744
|
+
if (match)
|
|
2745
|
+
return match[1];
|
|
2746
|
+
return urlOrId.trim();
|
|
2747
|
+
}
|
|
2748
|
+
/**
|
|
2749
|
+
* Extract the Eyes server base URL from an Applitools batch URL.
|
|
2750
|
+
* Falls back to the defaultUrl if the input is not a valid URL.
|
|
2751
|
+
*
|
|
2752
|
+
* Example: https://eyes.applitools.com/app/test-results/... → https://eyes.applitools.com
|
|
2753
|
+
*/
|
|
2754
|
+
function extractServerUrl(urlOrId, defaultUrl = 'https://eyes.applitools.com') {
|
|
2755
|
+
try {
|
|
2756
|
+
const parsed = new URL(urlOrId);
|
|
2757
|
+
return `${parsed.protocol}//${parsed.host}`;
|
|
2758
|
+
}
|
|
2759
|
+
catch {
|
|
2760
|
+
return defaultUrl;
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
// ─── Batch Results API ────────────────────────────────────────────────────────
|
|
2764
|
+
/** Sentinel for a 404 from the Batch Results API — the batch ID does not exist. */
|
|
2765
|
+
class BatchNotFoundError extends Error {
|
|
2766
|
+
constructor(batchId) {
|
|
2767
|
+
super(`Batch not found: ${batchId}`);
|
|
2768
|
+
this.batchId = batchId;
|
|
2769
|
+
this.name = 'BatchNotFoundError';
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
/**
|
|
2773
|
+
* Fetch batch results from the public Batch Results API.
|
|
2774
|
+
*
|
|
2775
|
+
* Returns step-level data including `diffDescriptionsCount` per step. Throws
|
|
2776
|
+
* `InvalidApiKeyError` on 401 (via the shared client) and `BatchNotFoundError`
|
|
2777
|
+
* on 404 so the calling tool can render actionable messages.
|
|
2778
|
+
*/
|
|
2779
|
+
async function fetchBatchResults(batchId, apiKey, serverUrl) {
|
|
2780
|
+
const client = new ApiClient({ baseUrl: serverUrl, apiKey });
|
|
2781
|
+
const res = await client.getRaw(`api/v1/batches/${batchId}?steps=true`);
|
|
2782
|
+
if (res.status === 404)
|
|
2783
|
+
throw new BatchNotFoundError(batchId);
|
|
2784
|
+
if (!res.ok)
|
|
2785
|
+
throw new Error(`HTTP ${res.status}: ${res.statusText}`);
|
|
2786
|
+
return (await res.json());
|
|
2787
|
+
}
|
|
2788
|
+
// ─── Per-step diff API ────────────────────────────────────────────────────────
|
|
2789
|
+
/**
|
|
2790
|
+
* Fetch and deduplicate diff descriptions for a single step.
|
|
2791
|
+
*
|
|
2792
|
+
* Returns an empty array when:
|
|
2793
|
+
* - The step has no diffs (204 No Content)
|
|
2794
|
+
* - The request fails for any reason (graceful degradation)
|
|
2795
|
+
*
|
|
2796
|
+
* Deduplicates diff descriptions across pixel regions, since the same logical
|
|
2797
|
+
* difference can appear in multiple diff regions in the response.
|
|
2798
|
+
*/
|
|
2799
|
+
async function fetchStepDiff(client, batchId,
|
|
2800
|
+
/** In the Eyes API, testId and sessionId refer to the same entity. The Batch Results API calls it testId; this endpoint calls it sessionId. */
|
|
2801
|
+
sessionId, stepIndex) {
|
|
2802
|
+
var _a;
|
|
2803
|
+
try {
|
|
2804
|
+
const res = await client.getRaw(`api/v1/batches/${batchId}/${sessionId}/${stepIndex}/diff`);
|
|
2805
|
+
// 204 = matching step (no diffs)
|
|
2806
|
+
if (res.status === 204)
|
|
2807
|
+
return [];
|
|
2808
|
+
if (!res.ok)
|
|
2809
|
+
return [];
|
|
2810
|
+
const data = (await res.json());
|
|
2811
|
+
return deduplicateDiffDescriptions((_a = data.image1) !== null && _a !== void 0 ? _a : []);
|
|
2812
|
+
}
|
|
2813
|
+
catch (err) {
|
|
2814
|
+
// Surface auth errors loudly so the user sees "invalid API key" instead of
|
|
2815
|
+
// an empty diff list for every step. Everything else degrades gracefully
|
|
2816
|
+
// — one flaky per-step request must not fail the whole tool.
|
|
2817
|
+
if (err instanceof InvalidApiKeyError || err instanceof MissingApiKeyError) {
|
|
2818
|
+
throw err;
|
|
2819
|
+
}
|
|
2820
|
+
return [];
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
/**
|
|
2824
|
+
* Default ceiling on concurrent in-flight `/diff` requests. See the
|
|
2825
|
+
* "Concurrency cap" section at the top of the file for the rationale and
|
|
2826
|
+
* for why this is a client-side fan-out limit, not server pagination.
|
|
2827
|
+
*/
|
|
2828
|
+
const DEFAULT_STEP_DIFF_CONCURRENCY = 10;
|
|
2829
|
+
/**
|
|
2830
|
+
* Fetch per-step diffs for every step in `tasks`, in one go, but with a
|
|
2831
|
+
* client-side concurrency cap so we don't open one socket per step on big
|
|
2832
|
+
* failing batches. Results are returned in the same order as `tasks`.
|
|
2833
|
+
*
|
|
2834
|
+
* Important non-features (so reviewers don't have to ask):
|
|
2835
|
+
* - `stepIndex` is an **identity** coordinate, not a pagination cursor;
|
|
2836
|
+
* each `(batchId, sessionId, stepIndex)` returns a complete diff in
|
|
2837
|
+
* one shot.
|
|
2838
|
+
* - The cap is purely client-side. Real throttling (HTTP 429) is handled
|
|
2839
|
+
* by `ApiClient`'s retry policy; this function only limits how many
|
|
2840
|
+
* requests are awaited concurrently.
|
|
2841
|
+
* - A single `ApiClient` is shared across all fan-out calls so retry
|
|
2842
|
+
* config, auth headers, and connection state are reused.
|
|
2843
|
+
*/
|
|
2844
|
+
async function fetchStepDiffsWithCap(tasks, apiKey, serverUrl, concurrencyLimit = DEFAULT_STEP_DIFF_CONCURRENCY) {
|
|
2845
|
+
const client = new ApiClient({ baseUrl: serverUrl, apiKey });
|
|
2846
|
+
const results = new Array(tasks.length);
|
|
2847
|
+
let cursor = 0;
|
|
2848
|
+
async function processNext() {
|
|
2849
|
+
while (cursor < tasks.length) {
|
|
2850
|
+
const index = cursor++;
|
|
2851
|
+
const t = tasks[index];
|
|
2852
|
+
results[index] = await fetchStepDiff(client, t.batchId, t.sessionId, t.stepIndex);
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
const workers = Array.from({ length: Math.min(concurrencyLimit, tasks.length) }, processNext);
|
|
2856
|
+
await Promise.all(workers);
|
|
2857
|
+
return results;
|
|
2858
|
+
}
|
|
2859
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
2860
|
+
/**
|
|
2861
|
+
* Deduplicate diff descriptions across pixel diff regions.
|
|
2862
|
+
*
|
|
2863
|
+
* The per-step diff API can return the same logical difference (e.g. "text
|
|
2864
|
+
* changed") in multiple pixel regions of the image. This function collapses
|
|
2865
|
+
* them to unique `(baselineValue, checkpointValue, category)` tuples.
|
|
2866
|
+
*/
|
|
2867
|
+
function deduplicateDiffDescriptions(regions) {
|
|
2868
|
+
var _a;
|
|
2869
|
+
const seen = new Set();
|
|
2870
|
+
const result = [];
|
|
2871
|
+
for (const region of regions) {
|
|
2872
|
+
for (const desc of (_a = region.diffDescriptions) !== null && _a !== void 0 ? _a : []) {
|
|
2873
|
+
const key = `${desc.baselineValue}|||${desc.checkpointValue}|||${desc.category}`;
|
|
2874
|
+
if (!seen.has(key)) {
|
|
2875
|
+
seen.add(key);
|
|
2876
|
+
result.push({
|
|
2877
|
+
baselineValue: desc.baselineValue,
|
|
2878
|
+
checkpointValue: desc.checkpointValue,
|
|
2879
|
+
category: desc.category,
|
|
2880
|
+
});
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
return result;
|
|
2885
|
+
}
|
|
2886
|
+
|
|
2887
|
+
/**
|
|
2888
|
+
* Translate auth/transport errors thrown by `ApiClient` into actionable,
|
|
2889
|
+
* user-facing wording shared between every MCP tool that talks to the Eyes
|
|
2890
|
+
* server.
|
|
2891
|
+
*
|
|
2892
|
+
* Keeping this in one place means a wording change (or a new error class
|
|
2893
|
+
* like {@link InvalidApiKeyError}) is reflected everywhere automatically;
|
|
2894
|
+
* tools only have to add their own specialised cases (e.g. `BatchNotFoundError`
|
|
2895
|
+
* in `eyes_analyze_batch`) before falling through to {@link formatApiFetchError}.
|
|
2896
|
+
*/
|
|
2897
|
+
/**
|
|
2898
|
+
* Default, generic prefix used when the error has no recognised type. Tools
|
|
2899
|
+
* may override it via the `genericPrefix` option to add tool-specific
|
|
2900
|
+
* context (e.g. "Failed to fetch batch results: ...").
|
|
2901
|
+
*/
|
|
2902
|
+
const DEFAULT_GENERIC_PREFIX = 'Eyes server request failed: ';
|
|
2903
|
+
/**
|
|
2904
|
+
* Map an unknown error thrown by an `ApiClient` call to a single-string
|
|
2905
|
+
* message suitable for `wrapText()`-rendered tool output.
|
|
2906
|
+
*
|
|
2907
|
+
* Recognised cases:
|
|
2908
|
+
* - {@link InvalidApiKeyError}: tells the user to call the `eyes_verify_api_key`
|
|
2909
|
+
* MCP tool again, or set `APPLITOOLS_API_KEY`.
|
|
2910
|
+
* - {@link MissingApiKeyError}: same remediation, different opening.
|
|
2911
|
+
* - Anything else: prefix + `err.message` (or `String(err)` if not an Error).
|
|
2912
|
+
*
|
|
2913
|
+
* Tools with extra error classes should special-case those FIRST and only
|
|
2914
|
+
* fall through to this helper for the shared cases.
|
|
2915
|
+
*/
|
|
2916
|
+
function formatApiFetchError(err, options = {}) {
|
|
2917
|
+
var _a;
|
|
2918
|
+
if (err instanceof InvalidApiKeyError) {
|
|
2919
|
+
return (`Authentication failed: invalid API key. ` +
|
|
2920
|
+
`Please call the \`${TOOL_NAMES.EYES_VERIFY_API_KEY}\` MCP tool to refresh your credentials, ` +
|
|
2921
|
+
`or set a valid APPLITOOLS_API_KEY environment variable.`);
|
|
2922
|
+
}
|
|
2923
|
+
if (err instanceof MissingApiKeyError) {
|
|
2924
|
+
return (`No Applitools API key found. ` +
|
|
2925
|
+
`Please call the \`${TOOL_NAMES.EYES_VERIFY_API_KEY}\` MCP tool first, ` +
|
|
2926
|
+
`or set the APPLITOOLS_API_KEY environment variable.`);
|
|
2927
|
+
}
|
|
2928
|
+
const prefix = (_a = options.genericPrefix) !== null && _a !== void 0 ? _a : DEFAULT_GENERIC_PREFIX;
|
|
2929
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
2930
|
+
return `${prefix}${msg}`;
|
|
2931
|
+
}
|
|
2932
|
+
|
|
2933
|
+
/**
|
|
2934
|
+
* eyes_analyze_batch MCP tool — "Paste Batch URL" flow (AD-13206 Part 2).
|
|
2935
|
+
*
|
|
2936
|
+
* Accepts an Applitools batch URL or bare batch ID and returns visual test
|
|
2937
|
+
* results with textual diff descriptions. Unlike `eyes_fetch_visual_results`,
|
|
2938
|
+
* this tool does NOT require a Playwright HTML report on disk — it queries
|
|
2939
|
+
* the public Batch Results API directly.
|
|
2940
|
+
*
|
|
2941
|
+
* Data flow:
|
|
2942
|
+
* 1. Extract batch ID + server URL from the input URL
|
|
2943
|
+
* 2. Load API key (session cache → config files → env vars)
|
|
2944
|
+
* 3. GET /api/v1/batches/{batchId}?steps=true (via shared ApiClient)
|
|
2945
|
+
* 4. For every step with diffDescriptionsCount > 0:
|
|
2946
|
+
* GET /api/v1/batches/{batchId}/{sessionId}/{stepIndex}/diff
|
|
2947
|
+
* (≤10 concurrent; deduplicate across pixel regions)
|
|
2948
|
+
* 5. Build structured response in the same shape as eyes_fetch_visual_results
|
|
2949
|
+
*/
|
|
2950
|
+
// ─── Tool metadata ────────────────────────────────────────────────────────────
|
|
2951
|
+
const TOOL_NAME = TOOL_NAMES.EYES_ANALYZE_BATCH;
|
|
2952
|
+
const TOOL_DESCRIPTION = `Fetch visual test results and textual diff descriptions from an Applitools Eyes batch URL.
|
|
2953
|
+
|
|
2954
|
+
Use this tool when the user provides a batch URL from the Applitools dashboard (e.g. https://eyes.applitools.com/app/test-results/{batchId}) or a bare batch ID, and you need to analyze its visual test results without a Playwright HTML report on disk.
|
|
2955
|
+
|
|
2956
|
+
This is the counterpart to \`eyes_fetch_visual_results\` for cases where:
|
|
2957
|
+
- The user is looking at results from a CI run or a previous run
|
|
2958
|
+
- There is no Playwright report available locally
|
|
2959
|
+
- The user pastes a batch URL from the Eyes dashboard
|
|
2960
|
+
|
|
2961
|
+
The tool returns the same structured output as \`eyes_fetch_visual_results\`, including:
|
|
2962
|
+
- Per-test status (passed / failed / unresolved / new / aborted)
|
|
2963
|
+
- Textual diff descriptions for steps with visual differences
|
|
2964
|
+
- Aggregate summary statistics
|
|
2965
|
+
|
|
2966
|
+
Note: Textual diff descriptions require DOM-based diff analysis on the server side. Steps without DOM capture (e.g. Figma, mobile native) may not have diff descriptions even when diffs are present.`;
|
|
2967
|
+
// ─── Input / output schemas ───────────────────────────────────────────────────
|
|
2968
|
+
const AnalyzeBatchInputSchema = commonInputSchema.extend({
|
|
2969
|
+
batchUrl: zod.z
|
|
2970
|
+
.string()
|
|
2971
|
+
.describe('The Applitools Eyes batch URL (e.g. https://eyes.applitools.com/app/test-results/{batchId}) or a bare batch ID.'),
|
|
2972
|
+
serverUrl: zod.z
|
|
2973
|
+
.string()
|
|
2974
|
+
.optional()
|
|
2975
|
+
.describe('Eyes server base URL (optional, auto-detected from batchUrl or defaults to https://eyes.applitools.com). Set this for on-premises Eyes deployments.'),
|
|
2976
|
+
});
|
|
2977
|
+
const AnalyzeBatchClientInputSchema = createClientInputSchema(AnalyzeBatchInputSchema);
|
|
2978
|
+
// ─── Tool implementation ──────────────────────────────────────────────────────
|
|
2979
|
+
async function analyzeEyesBatch(input) {
|
|
2980
|
+
var _a, _b;
|
|
2981
|
+
const { workspaceRoot } = validateCommonInput(input);
|
|
2982
|
+
// Step 1 — Extract batch ID and server URL
|
|
2983
|
+
const batchId = extractBatchId(input.batchUrl);
|
|
2984
|
+
if (!batchId) {
|
|
2985
|
+
return VisualResultsToolResultSchema.parse({
|
|
2986
|
+
message: wrapText(`Could not extract a batch ID from: ${input.batchUrl}\n\n` +
|
|
2987
|
+
`Please provide a full Eyes batch URL (e.g. https://eyes.applitools.com/app/test-results/{batchId}) ` +
|
|
2988
|
+
`or a bare batch ID.`, 'prefix'),
|
|
2989
|
+
});
|
|
2990
|
+
}
|
|
2991
|
+
const serverUrl = (_a = input.serverUrl) !== null && _a !== void 0 ? _a : extractServerUrl(input.batchUrl, DEFAULT_SERVER_URL);
|
|
2992
|
+
// Step 2 — Load API key. Defer wording to the shared `formatApiFetchError`
|
|
2993
|
+
// helper so that any future copy change in one place propagates here too.
|
|
2994
|
+
const apiKey = getLastValidatedApiKey() || loadCredentials(workspaceRoot).apiKey;
|
|
2995
|
+
if (!apiKey) {
|
|
2996
|
+
return VisualResultsToolResultSchema.parse({
|
|
2997
|
+
message: wrapText(formatApiFetchError(new MissingApiKeyError()), 'prefix'),
|
|
2998
|
+
});
|
|
2999
|
+
}
|
|
3000
|
+
// Step 3 — Fetch batch results
|
|
3001
|
+
let batchData;
|
|
3002
|
+
try {
|
|
3003
|
+
batchData = await fetchBatchResults(batchId, apiKey, serverUrl);
|
|
3004
|
+
}
|
|
3005
|
+
catch (err) {
|
|
3006
|
+
return VisualResultsToolResultSchema.parse({
|
|
3007
|
+
message: wrapText(formatFetchError(err, batchId), 'prefix'),
|
|
3008
|
+
});
|
|
3009
|
+
}
|
|
3010
|
+
if (!batchData.tests || batchData.tests.length === 0) {
|
|
3011
|
+
return VisualResultsToolResultSchema.parse({
|
|
3012
|
+
message: wrapText(`Batch ${batchId} contains no tests.`, 'prefix'),
|
|
3013
|
+
});
|
|
3014
|
+
}
|
|
3015
|
+
// Step 4 — Fetch per-step diff descriptions for steps that have diffs
|
|
3016
|
+
const stepDiffsByTest = new Map();
|
|
3017
|
+
// Collect all steps that need diff data
|
|
3018
|
+
const diffTasks = [];
|
|
3019
|
+
for (const test of batchData.tests) {
|
|
3020
|
+
for (let i = 0; i < test.steps.length; i++) {
|
|
3021
|
+
const step = test.steps[i];
|
|
3022
|
+
if (step.diffDescriptionsCount > 0) {
|
|
3023
|
+
diffTasks.push({
|
|
3024
|
+
testId: test.testId,
|
|
3025
|
+
stepIndex: i,
|
|
3026
|
+
stepName: step.name,
|
|
3027
|
+
});
|
|
3028
|
+
}
|
|
3029
|
+
}
|
|
3030
|
+
}
|
|
3031
|
+
if (diffTasks.length > 0) {
|
|
3032
|
+
// Fetch all step diffs with concurrency cap. Auth errors propagate; other
|
|
3033
|
+
// per-step failures are absorbed inside fetchStepDiff and surface as [].
|
|
3034
|
+
let diffResults;
|
|
3035
|
+
try {
|
|
3036
|
+
diffResults = await fetchStepDiffsWithCap(diffTasks.map(t => ({ batchId, sessionId: t.testId, stepIndex: t.stepIndex })), apiKey, serverUrl);
|
|
3037
|
+
}
|
|
3038
|
+
catch (err) {
|
|
3039
|
+
return VisualResultsToolResultSchema.parse({
|
|
3040
|
+
message: wrapText(formatFetchError(err, batchId), 'prefix'),
|
|
3041
|
+
});
|
|
3042
|
+
}
|
|
3043
|
+
// Group results by testId
|
|
3044
|
+
for (let i = 0; i < diffTasks.length; i++) {
|
|
3045
|
+
const task = diffTasks[i];
|
|
3046
|
+
const descriptions = diffResults[i];
|
|
3047
|
+
if (descriptions.length > 0) {
|
|
3048
|
+
if (!stepDiffsByTest.has(task.testId)) {
|
|
3049
|
+
stepDiffsByTest.set(task.testId, []);
|
|
3050
|
+
}
|
|
3051
|
+
stepDiffsByTest.get(task.testId).push({
|
|
3052
|
+
stepIndex: task.stepIndex,
|
|
3053
|
+
stepName: task.stepName,
|
|
3054
|
+
diffDescriptions: descriptions,
|
|
3055
|
+
});
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
// Step 5 — Build ProcessedBatch compatible with the shared response builder
|
|
3060
|
+
//
|
|
3061
|
+
// The `~~` suffix on `sessionUrl` is the Eyes-dashboard sentinel meaning
|
|
3062
|
+
// "no access token attached" — it is NOT decorative and must not be
|
|
3063
|
+
// stripped or the link 404s. Both visual-results tools build the URL
|
|
3064
|
+
// through the shared `buildSessionUrl()` helper so the convention lives
|
|
3065
|
+
// in exactly one place (see SESSION_URL_TILDA_SUFFIX in utils/url-utils.ts).
|
|
3066
|
+
const batchUrl = buildBatchUrl(serverUrl, batchId);
|
|
3067
|
+
const batchName = ((_b = batchData.statistics) === null || _b === void 0 ? void 0 : _b.name) || batchId;
|
|
3068
|
+
const processedTests = batchData.tests.map(test => {
|
|
3069
|
+
var _a, _b, _c;
|
|
3070
|
+
const stepDiffs = (_a = stepDiffsByTest.get(test.testId)) !== null && _a !== void 0 ? _a : [];
|
|
3071
|
+
const browser = ((_b = test.env) === null || _b === void 0 ? void 0 : _b.app) || ((_c = test.env) === null || _c === void 0 ? void 0 : _c.device) || 'Unknown';
|
|
3072
|
+
return {
|
|
3073
|
+
testName: test.testName,
|
|
3074
|
+
batchName,
|
|
3075
|
+
status: normalizeStatus(test.status),
|
|
3076
|
+
sessionUrl: buildSessionUrl(serverUrl, batchId, test.testId),
|
|
3077
|
+
steps: test.steps.length,
|
|
3078
|
+
retryAttempt: 0,
|
|
3079
|
+
browser,
|
|
3080
|
+
...(stepDiffs.length > 0 ? { stepDiffs } : {}),
|
|
3081
|
+
};
|
|
3082
|
+
});
|
|
3083
|
+
const processedBatches = [
|
|
3084
|
+
{
|
|
3085
|
+
batchId,
|
|
3086
|
+
batchName,
|
|
3087
|
+
batchUrl,
|
|
3088
|
+
tests: processedTests,
|
|
3089
|
+
},
|
|
3090
|
+
];
|
|
3091
|
+
// Reuse the shared response builder for consistent output formatting
|
|
3092
|
+
const result = buildVisualResultsResult(processedBatches);
|
|
3093
|
+
return VisualResultsToolResultSchema.parse(result);
|
|
3094
|
+
}
|
|
3095
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
3096
|
+
/**
|
|
3097
|
+
* Translate a fetch error into actionable, user-facing wording.
|
|
3098
|
+
*
|
|
3099
|
+
* Specialises for {@link BatchNotFoundError} (this tool's own 404 sentinel),
|
|
3100
|
+
* then defers to the shared {@link formatApiFetchError} util so that
|
|
3101
|
+
* `InvalidApiKeyError` / `MissingApiKeyError` wording stays consistent with
|
|
3102
|
+
* `eyes_fetch_visual_results` (and any future MCP tool that talks to the
|
|
3103
|
+
* Eyes server).
|
|
3104
|
+
*/
|
|
3105
|
+
function formatFetchError(err, batchId) {
|
|
3106
|
+
if (err instanceof BatchNotFoundError) {
|
|
3107
|
+
return `Batch not found: ${batchId}. Verify the URL/batch ID and that the key has access to this batch.`;
|
|
3108
|
+
}
|
|
3109
|
+
return formatApiFetchError(err, { genericPrefix: 'Failed to fetch batch results: ' });
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
const analyzeEyesBatchTool = {
|
|
3113
|
+
name: TOOL_NAME,
|
|
3114
|
+
description: TOOL_DESCRIPTION,
|
|
3115
|
+
inputSchema: AnalyzeBatchClientInputSchema,
|
|
3116
|
+
outputSchema: VisualResultsToolResultSchema,
|
|
3117
|
+
handler: createToolHandler({
|
|
3118
|
+
name: TOOL_NAME,
|
|
3119
|
+
input: AnalyzeBatchInputSchema,
|
|
3120
|
+
output: VisualResultsToolResultSchema,
|
|
3121
|
+
}, async (params) => {
|
|
3122
|
+
const result = await analyzeEyesBatch(params);
|
|
3123
|
+
return {
|
|
3124
|
+
content: [
|
|
3125
|
+
{
|
|
3126
|
+
type: 'text',
|
|
3127
|
+
text: result.message,
|
|
3128
|
+
},
|
|
3129
|
+
],
|
|
3130
|
+
structuredContent: result,
|
|
3131
|
+
};
|
|
3132
|
+
}),
|
|
3133
|
+
};
|
|
3134
|
+
|
|
2471
3135
|
const ALL_TOOLS = {
|
|
2472
3136
|
verifyApiKey: verifyApiKeyTool,
|
|
2473
3137
|
eyesSetupProject: eyesSetupProjectTool,
|
|
@@ -2475,6 +3139,7 @@ const ALL_TOOLS = {
|
|
|
2475
3139
|
eyesAddCheckpointsToTest: eyesAddCheckpointsToTestTool,
|
|
2476
3140
|
getBatchUrlFromOutput: getBatchUrlFromOutputTool,
|
|
2477
3141
|
playwrightFetchVisualResults: playwrightFetchVisualResultsTool,
|
|
3142
|
+
analyzeEyesBatch: analyzeEyesBatchTool,
|
|
2478
3143
|
};
|
|
2479
3144
|
|
|
2480
3145
|
async function startServer() {
|