@skyramp/mcp 0.0.15 → 0.0.17
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/build/index.js +8 -0
- package/build/resources/modulazrizationInstructions.js +15 -0
- package/build/services/ModularizationService.js +9 -104
- package/build/services/TestGenerationService.js +4 -7
- package/build/tools/executeSkyrampTestTool.js +11 -3
- package/build/tools/fixErrorTool.js +44 -0
- package/build/tools/generateIntegrationRestTool.js +5 -2
- package/build/tools/generateUIRestTool.js +5 -2
- package/build/tools/modularizationTool.js +33 -0
- package/build/types/TestTypes.js +16 -13
- package/build/utils/language-helper.js +17 -5
- package/build/utils/modularization-prompts.js +20 -2
- package/package.json +2 -2
- package/build/tools/generateModularizationTool.js +0 -56
package/build/index.js
CHANGED
|
@@ -16,6 +16,9 @@ import { registerIntegrationTestTool } from "./tools/generateIntegrationRestTool
|
|
|
16
16
|
import { registerE2ETestTool } from "./tools/generateE2ERestTool.js";
|
|
17
17
|
import { registerLoginTool } from "./tools/loginTool.js";
|
|
18
18
|
import { registerLogoutTool } from "./tools/logoutTool.js";
|
|
19
|
+
import { registerModularizationInstructions } from "./resources/modulazrizationInstructions.js";
|
|
20
|
+
import { registerFixErrorTool } from "./tools/fixErrorTool.js";
|
|
21
|
+
import { registerModularizationTool } from "./tools/modularizationTool.js";
|
|
19
22
|
const server = new McpServer({
|
|
20
23
|
name: "Skyramp MCP Server",
|
|
21
24
|
version: "1.0.0",
|
|
@@ -32,6 +35,8 @@ logger.info("Starting prompt registration process");
|
|
|
32
35
|
registerTestGenerationPrompt(server);
|
|
33
36
|
registerStartTraceCollectionPrompt(server);
|
|
34
37
|
logger.info("All prompts registered successfully");
|
|
38
|
+
// Register resources
|
|
39
|
+
registerModularizationInstructions(server);
|
|
35
40
|
// Register test generation tools
|
|
36
41
|
registerSmokeTestTool(server);
|
|
37
42
|
registerFuzzTestTool(server);
|
|
@@ -40,6 +45,9 @@ registerLoadTestTool(server);
|
|
|
40
45
|
registerIntegrationTestTool(server);
|
|
41
46
|
registerE2ETestTool(server);
|
|
42
47
|
registerUITestTool(server);
|
|
48
|
+
// Register modularization and fix error tools
|
|
49
|
+
registerModularizationTool(server);
|
|
50
|
+
registerFixErrorTool(server);
|
|
43
51
|
// Register other Skyramp tools
|
|
44
52
|
registerLoginTool(server);
|
|
45
53
|
registerLogoutTool(server);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getFixErrorsPrompt, getModularizationPrompt, } from "../utils/modularization-prompts.js";
|
|
2
|
+
export function registerModularizationInstructions(mcpServer) {
|
|
3
|
+
mcpServer.resource("modularization_instructions", "mcp://modularization_instructions", async () => ({
|
|
4
|
+
contents: [
|
|
5
|
+
{
|
|
6
|
+
uri: "mcp://modularization_instructions",
|
|
7
|
+
mimeType: "text/markdown",
|
|
8
|
+
text: `
|
|
9
|
+
${getModularizationPrompt()}
|
|
10
|
+
${getFixErrorsPrompt()}
|
|
11
|
+
`,
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
@@ -1,109 +1,14 @@
|
|
|
1
|
-
import { logger } from "../utils/logger.js";
|
|
2
1
|
import { getModularizationPrompt } from "../utils/modularization-prompts.js";
|
|
3
2
|
export class ModularizationService {
|
|
4
|
-
constructor() {
|
|
5
|
-
// Initialize any required dependencies
|
|
6
|
-
}
|
|
3
|
+
constructor() { }
|
|
7
4
|
async processModularizationRequest(params) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
promptLength: params.prompt.length,
|
|
17
|
-
contextType: params.contextType,
|
|
18
|
-
includeModularization: params.includeModularization,
|
|
19
|
-
});
|
|
20
|
-
return {
|
|
21
|
-
content: [
|
|
22
|
-
{
|
|
23
|
-
type: "text",
|
|
24
|
-
text: finalResponse,
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
isError: false,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
logger.error("Error in modularization service", {
|
|
32
|
-
error: error instanceof Error ? error.message : String(error),
|
|
33
|
-
});
|
|
34
|
-
return {
|
|
35
|
-
content: [
|
|
36
|
-
{
|
|
37
|
-
type: "text",
|
|
38
|
-
text: `Modularization service failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
isError: true,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
validateInputs(params) {
|
|
46
|
-
const errors = [];
|
|
47
|
-
if (!params.prompt || params.prompt.trim().length === 0) {
|
|
48
|
-
errors.push("Prompt cannot be empty");
|
|
49
|
-
}
|
|
50
|
-
if (params.prompt && params.prompt.length > 10000) {
|
|
51
|
-
errors.push("Prompt is too long (maximum 10,000 characters)");
|
|
52
|
-
}
|
|
53
|
-
if (errors.length > 0) {
|
|
54
|
-
return {
|
|
55
|
-
content: [
|
|
56
|
-
{
|
|
57
|
-
type: "text",
|
|
58
|
-
text: `Validation errors:\n${errors
|
|
59
|
-
.map((err) => `- ${err}`)
|
|
60
|
-
.join("\n")}`,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
isError: true,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
return { content: [], isError: false };
|
|
67
|
-
}
|
|
68
|
-
buildModularizationResponse(params) {
|
|
69
|
-
const contextPrefix = this.getContextPrefix(params.contextType || "general");
|
|
70
|
-
const processedPrompt = this.processPrompt(params.prompt);
|
|
71
|
-
return `${contextPrefix}
|
|
72
|
-
|
|
73
|
-
**Processed Prompt:** "${processedPrompt}"
|
|
74
|
-
|
|
75
|
-
**MCP Modularization Context:**
|
|
76
|
-
This tool has received and processed your prompt within the MCP (Model Context Protocol) framework with modularization principles applied. Since this MCP tool is being called by an LLM (like Claude), the LLM should now respond to the original prompt with structured, modularized output.
|
|
77
|
-
|
|
78
|
-
**Original Prompt:**
|
|
79
|
-
"${params.prompt}"
|
|
80
|
-
|
|
81
|
-
**Instructions for LLM:**
|
|
82
|
-
The LLM should provide a comprehensive, modularized response based on the prompt content, applying modularization principles to structure the output with logical grouping, clear separation of concerns, and maintainable organization.`;
|
|
83
|
-
}
|
|
84
|
-
getContextPrefix(contextType) {
|
|
85
|
-
switch (contextType) {
|
|
86
|
-
case "technical":
|
|
87
|
-
return "**Technical Context Analysis:**\nProcessing technical prompt with specialized context handling.";
|
|
88
|
-
case "creative":
|
|
89
|
-
return "**Creative Context Analysis:**\nProcessing creative prompt with enhanced imaginative context.";
|
|
90
|
-
default:
|
|
91
|
-
return "**General Context Analysis:**\nProcessing prompt with standard context handling.";
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
processPrompt(prompt) {
|
|
95
|
-
// Apply basic prompt processing (trim, normalize whitespace)
|
|
96
|
-
return prompt.trim().replace(/\s+/g, " ");
|
|
97
|
-
}
|
|
98
|
-
applyModularization(response, params) {
|
|
99
|
-
if (params.includeModularization) {
|
|
100
|
-
return `${response}
|
|
101
|
-
|
|
102
|
-
${getModularizationPrompt()}
|
|
103
|
-
|
|
104
|
-
**Modularization Applied:**
|
|
105
|
-
The response has been structured using modularization principles to improve readability and maintainability.`;
|
|
106
|
-
}
|
|
107
|
-
return response;
|
|
5
|
+
return {
|
|
6
|
+
content: [
|
|
7
|
+
{
|
|
8
|
+
type: "text",
|
|
9
|
+
text: `${getModularizationPrompt()}`,
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
};
|
|
108
13
|
}
|
|
109
14
|
}
|
|
@@ -2,7 +2,6 @@ import { SkyrampClient } from "@skyramp/skyramp";
|
|
|
2
2
|
import { analyzeOpenAPIWithGivenEndpoint } from "../utils/analyze-openapi.js";
|
|
3
3
|
import { getPathParameterValidationError, OUTPUT_DIR_FIELD_NAME, PATH_PARAMS_FIELD_NAME, QUERY_PARAMS_FIELD_NAME, FORM_PARAMS_FIELD_NAME, validateParams, validatePath, validateRequestData, TELEMETRY_entrypoint_FIELD_NAME, } from "../utils/utils.js";
|
|
4
4
|
import { getLanguageSteps } from "../utils/language-helper.js";
|
|
5
|
-
import { getModularizationPrompt } from "../utils/modularization-prompts.js";
|
|
6
5
|
import { logger } from "../utils/logger.js";
|
|
7
6
|
export class TestGenerationService {
|
|
8
7
|
client;
|
|
@@ -40,13 +39,11 @@ export class TestGenerationService {
|
|
|
40
39
|
{
|
|
41
40
|
type: "text",
|
|
42
41
|
text: `${shouldModularize
|
|
43
|
-
? "Generated the test and WILL NOW MODULARIZE THE CODE USING THE FOLLOWING MODULARIZATION PRINCIPLES"
|
|
42
|
+
? "Generated the test and WILL NOW MODULARIZE THE CODE USING THE FOLLOWING MODULARIZATION PRINCIPLES USING skyramp_modularization TOOL"
|
|
44
43
|
: "Generated the test and DO NOT MODULARIZE THE CODE"}
|
|
45
|
-
${result}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- Before I can execute the test for you, I need to confirm the following information:
|
|
49
|
-
Authentication: Please provide me with your authentication token (by default we assume a Bearer Token). If you don't require any token for your service please just say: 'No token required'`,
|
|
44
|
+
${result}
|
|
45
|
+
|
|
46
|
+
${languageSteps}`,
|
|
50
47
|
},
|
|
51
48
|
],
|
|
52
49
|
isError: false,
|
|
@@ -3,6 +3,7 @@ import Docker from "dockerode";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { Writable } from "stream";
|
|
5
5
|
import { logger } from "../utils/logger.js";
|
|
6
|
+
import { stripVTControlCharacters } from "util";
|
|
6
7
|
// Configuration for language-specific file paths
|
|
7
8
|
const LANGUAGE_PATHS = {
|
|
8
9
|
python: "/tmp",
|
|
@@ -56,7 +57,7 @@ For detailed documentation visit: https://www.skyramp.dev/docs/quickstart`,
|
|
|
56
57
|
},
|
|
57
58
|
}, async (params) => {
|
|
58
59
|
var docker = new Docker();
|
|
59
|
-
var image = "public.ecr.aws/skyramp/rampup/runner:mcp-v0.0.
|
|
60
|
+
var image = "public.ecr.aws/skyramp/rampup/runner:mcp-v0.0.9";
|
|
60
61
|
// Use path.basename for safer filename extraction
|
|
61
62
|
const filename = path.basename(params.testFile);
|
|
62
63
|
if (!filename) {
|
|
@@ -65,6 +66,7 @@ For detailed documentation visit: https://www.skyramp.dev/docs/quickstart`,
|
|
|
65
66
|
// Use configurable language paths with fallback
|
|
66
67
|
const basePath = LANGUAGE_PATHS[params.language] || "/tmp";
|
|
67
68
|
const filePath = path.join(basePath, filename);
|
|
69
|
+
const dockerSocketPath = "/var/run/docker.sock";
|
|
68
70
|
var command = [
|
|
69
71
|
"./root/runner.sh",
|
|
70
72
|
params.language,
|
|
@@ -72,12 +74,18 @@ For detailed documentation visit: https://www.skyramp.dev/docs/quickstart`,
|
|
|
72
74
|
params.testType,
|
|
73
75
|
];
|
|
74
76
|
const hostConfig = {
|
|
77
|
+
ExtraHosts: ["host.docker.internal:host-gateway"],
|
|
75
78
|
Mounts: [
|
|
76
79
|
{
|
|
77
80
|
Target: filePath,
|
|
78
81
|
Source: path.resolve(params.testFile),
|
|
79
82
|
Type: "bind",
|
|
80
83
|
},
|
|
84
|
+
{
|
|
85
|
+
Type: "bind",
|
|
86
|
+
Target: dockerSocketPath,
|
|
87
|
+
Source: dockerSocketPath,
|
|
88
|
+
},
|
|
81
89
|
],
|
|
82
90
|
};
|
|
83
91
|
const env = [
|
|
@@ -140,7 +148,7 @@ For detailed documentation visit: https://www.skyramp.dev/docs/quickstart`,
|
|
|
140
148
|
content: [
|
|
141
149
|
{
|
|
142
150
|
type: "text",
|
|
143
|
-
text: `Test execution failed: ${output}
|
|
151
|
+
text: `Test execution failed: ${stripVTControlCharacters(output)}
|
|
144
152
|
**IMPORTANT: IF THE EXECUTION FAILED BECAUSE OF A 401 STATUS CODE, ASK THE USER TO PROVIDE THE AUTHENTICATION TOKEN TO THE TOOL OR A PLACE FROM WHERE WE CAN READ THE TOKEN. DO NOT UPDATE THE GENERATED TEST FILE.**`,
|
|
145
153
|
},
|
|
146
154
|
],
|
|
@@ -150,7 +158,7 @@ For detailed documentation visit: https://www.skyramp.dev/docs/quickstart`,
|
|
|
150
158
|
content: [
|
|
151
159
|
{
|
|
152
160
|
type: "text",
|
|
153
|
-
text: `Test execution result: ${output}`,
|
|
161
|
+
text: `Test execution result: ${stripVTControlCharacters(output)}`,
|
|
154
162
|
},
|
|
155
163
|
],
|
|
156
164
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { logger } from "../utils/logger.js";
|
|
3
|
+
import { getFixErrorsPrompt } from "../utils/modularization-prompts.js";
|
|
4
|
+
import { languageSchema } from "../types/TestTypes.js";
|
|
5
|
+
import { getLanguageSteps } from "../utils/language-helper.js";
|
|
6
|
+
const fixErrorSchema = z.object({
|
|
7
|
+
testFile: z
|
|
8
|
+
.string()
|
|
9
|
+
.describe("The test file to process with modularization principles applied"),
|
|
10
|
+
language: languageSchema.shape.language,
|
|
11
|
+
framework: languageSchema.shape.framework,
|
|
12
|
+
prompt: z
|
|
13
|
+
.string()
|
|
14
|
+
.describe("The prompt or code content to process with modularization principles applied"),
|
|
15
|
+
});
|
|
16
|
+
export function registerFixErrorTool(server) {
|
|
17
|
+
server.registerTool("skyramp_fix_errors", {
|
|
18
|
+
description: `Review the provided code for errors, inconsistencies, or missing pieces. If any are found, return corrected code. Otherwise, return the code unchanged.`,
|
|
19
|
+
inputSchema: fixErrorSchema.shape,
|
|
20
|
+
annotations: {
|
|
21
|
+
keywords: [
|
|
22
|
+
"modularization",
|
|
23
|
+
"code organization",
|
|
24
|
+
"structure",
|
|
25
|
+
"refactor",
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
}, async (params) => {
|
|
29
|
+
logger.info("Generating modularization", {
|
|
30
|
+
prompt: params.prompt,
|
|
31
|
+
testFile: params.testFile,
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: "text",
|
|
37
|
+
text: `
|
|
38
|
+
${getFixErrorsPrompt()}
|
|
39
|
+
${getLanguageSteps(params)}`,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import { baseTestSchema, baseTraceSchema, } from "../types/TestTypes.js";
|
|
2
3
|
import { TestGenerationService, } from "../services/TestGenerationService.js";
|
|
3
|
-
const integrationTestSchema =
|
|
4
|
+
const integrationTestSchema = z
|
|
5
|
+
.object({
|
|
4
6
|
...baseTestSchema,
|
|
5
7
|
trace: baseTraceSchema.shape.trace.optional(),
|
|
6
8
|
include: baseTraceSchema.shape.include.optional(),
|
|
7
9
|
exclude: baseTraceSchema.shape.exclude.optional(),
|
|
8
10
|
endpointURL: baseTestSchema.endpointURL.default(""),
|
|
9
|
-
}
|
|
11
|
+
})
|
|
12
|
+
.omit({ method: true }).shape;
|
|
10
13
|
export class IntegrationTestService extends TestGenerationService {
|
|
11
14
|
getTestType() {
|
|
12
15
|
return "integration";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { baseSchema } from "../types/TestTypes.js";
|
|
1
|
+
import { baseSchema, languageSchema } from "../types/TestTypes.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { TestGenerationService, } from "../services/TestGenerationService.js";
|
|
4
4
|
export class UITestService extends TestGenerationService {
|
|
@@ -18,10 +18,13 @@ export class UITestService extends TestGenerationService {
|
|
|
18
18
|
}
|
|
19
19
|
// Only include the original params in the schema
|
|
20
20
|
const uiTestSchema = {
|
|
21
|
-
...
|
|
21
|
+
...languageSchema.shape,
|
|
22
22
|
playwrightInput: z
|
|
23
23
|
.string()
|
|
24
24
|
.describe("MUST be absolute path to the playwright input file like /path/to/playwright-ui-test.zip and MUST be a zip file"),
|
|
25
|
+
output: baseSchema.shape.output,
|
|
26
|
+
outputDir: baseSchema.shape.outputDir,
|
|
27
|
+
force: baseSchema.shape.force,
|
|
25
28
|
};
|
|
26
29
|
export function registerUITestTool(server) {
|
|
27
30
|
server.registerTool("skyramp_ui_test_generation", {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ModularizationService, } from "../services/ModularizationService.js";
|
|
3
|
+
import { logger } from "../utils/logger.js";
|
|
4
|
+
const modularizationSchema = {
|
|
5
|
+
prompt: z
|
|
6
|
+
.string()
|
|
7
|
+
.describe("The prompt or code content to process with modularization principles applied"),
|
|
8
|
+
testFile: z
|
|
9
|
+
.string()
|
|
10
|
+
.describe("The test file to process with modularization principles applied"),
|
|
11
|
+
};
|
|
12
|
+
export function registerModularizationTool(server) {
|
|
13
|
+
server.registerTool("skyramp_modularization", {
|
|
14
|
+
description: `This tool applies modularization principles to structure and organize content, code, or responses in a logical, maintainable way.
|
|
15
|
+
After this step, review it for correctness. If errors remain, call skyramp_fix_errors`,
|
|
16
|
+
inputSchema: modularizationSchema,
|
|
17
|
+
annotations: {
|
|
18
|
+
keywords: [
|
|
19
|
+
"modularization",
|
|
20
|
+
"code organization",
|
|
21
|
+
"structure",
|
|
22
|
+
"refactor",
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
}, async (params) => {
|
|
26
|
+
logger.info("Generating modularization", {
|
|
27
|
+
prompt: params.prompt,
|
|
28
|
+
testFile: params.testFile,
|
|
29
|
+
});
|
|
30
|
+
const service = new ModularizationService();
|
|
31
|
+
return await service.processModularizationRequest(params);
|
|
32
|
+
});
|
|
33
|
+
}
|
package/build/types/TestTypes.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export const
|
|
2
|
+
export const languageSchema = z.object({
|
|
3
3
|
language: z
|
|
4
4
|
.string()
|
|
5
5
|
.describe("Programming language for the generated test (default: python)"),
|
|
6
6
|
framework: z
|
|
7
7
|
.string()
|
|
8
8
|
.describe("Testing framework to use (e.g., pytest for python, playwright for javascript and typescript, junit for java, etc.)"),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.describe("Name of the output test file. Default value is empty string. If not provided, Skyramp will generate a default name for the test file."),
|
|
13
|
-
outputDir: z
|
|
14
|
-
.string()
|
|
15
|
-
.describe("MUST be absolute path to the directory where test files will be generated. If not provided, the CURRENT WORKING DIRECTORY will be used WITHOUT ANY SUBDIRECTORIES"),
|
|
16
|
-
force: z
|
|
17
|
-
.boolean()
|
|
18
|
-
.describe("Whether to overwrite existing files in the output directory"),
|
|
9
|
+
});
|
|
10
|
+
export const baseSchema = z.object({
|
|
11
|
+
...languageSchema.shape,
|
|
19
12
|
deployDashboard: z
|
|
20
13
|
.boolean()
|
|
21
14
|
.default(false)
|
|
@@ -49,10 +42,19 @@ export const baseSchema = z.object({
|
|
|
49
42
|
.boolean()
|
|
50
43
|
.default(false)
|
|
51
44
|
.describe("Whether to allow insecure SSL connections for HTTPS endpoints"),
|
|
45
|
+
output: z
|
|
46
|
+
.string()
|
|
47
|
+
.optional()
|
|
48
|
+
.describe("Name of the output test file. Default value is empty string. If not provided, Skyramp will generate a default name for the test file."),
|
|
49
|
+
outputDir: z
|
|
50
|
+
.string()
|
|
51
|
+
.describe("MUST be absolute path to the directory where test files will be generated. If not provided, the CURRENT WORKING DIRECTORY will be used WITHOUT ANY SUBDIRECTORIES"),
|
|
52
|
+
force: z
|
|
53
|
+
.boolean()
|
|
54
|
+
.describe("Whether to overwrite existing files in the output directory"),
|
|
52
55
|
prompt: z.string().describe("The prompt user provided to generate the test"),
|
|
53
56
|
});
|
|
54
57
|
export const baseTraceSchema = z.object({
|
|
55
|
-
...baseSchema.shape,
|
|
56
58
|
trace: z
|
|
57
59
|
.string()
|
|
58
60
|
.describe("MUST be absolute path to trace file for test generation like /path/to/trace.json and MUST be a json file"),
|
|
@@ -64,10 +66,10 @@ export const baseTraceSchema = z.object({
|
|
|
64
66
|
.array(z.string())
|
|
65
67
|
.default([])
|
|
66
68
|
.describe("List of endpoints or patterns to exclude from test generation. EXCLUDE THE PATHS THAT ARE NOT API ENDPOINTS."),
|
|
69
|
+
...baseSchema.shape,
|
|
67
70
|
});
|
|
68
71
|
// Base schema that all test tools share
|
|
69
72
|
export const baseTestSchema = {
|
|
70
|
-
...baseSchema.shape,
|
|
71
73
|
endpointURL: z
|
|
72
74
|
.string()
|
|
73
75
|
.describe("The endpoint URL to test (e.g., https://demoshop.skyramp.dev/api/v1/products)"),
|
|
@@ -99,4 +101,5 @@ export const baseTestSchema = {
|
|
|
99
101
|
.string()
|
|
100
102
|
.default("")
|
|
101
103
|
.describe("Expected HTTP response status code (e.g., '200', '201', '404'). DO NOT ASSUME STATUS CODE IF NOT PROVIDED"),
|
|
104
|
+
...baseSchema.shape,
|
|
102
105
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export function getLanguageSteps(params) {
|
|
2
2
|
const { language, testType } = params;
|
|
3
|
+
let pythonSteps = "";
|
|
3
4
|
switch (language) {
|
|
4
5
|
case "python":
|
|
5
|
-
|
|
6
|
+
pythonSteps = `
|
|
6
7
|
# Install skyramp dependency
|
|
7
8
|
pip3 install skyramp
|
|
8
9
|
`;
|
|
@@ -35,25 +36,27 @@ pip3 install robotframework
|
|
|
35
36
|
python3 -m robot <robot-file>.robot
|
|
36
37
|
`;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
break;
|
|
39
40
|
case "javascript":
|
|
40
|
-
|
|
41
|
+
pythonSteps = `
|
|
41
42
|
# install dependencies for package.json
|
|
42
43
|
npm install @skyramp/skyramp @playwright/test
|
|
43
44
|
|
|
44
45
|
# Execution of test file
|
|
45
46
|
npx playwright test <test-file>.spec.js --reporter=list
|
|
46
47
|
`;
|
|
48
|
+
break;
|
|
47
49
|
case "typescript":
|
|
48
|
-
|
|
50
|
+
pythonSteps = `
|
|
49
51
|
# install dependencies for package.json
|
|
50
52
|
npm install @skyramp/skyramp @playwright/test
|
|
51
53
|
|
|
52
54
|
# Execution of test file
|
|
53
55
|
npx playwright test <test-file>.spec.ts --reporter=list
|
|
54
56
|
`;
|
|
57
|
+
break;
|
|
55
58
|
case "java":
|
|
56
|
-
|
|
59
|
+
pythonSteps = `
|
|
57
60
|
# Prerequisites
|
|
58
61
|
# Compile the test file
|
|
59
62
|
javac -cp "./lib/*" -d target <test-file>.java
|
|
@@ -67,7 +70,16 @@ java -jar "./lib/junit-platform-console-standalone-\${JUNIT_PLATFORM_VER}.jar" \
|
|
|
67
70
|
--select-class=<test-file> \\
|
|
68
71
|
--reports-dir=target/test-results
|
|
69
72
|
`;
|
|
73
|
+
break;
|
|
70
74
|
default:
|
|
71
75
|
return "";
|
|
72
76
|
}
|
|
77
|
+
return pythonSteps + appendExecutionInstruction();
|
|
78
|
+
}
|
|
79
|
+
function appendExecutionInstruction() {
|
|
80
|
+
return `
|
|
81
|
+
- Notify the user that they can also use ** Execute with Skyramp ** tool to run the test.If this is your first test you are trying to execute with Skyramp, it may take a little bit longer than usual.
|
|
82
|
+
- Before I can execute the test for you, I need to confirm the following information:
|
|
83
|
+
Authentication: Please provide me with your authentication token (by default we assume a Bearer Token). If you don't require any token for your service please just say: 'No token required'
|
|
84
|
+
`;
|
|
73
85
|
}
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
export function getModularizationPrompt() {
|
|
2
2
|
return `
|
|
3
|
-
**
|
|
4
|
-
|
|
3
|
+
**CRITICAL: Please refactor the code with these modularization principles. Respond with the complete, modularized code only in the same file WITHOUT ANY ERRORS**
|
|
4
|
+
|
|
5
|
+
1. Group related lines logically (e.g., login steps together) to improve readability and parameterize the test function(s) with meaningful parameters to make it more flexible.
|
|
6
|
+
2. If functions are already modularized (like breakpoint_section_0, breakpoint_section_1), then rename them with meaningful names WITHOUT ANY OTHER CHANGES.
|
|
7
|
+
3. KEEP CHANGES TO A MINIMUM. DO NOT MODIFY THE FUNCTIONALITY OF THE TESTS. ONLY MODULARIZE THE CODE.
|
|
8
|
+
4. Parameterize the test function(s) with meaningful parameters to make it more flexible. Preserve the original order of code lines within each function.
|
|
9
|
+
5. Only extract reusable logical sections into helper functions or parameterized structures where applicable. Do not create any new test cases or a new modular file but only helper functions with modularization done in the same file. Do not add any new logic or classes or any other files.
|
|
10
|
+
|
|
11
|
+
CRITICAL: FIX ERRORS IN THE MODULARIZED CODE USING skyramp_fix_errors TOOL
|
|
12
|
+
`;
|
|
13
|
+
}
|
|
14
|
+
export function getFixErrorsPrompt() {
|
|
15
|
+
return `
|
|
16
|
+
**Fix errors in the refactored code.**
|
|
17
|
+
|
|
18
|
+
1. **Parameter Passing:** Carefully examine the code. Identify all functions that use variables defined outside their own scope (like a Playwright 'page' object or a shared configuration).
|
|
19
|
+
2. **Validate Correctness:** Ensure the final code is free of any reference errors, undefined variables, or other runtime issues. The code must be ready to execute.
|
|
20
|
+
|
|
21
|
+
**REMEMBER: The key insight is that if a function references any variable that's not defined within its scope, that variable MUST be passed as a parameter. The "page" object is the most common culprit in Playwright tests.**
|
|
22
|
+
`;
|
|
5
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyramp/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@modelcontextprotocol/sdk": "^1.11.4",
|
|
45
|
-
"@skyramp/skyramp": "^1.2.
|
|
45
|
+
"@skyramp/skyramp": "^1.2.15",
|
|
46
46
|
"dockerode": "^4.0.6",
|
|
47
47
|
"zod": "^3.25.3"
|
|
48
48
|
},
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { ModularizationService, } from "../services/ModularizationService.js";
|
|
3
|
-
import { logger } from "../utils/logger.js";
|
|
4
|
-
const modularizationSchema = {
|
|
5
|
-
prompt: z
|
|
6
|
-
.string()
|
|
7
|
-
.describe("The prompt or code content to process with modularization principles applied"),
|
|
8
|
-
includeModularization: z
|
|
9
|
-
.boolean()
|
|
10
|
-
.optional()
|
|
11
|
-
.default(true)
|
|
12
|
-
.describe("Whether to include detailed modularization instructions in the response"),
|
|
13
|
-
contextType: z
|
|
14
|
-
.enum(["general", "technical", "creative"])
|
|
15
|
-
.optional()
|
|
16
|
-
.default("general")
|
|
17
|
-
.describe("The type of context for processing: general for standard content, technical for code/technical content, creative for creative/artistic content"),
|
|
18
|
-
};
|
|
19
|
-
export function registerModularizationTool(server) {
|
|
20
|
-
server.registerTool("skyramp_modularization", {
|
|
21
|
-
description: `Process prompts and content using MCP modularization principles.
|
|
22
|
-
|
|
23
|
-
This tool applies modularization principles to structure and organize content, code, or responses in a logical, maintainable way. It's particularly useful for:
|
|
24
|
-
|
|
25
|
-
• Code refactoring with modularization best practices
|
|
26
|
-
• Structuring complex responses into logical modules
|
|
27
|
-
• Applying separation of concerns to content organization
|
|
28
|
-
• Creating maintainable and readable output structures
|
|
29
|
-
|
|
30
|
-
MODULARIZATION PRINCIPLES:
|
|
31
|
-
• Logical grouping of related functionality
|
|
32
|
-
• Clear separation of concerns
|
|
33
|
-
• Parameterization for flexibility
|
|
34
|
-
• Preservation of original functionality
|
|
35
|
-
• Helper function extraction where applicable
|
|
36
|
-
|
|
37
|
-
The tool processes your prompt within the MCP framework and provides structured guidance for modularized responses.`,
|
|
38
|
-
inputSchema: modularizationSchema,
|
|
39
|
-
annotations: {
|
|
40
|
-
keywords: [
|
|
41
|
-
"modularization",
|
|
42
|
-
"code organization",
|
|
43
|
-
"structure",
|
|
44
|
-
"refactor",
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
}, async (params) => {
|
|
48
|
-
logger.info("Generating modularization", {
|
|
49
|
-
prompt: params.prompt,
|
|
50
|
-
contextType: params.contextType,
|
|
51
|
-
includeModularization: params.includeModularization,
|
|
52
|
-
});
|
|
53
|
-
const service = new ModularizationService();
|
|
54
|
-
return await service.processModularizationRequest(params);
|
|
55
|
-
});
|
|
56
|
-
}
|