|
1 |
| -import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; |
| 1 | +import { trackMCP } from "../index.js"; |
2 | 2 | import { BrowserStackConfig } from "../lib/types.js";
|
| 3 | +import { fetchPercyChanges } from "./percy-change.js"; |
| 4 | +import { addListTestFiles } from "./list-test-files.js"; |
| 5 | +import { runPercyScan } from "./run-percy-scan.js"; |
| 6 | +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; |
3 | 7 | import { SetUpPercyParamsShape } from "./sdk-utils/common/schema.js";
|
4 | 8 | import { updateTestsWithPercyCommands } from "./add-percy-snapshots.js";
|
5 |
| -import { addListTestFiles } from "./list-test-files.js"; |
6 |
| -import { trackMCP } from "../index.js"; |
| 9 | +import { approveOrDeclinePercyBuild } from "./review-agent-utils/percy-approve-reject.js"; |
| 10 | + |
7 | 11 | import {
|
8 | 12 | setUpPercyHandler,
|
9 | 13 | setUpSimulatePercyChangeHandler,
|
10 | 14 | } from "./sdk-utils/handler.js";
|
| 15 | + |
11 | 16 | import {
|
12 | 17 | SETUP_PERCY_DESCRIPTION,
|
13 | 18 | SIMULATE_PERCY_CHANGE_DESCRIPTION,
|
14 | 19 | LIST_TEST_FILES_DESCRIPTION,
|
15 | 20 | PERCY_SNAPSHOT_COMMANDS_DESCRIPTION,
|
16 | 21 | } from "./sdk-utils/common/constants.js";
|
| 22 | + |
17 | 23 | import {
|
18 | 24 | ListTestFilesParamsShape,
|
19 | 25 | UpdateTestFileWithInstructionsParams,
|
20 | 26 | } from "./percy-snapshot-utils/constants.js";
|
21 | 27 |
|
| 28 | +import { |
| 29 | + RunPercyScanParamsShape, |
| 30 | + FetchPercyChangesParamsShape, |
| 31 | + ManagePercyBuildApprovalParamsShape, |
| 32 | +} from "./sdk-utils/common/schema.js"; |
| 33 | + |
22 | 34 | export function registerPercyTools(
|
23 | 35 | server: McpServer,
|
24 | 36 | config: BrowserStackConfig,
|
@@ -153,6 +165,33 @@ export function registerPercyTools(
|
153 | 165 | },
|
154 | 166 | );
|
155 | 167 |
|
| 168 | + tools.runPercyScan = server.tool( |
| 169 | + "runPercyScan", |
| 170 | + "Run a Percy visual test scan. Example prompts : Run this Percy build/scan.Never run percy scan/build without this tool", |
| 171 | + RunPercyScanParamsShape, |
| 172 | + async (args) => { |
| 173 | + return runPercyScan(args, config); |
| 174 | + }, |
| 175 | + ); |
| 176 | + |
| 177 | + tools.fetchPercyChanges = server.tool( |
| 178 | + "fetchPercyChanges", |
| 179 | + "Retrieves and summarizes all visual changes detected by Percy between the latest and previous builds, helping quickly review what has changed in your project.", |
| 180 | + FetchPercyChangesParamsShape, |
| 181 | + async (args) => { |
| 182 | + return await fetchPercyChanges(args, config); |
| 183 | + }, |
| 184 | + ); |
| 185 | + |
| 186 | + tools.managePercyBuildApproval = server.tool( |
| 187 | + "managePercyBuildApproval", |
| 188 | + "Approve or reject a Percy build", |
| 189 | + ManagePercyBuildApprovalParamsShape, |
| 190 | + async (args) => { |
| 191 | + return await approveOrDeclinePercyBuild(args, config); |
| 192 | + }, |
| 193 | + ); |
| 194 | + |
156 | 195 | return tools;
|
157 | 196 | }
|
158 | 197 |
|
|
0 commit comments