@loadmill/mcp 0.0.3 → 0.1.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.
- package/README.md +47 -37
- package/dist/constants.d.ts +10 -0
- package/dist/constants.js +16 -1
- package/dist/constants.js.map +1 -1
- package/dist/handlers/prompts/index.d.ts +2 -0
- package/dist/handlers/prompts/index.js +89 -0
- package/dist/handlers/prompts/index.js.map +1 -0
- package/dist/handlers/resources/index.d.ts +2 -0
- package/dist/handlers/resources/index.js +62 -0
- package/dist/handlers/resources/index.js.map +1 -0
- package/dist/handlers/shared.d.ts +4 -0
- package/dist/handlers/shared.js +45 -0
- package/dist/handlers/shared.js.map +1 -0
- package/dist/handlers/tools/index.d.ts +2 -0
- package/dist/handlers/tools/index.js +199 -0
- package/dist/handlers/tools/index.js.map +1 -0
- package/dist/{tools.js → handlers/tools/tasks.js} +144 -24
- package/dist/handlers/tools/tasks.js.map +1 -0
- package/dist/mcp-handler.js +6 -245
- package/dist/mcp-handler.js.map +1 -1
- package/package.json +15 -2
- package/dist/tools.js.map +0 -1
- /package/dist/{tools.d.ts → handlers/tools/tasks.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,45 +1,47 @@
|
|
|
1
1
|
# Loadmill MCP Server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Loadmill MCP server exposes Loadmill’s test-management APIs to any Model Context Protocol (MCP) client. Use it to search, run, write and validate Loadmill tests without leaving your MCP-enabled IDE or agent workflow.
|
|
4
4
|
|
|
5
5
|
## Use Cases
|
|
6
6
|
- Query Loadmill for information
|
|
7
7
|
- Execute Loadmill tests
|
|
8
|
-
- Write and maintain Loadmill tests
|
|
8
|
+
- Write and maintain Loadmill tests
|
|
9
9
|
|
|
10
|
-
*Note*:
|
|
10
|
+
*Note*: When working with MCPs, make sure your client runs in `Agent` mode.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## IDE Integration
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### VS Code
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
*Important*: You will have to generate a Loadmill API token from your [Loadmill account settings](https://app.loadmill.com/app/user/settings/security) to authenticate the MCP server.
|
|
17
|
+
```
|
|
17
18
|
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
"servers": {
|
|
20
|
+
"loadmill": {
|
|
21
|
+
"type": "stdio",
|
|
22
|
+
"command": "npx",
|
|
23
|
+
"args": ["@loadmill/mcp"],
|
|
24
|
+
"env": {
|
|
25
|
+
"LOADMILL_API_TOKEN": "${input:loadmill-api-token}"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"inputs": [
|
|
30
|
+
{
|
|
29
31
|
"id": "loadmill-api-token",
|
|
30
32
|
"type": "promptString",
|
|
31
33
|
"description": "Loadmill API token",
|
|
32
34
|
"password": true
|
|
33
|
-
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
34
37
|
}
|
|
35
|
-
|
|
38
|
+
```
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
### Cursor
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
```
|
|
43
|
+
{
|
|
41
44
|
"mcpServers": {
|
|
42
|
-
// other MCP servers...
|
|
43
45
|
"loadmill": {
|
|
44
46
|
"command": "npx",
|
|
45
47
|
"args": ["@loadmill/mcp"],
|
|
@@ -51,22 +53,30 @@ This package provides a STDIO-based MCP server. It is designed to be integrated
|
|
|
51
53
|
}
|
|
52
54
|
```
|
|
53
55
|
|
|
56
|
+
|
|
54
57
|
## MCP Capabilities
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
**Tools** – Supports `list_tools` and `call_tool`; each tool returns standard MCP text content:
|
|
60
|
+
- `search_test_suites` – Filter Loadmill test suites by text, dates, or labels.
|
|
61
|
+
- `search_test_suite_runs` – Search historical test-suite flow runs.
|
|
62
|
+
- `run_test_suite` – Trigger a test-suite execution by ID.
|
|
63
|
+
- `get_test_suite_run` – Retrieve run details (including flow run IDs).
|
|
64
|
+
- `get_test_suite_flow_run` – Inspect an individual flow run by ID.
|
|
65
|
+
- `search_test_plans` – Browse Loadmill test plans.
|
|
66
|
+
- `run_test_plans` – Start a plan with optional labels and parameter overrides.
|
|
67
|
+
- `get_test_plan_run` – Fetch plan-run status and metadata.
|
|
68
|
+
- `get_labels` – List team labels (id and description).
|
|
69
|
+
- `validate_test_suite` – Validate a local Loadmill test-suite JSON file against the official schema.
|
|
70
|
+
|
|
71
|
+
**Prompts** – Supports `list_prompts` and `get_prompt`:
|
|
72
|
+
- `investigate_failed_test` – Summarise a failed run and advise next steps.
|
|
73
|
+
- `create_test_suite` – Generate a Loadmill test-suite JSON that conforms to the schema resource.
|
|
57
74
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- Search Loadmill test suite runs.
|
|
61
|
-
- Run a specific test suite.
|
|
62
|
-
- Fetch details of a test suite run.
|
|
63
|
-
- Fetch details of a specific suite flow run.
|
|
64
|
-
- Search Loadmill test plans.
|
|
65
|
-
- Run a specific test plan (with optional labels/overrides).
|
|
66
|
-
- Fetch details of a test plan run.
|
|
67
|
-
- List all available labels in Loadmill.
|
|
75
|
+
**Resources** – Supports `list_resources` and `read_resource`:
|
|
76
|
+
- `loadmill://schemas/test-suite@v1` – JSON Schema (draft 2020-12) for Loadmill test suites. Responses are cached locally for an hour.
|
|
68
77
|
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
## Working with the Test-Suite Schema
|
|
79
|
+
- Use `validate_test_suite` to catch schema violations in local JSON files before uploading them to Loadmill.
|
|
80
|
+
- The `create_test_suite` prompt relies on the same schema resource, ensuring generated suites are schema-compliant.
|
|
71
81
|
|
|
72
|
-
|
|
82
|
+
Once connected, your MCP client can mix these tools, prompts, and resources to automate Loadmill QA workflows end-to-end.
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export declare const MCP_SERVER_NAME = "loadmill-mcp-server";
|
|
2
2
|
export declare const MCP_SERVER_VERSION = "0.0.1";
|
|
3
|
+
export declare const LOADMILL_URL: string;
|
|
4
|
+
export declare const ASSETS_URL: string;
|
|
5
|
+
export declare const API_URL: string;
|
|
3
6
|
export declare const SEARCH_TEST_SUITES = "search_test_suites";
|
|
4
7
|
export declare const SEARCH_TEST_SUITE_RUNS = "search_test_suite_runs";
|
|
5
8
|
export declare const RUN_TEST_SUITE = "run_test_suite";
|
|
@@ -9,4 +12,11 @@ export declare const SEARCH_TEST_PLAN = "search_test_plans";
|
|
|
9
12
|
export declare const RUN_TEST_PLAN = "run_test_plans";
|
|
10
13
|
export declare const GET_TEST_PLAN_RUN = "get_test_plan_run";
|
|
11
14
|
export declare const GET_LABELS = "get_labels";
|
|
15
|
+
export declare const GET_TEST_SUITE_SCHEMA = "get_test_suite_schema";
|
|
16
|
+
export declare const VALIDATE_TEST_SUITE = "validate_test_suite";
|
|
17
|
+
export declare const SCHEMA_TYPE: {
|
|
18
|
+
TEST_SUITE: string;
|
|
19
|
+
};
|
|
12
20
|
export declare const AVALIABLE_TOOLS: string[];
|
|
21
|
+
export declare const AVILABLE_PROMPTS: never[];
|
|
22
|
+
export declare const AVILABLE_RESOURCES: string[];
|
package/dist/constants.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AVALIABLE_TOOLS = exports.GET_LABELS = exports.GET_TEST_PLAN_RUN = exports.RUN_TEST_PLAN = exports.SEARCH_TEST_PLAN = exports.GET_TEST_SUITE_FLOW_RUN = exports.GET_TEST_SUITE_RUN = exports.RUN_TEST_SUITE = exports.SEARCH_TEST_SUITE_RUNS = exports.SEARCH_TEST_SUITES = exports.MCP_SERVER_VERSION = exports.MCP_SERVER_NAME = void 0;
|
|
3
|
+
exports.AVILABLE_RESOURCES = exports.AVILABLE_PROMPTS = exports.AVALIABLE_TOOLS = exports.SCHEMA_TYPE = exports.VALIDATE_TEST_SUITE = exports.GET_TEST_SUITE_SCHEMA = exports.GET_LABELS = exports.GET_TEST_PLAN_RUN = exports.RUN_TEST_PLAN = exports.SEARCH_TEST_PLAN = exports.GET_TEST_SUITE_FLOW_RUN = exports.GET_TEST_SUITE_RUN = exports.RUN_TEST_SUITE = exports.SEARCH_TEST_SUITE_RUNS = exports.SEARCH_TEST_SUITES = exports.API_URL = exports.ASSETS_URL = exports.LOADMILL_URL = exports.MCP_SERVER_VERSION = exports.MCP_SERVER_NAME = void 0;
|
|
4
4
|
exports.MCP_SERVER_NAME = 'loadmill-mcp-server';
|
|
5
5
|
exports.MCP_SERVER_VERSION = '0.0.1';
|
|
6
|
+
exports.LOADMILL_URL = process.env.LOADMILL_URL || 'https://app.loadmill.com';
|
|
7
|
+
exports.ASSETS_URL = exports.LOADMILL_URL + '/assets';
|
|
8
|
+
exports.API_URL = exports.LOADMILL_URL + '/api';
|
|
6
9
|
//tools
|
|
7
10
|
exports.SEARCH_TEST_SUITES = 'search_test_suites';
|
|
8
11
|
exports.SEARCH_TEST_SUITE_RUNS = 'search_test_suite_runs';
|
|
@@ -13,6 +16,11 @@ exports.SEARCH_TEST_PLAN = 'search_test_plans';
|
|
|
13
16
|
exports.RUN_TEST_PLAN = 'run_test_plans';
|
|
14
17
|
exports.GET_TEST_PLAN_RUN = 'get_test_plan_run';
|
|
15
18
|
exports.GET_LABELS = 'get_labels';
|
|
19
|
+
exports.GET_TEST_SUITE_SCHEMA = 'get_test_suite_schema';
|
|
20
|
+
exports.VALIDATE_TEST_SUITE = 'validate_test_suite';
|
|
21
|
+
exports.SCHEMA_TYPE = {
|
|
22
|
+
TEST_SUITE: 'loadmill://schemas/test-suite@v1',
|
|
23
|
+
};
|
|
16
24
|
exports.AVALIABLE_TOOLS = [
|
|
17
25
|
exports.SEARCH_TEST_SUITES,
|
|
18
26
|
exports.SEARCH_TEST_SUITE_RUNS,
|
|
@@ -23,5 +31,12 @@ exports.AVALIABLE_TOOLS = [
|
|
|
23
31
|
exports.SEARCH_TEST_PLAN,
|
|
24
32
|
exports.RUN_TEST_PLAN,
|
|
25
33
|
exports.GET_TEST_PLAN_RUN,
|
|
34
|
+
exports.VALIDATE_TEST_SUITE,
|
|
35
|
+
];
|
|
36
|
+
exports.AVILABLE_PROMPTS = [
|
|
37
|
+
// Add prompt-related constants here
|
|
38
|
+
];
|
|
39
|
+
exports.AVILABLE_RESOURCES = [
|
|
40
|
+
exports.GET_TEST_SUITE_SCHEMA,
|
|
26
41
|
];
|
|
27
42
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AACa,QAAA,eAAe,GAAG,qBAAqB,CAAC;AACxC,QAAA,kBAAkB,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AACa,QAAA,eAAe,GAAG,qBAAqB,CAAC;AACxC,QAAA,kBAAkB,GAAG,OAAO,CAAC;AAG7B,QAAA,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,0BAA0B,CAAC;AACtE,QAAA,UAAU,GAAG,oBAAY,GAAG,SAAS,CAAC;AACtC,QAAA,OAAO,GAAG,oBAAY,GAAG,MAAM,CAAC;AAE7C,OAAO;AACM,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAClD,QAAA,cAAc,GAAG,gBAAgB,CAAC;AAClC,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,uBAAuB,GAAG,yBAAyB,CAAC;AACpD,QAAA,gBAAgB,GAAG,mBAAmB,CAAC;AACvC,QAAA,aAAa,GAAG,gBAAgB,CAAC;AACjC,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AACxC,QAAA,UAAU,GAAG,YAAY,CAAC;AAC1B,QAAA,qBAAqB,GAAG,uBAAuB,CAAC;AAChD,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAE5C,QAAA,WAAW,GAAG;IACzB,UAAU,EAAE,kCAAkC;CAC/C,CAAC;AAEW,QAAA,eAAe,GAAG;IAC7B,0BAAkB;IAClB,8BAAsB;IACtB,sBAAc;IACd,0BAAkB;IAClB,+BAAuB;IACvB,kBAAU;IACV,wBAAgB;IAChB,qBAAa;IACb,yBAAiB;IACjB,2BAAmB;CACpB,CAAC;AAEW,QAAA,gBAAgB,GAAG;AAC9B,oCAAoC;CACrC,CAAC;AAEW,QAAA,kBAAkB,GAAG;IAChC,6BAAqB;CACtB,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handlers = void 0;
|
|
4
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
5
|
+
const utils_js_1 = require("../../utils.js");
|
|
6
|
+
exports.handlers = [
|
|
7
|
+
{
|
|
8
|
+
schema: types_js_1.ListPromptsRequestSchema,
|
|
9
|
+
handler: async (_request) => {
|
|
10
|
+
return { prompts };
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
schema: types_js_1.GetPromptRequestSchema,
|
|
15
|
+
handler: async (req) => {
|
|
16
|
+
const { name, arguments: args = {} } = req.params;
|
|
17
|
+
const prompt = prompts.find((p) => p.name === name);
|
|
18
|
+
if (!prompt) {
|
|
19
|
+
throw new Error(`Unknown prompt: ${name}`);
|
|
20
|
+
}
|
|
21
|
+
const required = (prompt.inputSchema?.required ?? []);
|
|
22
|
+
const missing = required.filter((k) => args[k] === undefined);
|
|
23
|
+
if (missing.length) {
|
|
24
|
+
throw new Error(`Missing required prompt arguments: ${missing.join(', ')}`);
|
|
25
|
+
}
|
|
26
|
+
const messages = prompt.messages.map((m) => ({
|
|
27
|
+
role: m.role,
|
|
28
|
+
content: (0, utils_js_1.fillTemplate)(m.content, args),
|
|
29
|
+
}));
|
|
30
|
+
return { messages };
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
const prompts = [
|
|
35
|
+
{
|
|
36
|
+
name: 'investigate_failed_test',
|
|
37
|
+
description: 'Analyze failed test results and suggest next steps',
|
|
38
|
+
messages: [
|
|
39
|
+
{
|
|
40
|
+
role: 'system',
|
|
41
|
+
content: 'You are a QA investigator. Explain failures clearly and suggest next steps.',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
role: 'user',
|
|
45
|
+
content: `The test '{{test_description}}' has failed.\n\n
|
|
46
|
+
Result:\n{{result}}\n\n
|
|
47
|
+
RedactableResult (extended data):\n{{redactableResult}}\n\n
|
|
48
|
+
Please explain the cause and suggest how to fix it.`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
inputSchema: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
test_description: { type: 'string' },
|
|
55
|
+
result: { type: 'string' },
|
|
56
|
+
redactableResult: { type: 'string' },
|
|
57
|
+
},
|
|
58
|
+
required: ['test_description', 'result', 'redactableResult'],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'create_test_suite',
|
|
63
|
+
description: 'Design a Loadmill test-suite JSON using the official schema',
|
|
64
|
+
messages: [
|
|
65
|
+
{
|
|
66
|
+
role: 'system',
|
|
67
|
+
content: `You are an expert in API testing.
|
|
68
|
+
Produce a valid Loadmill test-suite JSON strictly conforming to the schema returned by the get_test_suite_schema resource.
|
|
69
|
+
Favor clarity, maintainability, and minimal assumptions.`,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
role: 'user',
|
|
73
|
+
content: `Create a test-suite named "{{name}}" to test the following endpoints and behaviors:\n\n {{requirements}}\n\n
|
|
74
|
+
Constraints:\n- Include flows and request steps covering happy-path and key edge-cases.\n-
|
|
75
|
+
Use descriptive names for flows and steps.\n- Parameterize repeated values in suite.parameters when reasonable.\n-
|
|
76
|
+
Add basic assertions for status, response time, and core fields.\n- Output only JSON.`,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
inputSchema: {
|
|
80
|
+
type: 'object',
|
|
81
|
+
properties: {
|
|
82
|
+
name: { type: 'string' },
|
|
83
|
+
requirements: { type: 'string' },
|
|
84
|
+
},
|
|
85
|
+
required: ['name', 'requirements'],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/prompts/index.ts"],"names":[],"mappings":";;;AAAA,iEAG4C;AAG5C,6CAA8C;AAGjC,QAAA,QAAQ,GAAiB;IACpC;QACE,MAAM,EAAE,mCAAwB;QAChC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;YAC1B,OAAO,EAAE,OAAO,EAAE,CAAC;QACrB,CAAC;KACF;IACD;QACE,MAAM,EAAE,iCAAsB;QAC9B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YACrB,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;YAElD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YACpD,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;aAC5C;YAED,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,IAA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AO,EACL;;mEAEyD;aAC5D;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EACL;;;gGAGsF;aACzF;SACF;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACxB,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aACjC;YACD,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC;SACnC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handlers = void 0;
|
|
4
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
5
|
+
const shared_js_1 = require("../shared.js");
|
|
6
|
+
exports.handlers = [
|
|
7
|
+
{
|
|
8
|
+
schema: types_js_1.ListResourcesRequestSchema,
|
|
9
|
+
handler: async (_request) => {
|
|
10
|
+
const resources = [
|
|
11
|
+
{
|
|
12
|
+
name: 'loadmill-test-suite-schema',
|
|
13
|
+
title: 'Loadmill Test-Suite Schema',
|
|
14
|
+
uri: 'loadmill://schemas/test-suite@v1',
|
|
15
|
+
description: 'JSON Schema (draft 2020-12) describing the Loadmill test-suite format.',
|
|
16
|
+
mimeType: 'application/schema+json',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
return { resources };
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
schema: types_js_1.ReadResourceRequestSchema,
|
|
24
|
+
handler: async (request) => {
|
|
25
|
+
const uri = request?.params?.uri;
|
|
26
|
+
console.log('Reading resource with URI:', uri);
|
|
27
|
+
if (!uri) {
|
|
28
|
+
return {
|
|
29
|
+
contents: [
|
|
30
|
+
{
|
|
31
|
+
mimeType: 'text/plain',
|
|
32
|
+
text: 'Missing resource URI',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (uri === 'loadmill://schemas/test-suite@v1') {
|
|
38
|
+
const schema = await (0, shared_js_1.getSchema)(uri);
|
|
39
|
+
console.log('Fetched schema for URI:', uri);
|
|
40
|
+
return {
|
|
41
|
+
contents: [
|
|
42
|
+
{
|
|
43
|
+
uri,
|
|
44
|
+
mimeType: 'application/json',
|
|
45
|
+
text: schema,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// Unknown resource
|
|
51
|
+
return {
|
|
52
|
+
contents: [
|
|
53
|
+
{
|
|
54
|
+
mimeType: 'text/plain',
|
|
55
|
+
text: `Unknown resource: ${uri}`,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/resources/index.ts"],"names":[],"mappings":";;;AAAA,iEAG4C;AAE5C,4CAAyC;AAG5B,QAAA,QAAQ,GAAiB;IACpC;QACE,MAAM,EAAE,qCAA0B;QAClC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;YAC1B,MAAM,SAAS,GAAG;gBAChB;oBACE,IAAI,EAAE,4BAA4B;oBAClC,KAAK,EAAE,4BAA4B;oBACnC,GAAG,EAAE,kCAAkC;oBACvC,WAAW,EACT,wEAAwE;oBAC1E,QAAQ,EAAE,yBAAyB;iBACpC;aACF,CAAC;YAEF,OAAO,EAAE,SAAS,EAAE,CAAC;QACvB,CAAC;KACF;IACD;QACE,MAAM,EAAE,oCAAyB;QACjC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACzB,MAAM,GAAG,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC;YAEjC,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;YAC/C,IAAI,CAAC,GAAG,EAAE;gBACR,OAAO;oBACL,QAAQ,EAAE;wBACR;4BACE,QAAQ,EAAE,YAAY;4BACtB,IAAI,EAAE,sBAAsB;yBAC7B;qBACF;iBACF,CAAC;aACH;YAED,IAAI,GAAG,KAAK,kCAAkC,EAAE;gBAC9C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAS,EAAC,GAAG,CAAC,CAAC;gBACpC,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;gBAC5C,OAAO;oBACL,QAAQ,EAAE;wBACR;4BACE,GAAG;4BACH,QAAQ,EAAE,kBAAkB;4BAC5B,IAAI,EAAE,MAAM;yBACb;qBACF;iBACF,CAAC;aACH;YAED,mBAAmB;YACnB,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,QAAQ,EAAE,YAAY;wBACtB,IAAI,EAAE,qBAAqB,GAAG,EAAE;qBACjC;iBACF;aACF,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schemaTypeToSchemaURL = exports.getSchema = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const http_request_1 = require("../http-request");
|
|
6
|
+
const schemaCache = new Map();
|
|
7
|
+
async function getSchema(schemaType) {
|
|
8
|
+
try {
|
|
9
|
+
console.log('Getting schema with type:', schemaType);
|
|
10
|
+
const schemaUrl = getSchemaURLByType(schemaType);
|
|
11
|
+
const cached = schemaCache.get(schemaUrl);
|
|
12
|
+
if (cached) {
|
|
13
|
+
if (!cached.expiresAt || Date.now() < cached.expiresAt) {
|
|
14
|
+
return cached.text;
|
|
15
|
+
}
|
|
16
|
+
schemaCache.delete(schemaUrl);
|
|
17
|
+
}
|
|
18
|
+
const resp = await (0, http_request_1.sendHttpRequest)({ method: http_request_1.HttpMethods.GET, url: schemaUrl });
|
|
19
|
+
const text = resp.text;
|
|
20
|
+
const entry = {
|
|
21
|
+
text,
|
|
22
|
+
expiresAt: Date.now() + 60 * 60 * 1000, // Cache for 60 minutes
|
|
23
|
+
};
|
|
24
|
+
console.log('Cached schema:', entry);
|
|
25
|
+
schemaCache.set(schemaUrl, entry);
|
|
26
|
+
return entry.text;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error(`Failed to fetch schema for ${schemaType}:`, error);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.getSchema = getSchema;
|
|
34
|
+
exports.schemaTypeToSchemaURL = {
|
|
35
|
+
[constants_1.SCHEMA_TYPE.TEST_SUITE]: `${constants_1.ASSETS_URL}/schema/loadmill-test-suite.schema.v1.json`,
|
|
36
|
+
};
|
|
37
|
+
function getSchemaURLByType(schemaType) {
|
|
38
|
+
const schemaUrl = exports.schemaTypeToSchemaURL[schemaType];
|
|
39
|
+
//console.log('Resolved schema URL:', schemaUrl);
|
|
40
|
+
if (!schemaUrl) {
|
|
41
|
+
throw new Error(`Unknown schema type: ${schemaType}`);
|
|
42
|
+
}
|
|
43
|
+
return schemaUrl;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/handlers/shared.ts"],"names":[],"mappings":";;;AAAA,4CAAuD;AACvD,kDAA+D;AAO/D,MAAM,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;AAEjD,KAAK,UAAU,SAAS,CAAC,UAAkB;IAEhD,IAAI;QACF,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,UAAU,CAAC,CAAC;QACrD,MAAM,SAAS,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC1C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use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handlers = void 0;
|
|
4
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
5
|
+
const constants_js_1 = require("../../constants.js");
|
|
6
|
+
const tasks_js_1 = require("./tasks.js");
|
|
7
|
+
exports.handlers = [
|
|
8
|
+
{
|
|
9
|
+
schema: types_js_1.ListToolsRequestSchema,
|
|
10
|
+
handler: async () => {
|
|
11
|
+
const tools = [
|
|
12
|
+
{
|
|
13
|
+
name: constants_js_1.SEARCH_TEST_SUITES,
|
|
14
|
+
title: 'Search Test Suites',
|
|
15
|
+
description: 'A tool to search for Loadmill test suites. Returns a list of test suites',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
search: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'free text filter to search for test suites',
|
|
22
|
+
},
|
|
23
|
+
page: {
|
|
24
|
+
type: 'integer',
|
|
25
|
+
description: 'page number for pagination',
|
|
26
|
+
},
|
|
27
|
+
labels: {
|
|
28
|
+
type: 'array',
|
|
29
|
+
items: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'filter suites that have flows with these labels',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: constants_js_1.VALIDATE_TEST_SUITE,
|
|
39
|
+
title: 'Validate Test Suite',
|
|
40
|
+
description: 'Validates a test-suite file against the official JSON Schema.',
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
path: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'Path to a JSON file containing a Loadmill test-suite',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
required: ['path'],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: constants_js_1.SEARCH_TEST_SUITE_RUNS,
|
|
54
|
+
title: 'Search Test Suite Runs',
|
|
55
|
+
description: 'A tool to search for Loadmill test suite runs. Returns a list of test suite runs',
|
|
56
|
+
inputSchema: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
properties: {
|
|
59
|
+
search: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
description: 'free text filter to search for test suites',
|
|
62
|
+
},
|
|
63
|
+
page: {
|
|
64
|
+
type: 'integer',
|
|
65
|
+
description: 'page number for pagination',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: constants_js_1.RUN_TEST_SUITE,
|
|
72
|
+
title: 'Run Test Suite',
|
|
73
|
+
description: 'A tool to run a Loadmill test suite. Returns the id of the running suite',
|
|
74
|
+
inputSchema: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: {
|
|
77
|
+
id: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
description: 'ID of the test suite to run',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: constants_js_1.GET_TEST_SUITE_RUN,
|
|
86
|
+
title: 'Get Test Suite Run',
|
|
87
|
+
description: `A tool to get a Loadmill test suite run by its ID.
|
|
88
|
+
Returns the run details including the testSuiteFlowRuns list that can be fetched later and is useful for understanding the flow of the test run.`,
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: 'object',
|
|
91
|
+
properties: {
|
|
92
|
+
id: {
|
|
93
|
+
type: 'string',
|
|
94
|
+
description: 'ID of the test suite run to fetch',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: constants_js_1.GET_TEST_SUITE_FLOW_RUN,
|
|
101
|
+
title: 'Get Test Suite Flow Run',
|
|
102
|
+
description: `A tool to get a Loadmill test suite flow run by its ID.
|
|
103
|
+
Returns the run details. Use this when investigating the test run results.`,
|
|
104
|
+
inputSchema: {
|
|
105
|
+
type: 'object',
|
|
106
|
+
properties: {
|
|
107
|
+
flowRunId: {
|
|
108
|
+
type: 'string',
|
|
109
|
+
description: 'ID of the test suite flow run to fetch',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: constants_js_1.SEARCH_TEST_PLAN,
|
|
116
|
+
title: 'Search Test Plans',
|
|
117
|
+
description: 'A tool to search for Loadmill test plans. Returns a list of test plans with their descriptions (names) and the author\'s information.',
|
|
118
|
+
inputSchema: {
|
|
119
|
+
type: 'object',
|
|
120
|
+
properties: {
|
|
121
|
+
search: {
|
|
122
|
+
type: 'string',
|
|
123
|
+
description: 'free text filter to search for test suites',
|
|
124
|
+
},
|
|
125
|
+
page: {
|
|
126
|
+
type: 'integer',
|
|
127
|
+
description: 'page number for pagination',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: constants_js_1.RUN_TEST_PLAN,
|
|
134
|
+
title: 'Run a Test Plan',
|
|
135
|
+
description: 'A tool to run a Loadmill test plan. Returns the id of the running plan',
|
|
136
|
+
inputSchema: {
|
|
137
|
+
type: 'object',
|
|
138
|
+
properties: {
|
|
139
|
+
id: {
|
|
140
|
+
type: 'string',
|
|
141
|
+
description: 'ID of the test plan to run',
|
|
142
|
+
},
|
|
143
|
+
labels: {
|
|
144
|
+
type: 'array',
|
|
145
|
+
items: {
|
|
146
|
+
type: 'string',
|
|
147
|
+
description: 'filter suites that have flows with these labels',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
overrideParameters: {
|
|
151
|
+
type: 'string',
|
|
152
|
+
description: `Parameters to override in the test plan.
|
|
153
|
+
A string of comma separated list of key-value pairs, e.g. "param1=value1,param2=value2".`,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: constants_js_1.GET_TEST_PLAN_RUN,
|
|
160
|
+
title: 'Get Test Plan Run',
|
|
161
|
+
description: 'A tool to get a Loadmill test plan run by its ID. Returns the run details.',
|
|
162
|
+
inputSchema: {
|
|
163
|
+
type: 'object',
|
|
164
|
+
properties: {
|
|
165
|
+
id: {
|
|
166
|
+
type: 'string',
|
|
167
|
+
description: 'ID of the test plan run to fetch',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: constants_js_1.GET_LABELS,
|
|
174
|
+
title: 'Get Labels',
|
|
175
|
+
description: 'A tool to fetch all available labels in Loadmill.',
|
|
176
|
+
inputSchema: {
|
|
177
|
+
type: 'object',
|
|
178
|
+
properties: {},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
];
|
|
182
|
+
return { tools };
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
schema: types_js_1.CallToolRequestSchema,
|
|
187
|
+
handler: async (request) => {
|
|
188
|
+
if (!constants_js_1.AVALIABLE_TOOLS.includes(request.params.name)) {
|
|
189
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}`);
|
|
190
|
+
}
|
|
191
|
+
const tool = tasks_js_1.toolsTasks[request.params.name];
|
|
192
|
+
if (!tool) {
|
|
193
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}`);
|
|
194
|
+
}
|
|
195
|
+
return await tool(request.params);
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
];
|
|
199
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/tools/index.ts"],"names":[],"mappings":";;;AAAA,iEAK4C;AAE5C,qDAY4B;AAI5B,yCAAwC;A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YAED,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;KACF;CACF,CAAC"}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.toolsTasks = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const _2020_1 = __importDefault(require("ajv/dist/2020"));
|
|
8
|
+
const json_schema_draft_07_json_1 = __importDefault(require("ajv/dist/refs/json-schema-draft-07.json"));
|
|
9
|
+
const ajv_formats_1 = __importDefault(require("ajv-formats"));
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const http_request_js_1 = require("../../http-request.js");
|
|
13
|
+
const constants_js_1 = require("../../constants.js");
|
|
14
|
+
const utils_js_1 = require("../../utils.js");
|
|
15
|
+
const shared_js_1 = require("../shared.js");
|
|
9
16
|
// todo make sure all return in the same allowed pattern
|
|
10
17
|
exports.toolsTasks = {
|
|
11
18
|
[constants_js_1.SEARCH_TEST_SUITES]: async (params) => {
|
|
12
19
|
const args = params.arguments;
|
|
13
|
-
// eslint-disable-next-line no-console
|
|
14
20
|
console.log('Searching test suites with args:', args);
|
|
15
21
|
const response = await (0, http_request_js_1.sendHttpRequest)({
|
|
16
22
|
method: http_request_js_1.HttpMethods.GET,
|
|
17
|
-
url: `${
|
|
23
|
+
url: `${constants_js_1.API_URL}/test-suites`,
|
|
18
24
|
query: {
|
|
19
25
|
search: args.search || '',
|
|
20
26
|
filter: args.filter || 'All',
|
|
@@ -32,11 +38,10 @@ exports.toolsTasks = {
|
|
|
32
38
|
},
|
|
33
39
|
[constants_js_1.SEARCH_TEST_SUITE_RUNS]: async (params) => {
|
|
34
40
|
const args = params.arguments;
|
|
35
|
-
// eslint-disable-next-line no-console
|
|
36
41
|
console.log('Searching test suite runs with args:', args);
|
|
37
42
|
const response = await (0, http_request_js_1.sendHttpRequest)({
|
|
38
43
|
method: http_request_js_1.HttpMethods.GET,
|
|
39
|
-
url: `${
|
|
44
|
+
url: `${constants_js_1.API_URL}/test-suites-runs/flows`,
|
|
40
45
|
query: {
|
|
41
46
|
search: args.search || '',
|
|
42
47
|
filter: args.filter || 'All',
|
|
@@ -53,11 +58,10 @@ exports.toolsTasks = {
|
|
|
53
58
|
},
|
|
54
59
|
[constants_js_1.RUN_TEST_SUITE]: async (params) => {
|
|
55
60
|
const args = params.arguments;
|
|
56
|
-
// eslint-disable-next-line no-console
|
|
57
61
|
console.log('Running test suite with args:', args);
|
|
58
62
|
const response = await (0, http_request_js_1.sendHttpRequest)({
|
|
59
63
|
method: http_request_js_1.HttpMethods.POST,
|
|
60
|
-
url: `${
|
|
64
|
+
url: `${constants_js_1.API_URL}/test-suites/${args.id}/run`,
|
|
61
65
|
});
|
|
62
66
|
return {
|
|
63
67
|
content: [{
|
|
@@ -68,11 +72,10 @@ exports.toolsTasks = {
|
|
|
68
72
|
},
|
|
69
73
|
[constants_js_1.GET_TEST_SUITE_RUN]: async (params) => {
|
|
70
74
|
const args = params.arguments;
|
|
71
|
-
// eslint-disable-next-line no-console
|
|
72
75
|
console.log('Getting test suite run with args:', args);
|
|
73
76
|
const response = await (0, http_request_js_1.sendHttpRequest)({
|
|
74
77
|
method: http_request_js_1.HttpMethods.GET,
|
|
75
|
-
url: `${
|
|
78
|
+
url: `${constants_js_1.API_URL}/test-suites-runs/${args.id}`,
|
|
76
79
|
});
|
|
77
80
|
return {
|
|
78
81
|
content: [{
|
|
@@ -83,11 +86,10 @@ exports.toolsTasks = {
|
|
|
83
86
|
},
|
|
84
87
|
[constants_js_1.GET_TEST_SUITE_FLOW_RUN]: async (params) => {
|
|
85
88
|
const args = params.arguments;
|
|
86
|
-
// eslint-disable-next-line no-console
|
|
87
89
|
console.log('Getting test suite flow run with args:', args);
|
|
88
90
|
const response = await (0, http_request_js_1.sendHttpRequest)({
|
|
89
91
|
method: http_request_js_1.HttpMethods.GET,
|
|
90
|
-
url: `${
|
|
92
|
+
url: `${constants_js_1.API_URL}/test-suites-runs/flows/${args.flowRunId}`,
|
|
91
93
|
});
|
|
92
94
|
return {
|
|
93
95
|
content: [{
|
|
@@ -98,11 +100,10 @@ exports.toolsTasks = {
|
|
|
98
100
|
},
|
|
99
101
|
[constants_js_1.SEARCH_TEST_PLAN]: async (params) => {
|
|
100
102
|
const args = params.arguments;
|
|
101
|
-
// eslint-disable-next-line no-console
|
|
102
103
|
console.log('Searching test plans with args:', args);
|
|
103
104
|
const response = await (0, http_request_js_1.sendHttpRequest)({
|
|
104
105
|
method: http_request_js_1.HttpMethods.GET,
|
|
105
|
-
url: `${
|
|
106
|
+
url: `${constants_js_1.API_URL}/test-plans`,
|
|
106
107
|
query: {
|
|
107
108
|
search: args.search || '',
|
|
108
109
|
filter: args.filter || 'All',
|
|
@@ -119,14 +120,13 @@ exports.toolsTasks = {
|
|
|
119
120
|
},
|
|
120
121
|
[constants_js_1.RUN_TEST_PLAN]: async (params) => {
|
|
121
122
|
const args = params.arguments;
|
|
122
|
-
// eslint-disable-next-line no-console
|
|
123
123
|
console.log('Running test plan with args:', args);
|
|
124
124
|
// AI decides to use both for some reason
|
|
125
125
|
const overrideParameters = args.overrideParameters && (0, utils_js_1.toLoadmillParams)(args.overrideParameters);
|
|
126
126
|
const parameters = args.parameters && (0, utils_js_1.toLoadmillParams)(args.parameters);
|
|
127
127
|
const response = await (0, http_request_js_1.sendHttpRequest)({
|
|
128
128
|
method: http_request_js_1.HttpMethods.POST,
|
|
129
|
-
url: `${
|
|
129
|
+
url: `${constants_js_1.API_URL}/test-plans/${args.id}/run`,
|
|
130
130
|
body: {
|
|
131
131
|
labels: args.labels || [],
|
|
132
132
|
overrideParameters: overrideParameters || parameters || {},
|
|
@@ -141,11 +141,10 @@ exports.toolsTasks = {
|
|
|
141
141
|
},
|
|
142
142
|
[constants_js_1.GET_TEST_PLAN_RUN]: async (params) => {
|
|
143
143
|
const args = params.arguments;
|
|
144
|
-
// eslint-disable-next-line no-console
|
|
145
144
|
console.log('Getting test plan run with args:', args);
|
|
146
145
|
const response = await (0, http_request_js_1.sendHttpRequest)({
|
|
147
146
|
method: http_request_js_1.HttpMethods.GET,
|
|
148
|
-
url: `${
|
|
147
|
+
url: `${constants_js_1.API_URL}/test-plans-runs/${args.id}`,
|
|
149
148
|
});
|
|
150
149
|
return {
|
|
151
150
|
content: [{
|
|
@@ -156,11 +155,10 @@ exports.toolsTasks = {
|
|
|
156
155
|
},
|
|
157
156
|
[constants_js_1.GET_LABELS]: async (params) => {
|
|
158
157
|
const args = params.arguments;
|
|
159
|
-
// eslint-disable-next-line no-console
|
|
160
158
|
console.log('Getting labels with args:', args);
|
|
161
159
|
const response = await (0, http_request_js_1.sendHttpRequest)({
|
|
162
160
|
method: http_request_js_1.HttpMethods.GET,
|
|
163
|
-
url: `${
|
|
161
|
+
url: `${constants_js_1.API_URL}/labels`,
|
|
164
162
|
});
|
|
165
163
|
// drop the colors
|
|
166
164
|
const res = JSON.parse(response.text);
|
|
@@ -177,5 +175,127 @@ exports.toolsTasks = {
|
|
|
177
175
|
}],
|
|
178
176
|
};
|
|
179
177
|
},
|
|
178
|
+
[constants_js_1.VALIDATE_TEST_SUITE]: async (params) => {
|
|
179
|
+
const args = params.arguments || {};
|
|
180
|
+
const filePath = args.path;
|
|
181
|
+
if (!filePath || typeof filePath !== 'string') {
|
|
182
|
+
return {
|
|
183
|
+
content: [
|
|
184
|
+
{
|
|
185
|
+
type: 'text',
|
|
186
|
+
text: JSON.stringify({
|
|
187
|
+
valid: false,
|
|
188
|
+
error: 'Missing or invalid "path" argument',
|
|
189
|
+
}, null, 2),
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
const absPath = path_1.default.isAbsolute(filePath)
|
|
196
|
+
? filePath
|
|
197
|
+
: path_1.default.resolve(process.cwd(), filePath);
|
|
198
|
+
const raw = await fs_1.default.readFileSync(absPath);
|
|
199
|
+
let suite;
|
|
200
|
+
try {
|
|
201
|
+
suite = JSON.parse(raw.toString());
|
|
202
|
+
}
|
|
203
|
+
catch (e) {
|
|
204
|
+
return {
|
|
205
|
+
content: [
|
|
206
|
+
{
|
|
207
|
+
type: 'text',
|
|
208
|
+
text: JSON.stringify({
|
|
209
|
+
valid: false,
|
|
210
|
+
error: `Failed parsing JSON: ${e?.message || e}`,
|
|
211
|
+
}, null, 2),
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
const schemaText = await (0, shared_js_1.getSchema)(constants_js_1.SCHEMA_TYPE.TEST_SUITE);
|
|
217
|
+
console.log('Fetched schema for test suite:', typeof schemaText);
|
|
218
|
+
let schema;
|
|
219
|
+
try {
|
|
220
|
+
schema = JSON.parse(schemaText);
|
|
221
|
+
}
|
|
222
|
+
catch (e) {
|
|
223
|
+
console.error('Failed parsing schema JSON:', e);
|
|
224
|
+
return {
|
|
225
|
+
content: [
|
|
226
|
+
{
|
|
227
|
+
type: 'text',
|
|
228
|
+
text: JSON.stringify({
|
|
229
|
+
valid: false,
|
|
230
|
+
error: `Failed parsing schema JSON: ${e?.message || e}`,
|
|
231
|
+
}, null, 2),
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
const ajv = new _2020_1.default({ allErrors: true, strict: false });
|
|
237
|
+
(0, ajv_formats_1.default)(ajv);
|
|
238
|
+
// IMPORTANT: call on the INSTANCE
|
|
239
|
+
ajv.addMetaSchema(json_schema_draft_07_json_1.default);
|
|
240
|
+
let validateFn;
|
|
241
|
+
try {
|
|
242
|
+
validateFn = ajv.compile(schema);
|
|
243
|
+
}
|
|
244
|
+
catch (e) {
|
|
245
|
+
console.error('Failed compiling schema:', e);
|
|
246
|
+
return {
|
|
247
|
+
content: [
|
|
248
|
+
{
|
|
249
|
+
type: 'text',
|
|
250
|
+
text: JSON.stringify({
|
|
251
|
+
valid: false,
|
|
252
|
+
error: `Failed compiling schema: ${e?.message || e}`,
|
|
253
|
+
}, null, 2),
|
|
254
|
+
},
|
|
255
|
+
],
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
const valid = validateFn(suite);
|
|
259
|
+
if (valid) {
|
|
260
|
+
return {
|
|
261
|
+
content: [
|
|
262
|
+
{
|
|
263
|
+
type: 'text',
|
|
264
|
+
text: JSON.stringify({ valid: true }, null, 2),
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
const errors = (validateFn.errors || []).map((err) => ({
|
|
270
|
+
instancePath: err.instancePath,
|
|
271
|
+
keyword: err.keyword,
|
|
272
|
+
message: err.message,
|
|
273
|
+
params: err.params,
|
|
274
|
+
schemaPath: err.schemaPath,
|
|
275
|
+
}));
|
|
276
|
+
console.log('Validation errors found:', errors);
|
|
277
|
+
return {
|
|
278
|
+
content: [
|
|
279
|
+
{
|
|
280
|
+
type: 'text',
|
|
281
|
+
text: JSON.stringify({ valid: false, errors }, null, 2),
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
catch (err) {
|
|
287
|
+
return {
|
|
288
|
+
content: [
|
|
289
|
+
{
|
|
290
|
+
type: 'text',
|
|
291
|
+
text: JSON.stringify({
|
|
292
|
+
valid: false,
|
|
293
|
+
error: err?.message || String(err),
|
|
294
|
+
}, null, 2),
|
|
295
|
+
},
|
|
296
|
+
],
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
},
|
|
180
300
|
};
|
|
181
|
-
//# sourceMappingURL=
|
|
301
|
+
//# sourceMappingURL=tasks.js.map
|
|
@@ -0,0 +1 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ineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handlers = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const utils_js_1 = require("./utils.js");
|
|
4
|
+
const tools_1 = require("./handlers/tools");
|
|
5
|
+
const prompts_1 = require("./handlers/prompts");
|
|
6
|
+
const resources_1 = require("./handlers/resources");
|
|
8
7
|
exports.handlers = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const tools = [
|
|
13
|
-
{
|
|
14
|
-
name: constants_js_1.SEARCH_TEST_SUITES,
|
|
15
|
-
title: 'Search Test Suites',
|
|
16
|
-
description: 'A tool to search for Loadmill test suites. Returns a list of test suites',
|
|
17
|
-
inputSchema: {
|
|
18
|
-
type: 'object',
|
|
19
|
-
properties: {
|
|
20
|
-
search: {
|
|
21
|
-
type: 'string',
|
|
22
|
-
description: 'free text filter to search for test suites',
|
|
23
|
-
},
|
|
24
|
-
page: {
|
|
25
|
-
type: 'integer',
|
|
26
|
-
description: 'page number for pagination',
|
|
27
|
-
},
|
|
28
|
-
labels: {
|
|
29
|
-
type: 'array',
|
|
30
|
-
items: {
|
|
31
|
-
type: 'string',
|
|
32
|
-
description: 'filter suites that have flows with these labels',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: constants_js_1.SEARCH_TEST_SUITE_RUNS,
|
|
40
|
-
title: 'Search Test Suite Runs',
|
|
41
|
-
description: 'A tool to search for Loadmill test suite runs. Returns a list of test suite runs',
|
|
42
|
-
inputSchema: {
|
|
43
|
-
type: 'object',
|
|
44
|
-
properties: {
|
|
45
|
-
search: {
|
|
46
|
-
type: 'string',
|
|
47
|
-
description: 'free text filter to search for test suites',
|
|
48
|
-
},
|
|
49
|
-
page: {
|
|
50
|
-
type: 'integer',
|
|
51
|
-
description: 'page number for pagination',
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: constants_js_1.RUN_TEST_SUITE,
|
|
58
|
-
title: 'Run Test Suite',
|
|
59
|
-
description: 'A tool to run a Loadmill test suite. Returns the id of the running suite',
|
|
60
|
-
inputSchema: {
|
|
61
|
-
type: 'object',
|
|
62
|
-
properties: {
|
|
63
|
-
id: {
|
|
64
|
-
type: 'string',
|
|
65
|
-
description: 'ID of the test suite to run',
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: constants_js_1.GET_TEST_SUITE_RUN,
|
|
72
|
-
title: 'Get Test Suite Run',
|
|
73
|
-
description: `A tool to get a Loadmill test suite run by its ID.
|
|
74
|
-
Returns the run details including the testSuiteFlowRuns list that can be fetched later and is useful for understanding the flow of the test run.`,
|
|
75
|
-
inputSchema: {
|
|
76
|
-
type: 'object',
|
|
77
|
-
properties: {
|
|
78
|
-
id: {
|
|
79
|
-
type: 'string',
|
|
80
|
-
description: 'ID of the test suite run to fetch',
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: constants_js_1.GET_TEST_SUITE_FLOW_RUN,
|
|
87
|
-
title: 'Get Test Suite Flow Run',
|
|
88
|
-
description: `A tool to get a Loadmill test suite flow run by its ID.
|
|
89
|
-
Returns the run details. Use this when investigating the test run results.`,
|
|
90
|
-
inputSchema: {
|
|
91
|
-
type: 'object',
|
|
92
|
-
properties: {
|
|
93
|
-
flowRunId: {
|
|
94
|
-
type: 'string',
|
|
95
|
-
description: 'ID of the test suite flow run to fetch',
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: constants_js_1.SEARCH_TEST_PLAN,
|
|
102
|
-
title: 'Search Test Plans',
|
|
103
|
-
description: 'A tool to search for Loadmill test plans. Returns a list of test plans with their descriptions (names) and the author\'s information.',
|
|
104
|
-
inputSchema: {
|
|
105
|
-
type: 'object',
|
|
106
|
-
properties: {
|
|
107
|
-
search: {
|
|
108
|
-
type: 'string',
|
|
109
|
-
description: 'free text filter to search for test suites',
|
|
110
|
-
},
|
|
111
|
-
page: {
|
|
112
|
-
type: 'integer',
|
|
113
|
-
description: 'page number for pagination',
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: constants_js_1.RUN_TEST_PLAN,
|
|
120
|
-
title: 'Run a Test Plan',
|
|
121
|
-
description: 'A tool to run a Loadmill test plan. Returns the id of the running plan',
|
|
122
|
-
inputSchema: {
|
|
123
|
-
type: 'object',
|
|
124
|
-
properties: {
|
|
125
|
-
id: {
|
|
126
|
-
type: 'string',
|
|
127
|
-
description: 'ID of the test plan to run',
|
|
128
|
-
},
|
|
129
|
-
labels: {
|
|
130
|
-
type: 'array',
|
|
131
|
-
items: {
|
|
132
|
-
type: 'string',
|
|
133
|
-
description: 'filter suites that have flows with these labels',
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
overrideParameters: {
|
|
137
|
-
type: 'string',
|
|
138
|
-
description: `Parameters to override in the test plan.
|
|
139
|
-
A string of comma separated list of key-value pairs, e.g. "param1=value1,param2=value2".`,
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
name: constants_js_1.GET_TEST_PLAN_RUN,
|
|
146
|
-
title: 'Get Test Plan Run',
|
|
147
|
-
description: 'A tool to get a Loadmill test plan run by its ID. Returns the run details.',
|
|
148
|
-
inputSchema: {
|
|
149
|
-
type: 'object',
|
|
150
|
-
properties: {
|
|
151
|
-
id: {
|
|
152
|
-
type: 'string',
|
|
153
|
-
description: 'ID of the test plan run to fetch',
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
name: constants_js_1.GET_LABELS,
|
|
160
|
-
title: 'Get Labels',
|
|
161
|
-
description: 'A tool to fetch all available labels in Loadmill.',
|
|
162
|
-
inputSchema: {
|
|
163
|
-
type: 'object',
|
|
164
|
-
properties: {},
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
];
|
|
168
|
-
return { tools };
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
schema: types_js_1.CallToolRequestSchema,
|
|
173
|
-
handler: async (request) => {
|
|
174
|
-
if (!constants_js_1.AVALIABLE_TOOLS.includes(request.params.name)) {
|
|
175
|
-
throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}`);
|
|
176
|
-
}
|
|
177
|
-
const tool = tools_js_1.toolsTasks[request.params.name];
|
|
178
|
-
if (!tool) {
|
|
179
|
-
throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}`);
|
|
180
|
-
}
|
|
181
|
-
return await tool(request.params);
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
schema: types_js_1.ListPromptsRequestSchema,
|
|
186
|
-
handler: async (_request) => {
|
|
187
|
-
return { prompts };
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
schema: types_js_1.GetPromptRequestSchema,
|
|
192
|
-
handler: async (req) => {
|
|
193
|
-
const { name, arguments: args = {} } = req.params;
|
|
194
|
-
const prompt = prompts.find((p) => p.name === name);
|
|
195
|
-
if (!prompt) {
|
|
196
|
-
throw new Error(`Unknown prompt: ${name}`);
|
|
197
|
-
}
|
|
198
|
-
const required = (prompt.inputSchema?.required ?? []);
|
|
199
|
-
const missing = required.filter((k) => args[k] === undefined);
|
|
200
|
-
if (missing.length) {
|
|
201
|
-
throw new Error(`Missing required prompt arguments: ${missing.join(', ')}`);
|
|
202
|
-
}
|
|
203
|
-
const messages = prompt.messages.map((m) => ({
|
|
204
|
-
role: m.role,
|
|
205
|
-
content: (0, utils_js_1.fillTemplate)(m.content, args),
|
|
206
|
-
}));
|
|
207
|
-
return { messages };
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
schema: types_js_1.ListResourcesRequestSchema,
|
|
212
|
-
handler: async (_request) => {
|
|
213
|
-
// Handle the request
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
schema: types_js_1.ReadResourceRequestSchema,
|
|
218
|
-
handler: async (_request) => {
|
|
219
|
-
// Handle the request
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
];
|
|
223
|
-
const prompts = [
|
|
224
|
-
{
|
|
225
|
-
name: 'investigate_failed_test',
|
|
226
|
-
description: 'Analyze failed test results and suggest next steps',
|
|
227
|
-
messages: [
|
|
228
|
-
{
|
|
229
|
-
role: 'system',
|
|
230
|
-
content: 'You are a QA investigator. Explain failures clearly and suggest next steps.',
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
role: 'user',
|
|
234
|
-
content: `The test '{{test_description}}' has failed.\n\n
|
|
235
|
-
Result:\n{{result}}\n\n
|
|
236
|
-
RedactableResult (extended data):\n{{redactableResult}}\n\n
|
|
237
|
-
Please explain the cause and suggest how to fix it.`,
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
inputSchema: {
|
|
241
|
-
type: 'object',
|
|
242
|
-
properties: {
|
|
243
|
-
test_description: { type: 'string' },
|
|
244
|
-
result: { type: 'string' },
|
|
245
|
-
redactableResult: { type: 'string' },
|
|
246
|
-
},
|
|
247
|
-
required: ['test_description', 'result', 'redactableResult'],
|
|
248
|
-
},
|
|
249
|
-
},
|
|
8
|
+
...tools_1.handlers,
|
|
9
|
+
...prompts_1.handlers,
|
|
10
|
+
...resources_1.handlers,
|
|
250
11
|
];
|
|
251
12
|
//# sourceMappingURL=mcp-handler.js.map
|
package/dist/mcp-handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-handler.js","sourceRoot":"","sources":["../src/mcp-handler.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"mcp-handler.js","sourceRoot":"","sources":["../src/mcp-handler.ts"],"names":[],"mappings":";;;AAAA,4CAA6D;AAC7D,gDAAiE;AACjE,oDAAqE;AAOxD,QAAA,QAAQ,GAAiB;IACpC,GAAG,gBAAa;IAChB,GAAG,kBAAe;IAClB,GAAG,oBAAiB;CACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loadmill/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Loadmill mcp library",
|
|
5
5
|
"main": "dist/",
|
|
6
6
|
"module": "src/",
|
|
@@ -19,6 +19,19 @@
|
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@modelcontextprotocol/sdk": "^1.17.2",
|
|
22
|
+
"ajv": "^8.17.1",
|
|
23
|
+
"ajv-formats": "^3.0.1",
|
|
22
24
|
"superagent": "^10.0.1"
|
|
23
|
-
}
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"mcp",
|
|
28
|
+
"loadmill",
|
|
29
|
+
"model-context-protocol",
|
|
30
|
+
"testing",
|
|
31
|
+
"automation",
|
|
32
|
+
"ai",
|
|
33
|
+
"llm",
|
|
34
|
+
"agent",
|
|
35
|
+
"cli"
|
|
36
|
+
]
|
|
24
37
|
}
|
package/dist/tools.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":";;;AAAA,uDAAiE;AACjE,iDAUwB;AACxB,yCAA8C;AAM9C,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,0BAA0B,CAAC;AAC5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