@mablhq/mabl-cli 2.72.12 → 2.72.15
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/browserLauncher/index.js +1 -1
- package/commands/mcp/mcp_cmds/tools/createTest.js +28 -0
- package/commands/mcp/mcp_cmds/tools/getCredentials.js +41 -0
- package/commands/mcp/mcp_cmds/tools/index.js +2 -0
- package/commands/mcp/mcp_cmds/tools/runTest.js +6 -1
- package/execution/index.js +2 -2
- package/package.json +6 -5
- package/proxy/index.js +1 -1
|
@@ -23,6 +23,14 @@ const runTest = (0, mcpMablTool_1.defineTool)({
|
|
|
23
23
|
On API tests this will be the endpoint to test.
|
|
24
24
|
Try to validate that the url is correct.
|
|
25
25
|
`),
|
|
26
|
+
credentialsId: zod_1.z
|
|
27
|
+
.string()
|
|
28
|
+
.describe('Optional. The id of the credentials to use for training the test. Cloud type credentials are not valid here. If not provided, the user will be prompted to select from available non-cloud credentials.')
|
|
29
|
+
.optional(),
|
|
30
|
+
withoutCredentials: zod_1.z
|
|
31
|
+
.boolean()
|
|
32
|
+
.describe('Optional. If true, the test will be created without credentials. If false, the user will be prompted to select from available non-cloud credentials.')
|
|
33
|
+
.optional(),
|
|
26
34
|
name: zod_1.z.string().describe('The name of the test'),
|
|
27
35
|
intent: zod_1.z.string().describe(`The intent of the test.
|
|
28
36
|
Be as detailed as possible.
|
|
@@ -64,6 +72,25 @@ const runTest = (0, mcpMablTool_1.defineTool)({
|
|
|
64
72
|
if (!params.environmentId) {
|
|
65
73
|
return (0, common_1.stringToToolResult)('environmentId is required when creating a test. Request the environment explicitly.', true);
|
|
66
74
|
}
|
|
75
|
+
const allCredentials = await mablApiClient.getCredentials(workspaceId, 500);
|
|
76
|
+
const nonCloudCredentials = allCredentials.filter((credential) => !credential.cloud_only);
|
|
77
|
+
if (params.credentialsId) {
|
|
78
|
+
const selectedCredential = allCredentials.find((cred) => cred.id === params.credentialsId);
|
|
79
|
+
if (!selectedCredential) {
|
|
80
|
+
return (0, common_1.stringToToolResult)(`Credential with id "${params.credentialsId}" not found.`, true);
|
|
81
|
+
}
|
|
82
|
+
if (selectedCredential.cloud_only) {
|
|
83
|
+
return (0, common_1.stringToToolResult)(`Cannot use Cloud Credentials [${params.credentialsId}] for test training. Cloud credentials are only available in cloud runs. Please use a non-cloud credential instead.`, true);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!params.credentialsId &&
|
|
87
|
+
nonCloudCredentials.length > 0 &&
|
|
88
|
+
!params.withoutCredentials) {
|
|
89
|
+
const credentialsList = nonCloudCredentials
|
|
90
|
+
.map((cred) => `- ${cred.name} (ID: ${cred.id}, Type: ${cred.type})`)
|
|
91
|
+
.join('\n');
|
|
92
|
+
return (0, common_1.stringToToolResult)(`Would you like to add credentials to this test? Here are the available non-cloud credentials:\n\n${credentialsList}\n\nIf you want to use one of these credentials, please specify the credentialsId parameter with the desired credential ID. If you don't want to use any credentials, you can proceed without specifying credentialsId and set withoutCredentials to true.`, false);
|
|
93
|
+
}
|
|
67
94
|
messaging_1.mablEventEmitter.resetOutputEventChannel();
|
|
68
95
|
let fullIntent = params.intent;
|
|
69
96
|
if (params.steps) {
|
|
@@ -81,6 +108,7 @@ const runTest = (0, mcpMablTool_1.defineTool)({
|
|
|
81
108
|
await (0, trainingSessions_1.trainNewTest)({
|
|
82
109
|
environmentId: params.environmentId,
|
|
83
110
|
applicationId: params.applicationId,
|
|
111
|
+
credentialsId: params.credentialsId,
|
|
84
112
|
url: params.url,
|
|
85
113
|
testName: params.name ?? 'New Test',
|
|
86
114
|
autoBranch: false,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mcpMablTool_1 = require("./mcpMablTool");
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const getCredentials = (0, mcpMablTool_1.defineTool)({
|
|
6
|
+
schema: {
|
|
7
|
+
name: 'get-credentials',
|
|
8
|
+
title: 'Get all mabl credentials',
|
|
9
|
+
description: 'Get all mabl credentials',
|
|
10
|
+
inputSchema: zod_1.z.object({}),
|
|
11
|
+
outputSchema: zod_1.z.object({
|
|
12
|
+
credentials: zod_1.z.array(zod_1.z.object({
|
|
13
|
+
id: zod_1.z.string(),
|
|
14
|
+
name: zod_1.z.string(),
|
|
15
|
+
type: zod_1.z.string(),
|
|
16
|
+
cloud_only: zod_1.z.boolean(),
|
|
17
|
+
})),
|
|
18
|
+
}),
|
|
19
|
+
type: 'readOnly',
|
|
20
|
+
},
|
|
21
|
+
handle: async (_, mablApiClient, _server, workspaceId) => {
|
|
22
|
+
const limit = 500;
|
|
23
|
+
const credentials = await mablApiClient.getCredentials(workspaceId, limit);
|
|
24
|
+
const credentialsResponse = credentials.map((credential) => ({
|
|
25
|
+
id: credential.id,
|
|
26
|
+
name: credential.name,
|
|
27
|
+
type: credential.type,
|
|
28
|
+
cloud_only: credential.cloud_only,
|
|
29
|
+
}));
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: 'text',
|
|
34
|
+
text: JSON.stringify({ credentials: credentialsResponse }, undefined, 2),
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
structuredContent: { credentials: credentialsResponse },
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
exports.default = [getCredentials];
|
|
@@ -8,6 +8,7 @@ const getTests_1 = __importDefault(require("./getTests"));
|
|
|
8
8
|
const getMablDeployment_1 = __importDefault(require("./getMablDeployment"));
|
|
9
9
|
const getTestResults_1 = __importDefault(require("./getTestResults"));
|
|
10
10
|
const getApplications_1 = __importDefault(require("./getApplications"));
|
|
11
|
+
const getCredentials_1 = __importDefault(require("./getCredentials"));
|
|
11
12
|
const analyzeFailure_1 = __importDefault(require("./analyzeFailure"));
|
|
12
13
|
const runTest_1 = __importDefault(require("./runTest"));
|
|
13
14
|
const exportToPlaywright_1 = __importDefault(require("./exportToPlaywright"));
|
|
@@ -17,6 +18,7 @@ const getPlanRunResult_1 = __importDefault(require("./getPlanRunResult"));
|
|
|
17
18
|
const getLatestPlanRuns_1 = __importDefault(require("./getLatestPlanRuns"));
|
|
18
19
|
exports.default = [
|
|
19
20
|
...getApplications_1.default,
|
|
21
|
+
...getCredentials_1.default,
|
|
20
22
|
...getEnvironments_1.default,
|
|
21
23
|
...getTests_1.default,
|
|
22
24
|
...getPlans_1.default,
|
|
@@ -21,6 +21,10 @@ const runTest = (0, mcpMablTool_1.defineTool)({
|
|
|
21
21
|
.string()
|
|
22
22
|
.describe('The id of the environment to run the test in'),
|
|
23
23
|
testId: zod_1.z.string().describe('The id of the test to run'),
|
|
24
|
+
credentialsId: zod_1.z
|
|
25
|
+
.string()
|
|
26
|
+
.describe('Optional. The id of the credentials to use for running the test. If not provided, the user will be prompted to select from available non-cloud credentials.')
|
|
27
|
+
.optional(),
|
|
24
28
|
}),
|
|
25
29
|
type: 'destructive',
|
|
26
30
|
outputSchema: runTestOutputSchema,
|
|
@@ -39,7 +43,8 @@ const runTest = (0, mcpMablTool_1.defineTool)({
|
|
|
39
43
|
.on(messaging_1.EventChannelMessageType.outputLogLine, logListener);
|
|
40
44
|
const result = await (0, run_1.run)({
|
|
41
45
|
id: params.testId,
|
|
42
|
-
'environment-id': params.environmentId
|
|
46
|
+
'environment-id': params.environmentId ?? '',
|
|
47
|
+
'credentials-id': params.credentialsId ?? '',
|
|
43
48
|
branch: 'master',
|
|
44
49
|
'branch-changes-only': false,
|
|
45
50
|
browser: 'chrome',
|