@skyramp/mcp
Version:
Skyramp MCP (Model Context Protocol) Server - AI-powered test generation and execution
74 lines (70 loc) • 3.08 kB
JavaScript
import { z } from "zod";
import { baseTestSchema, baseTraceSchema, } from "../types/TestTypes.js";
import { TestGenerationService, } from "../services/TestGenerationService.js";
const loadTestSchema = {
...baseTestSchema,
loadCount: z
.string()
.default("")
.describe("Total string of iteration to be executed for the test. DO NOT ASSUME VALUE"),
loadDuration: z
.string()
.default("5")
.describe("Duration of the load test in seconds (default: 5)"),
loadNumThreads: z
.string()
.default("1")
.describe("Number of concurrent threads/users for the load test (default: 1)"),
loadRampupDuration: z
.string()
.default("")
.describe("Time in seconds to gradually increase load to target level. DO NOT ASSUME VALUE"),
loadRampupInterval: z
.string()
.default("")
.describe("Interval in seconds between ramping up threads. DO NOT ASSUME VALUE"),
loadTargetRPS: z
.string()
.default("")
.describe("Target requests per second for the load test. DO NOT ASSUME VALUE"),
trace: baseTraceSchema.shape.trace.default(""),
include: baseTraceSchema.shape.include,
exclude: baseTraceSchema.shape.exclude,
endpointURL: baseTestSchema.endpointURL.default(""),
};
export class LoadTestService extends TestGenerationService {
getTestType() {
return "load";
}
buildGenerationOptions(params) {
return {
...super.buildBaseGenerationOptions(params),
loadCount: params.loadCount,
loadDuration: params.loadDuration,
loadNumThreads: params.loadNumThreads,
loadRampupDuration: params.loadRampupDuration,
loadRampupInterval: params.loadRampupInterval,
loadTargetRPS: params.loadTargetRPS,
};
}
}
export function registerLoadTestTool(server) {
server.registerTool("skyramp_load_test_generation", {
description: `Generate a load test using Skyramp's deterministic test generation platform.
Load tests evaluate your application's performance, scalability, and stability under various traffic conditions. They simulate multiple concurrent users, measure response times, identify performance bottlenecks, and ensure your system can handle expected traffic volumes.
***IMPORTANT***
- At any given time you can provide duration of the test or test execution count
- IF THE USER DOES NOT PROVIDE LOAD PARAMETERS, THEN USE DEFAULT VALUES FOR LOAD TESTS:
- loadDuration: "5" (5 seconds)
- loadNumThreads: "1" (1 thread)
- Other load parameters should remain empty unless explicitly specified by the user
For detailed documentation visit: https://www.skyramp.dev/docs/load-test/advanced-generation#start-trace-collection`,
inputSchema: loadTestSchema,
annotations: {
keywords: ["load test", "performance test"],
},
}, async (params) => {
const service = new LoadTestService();
return await service.generateTest(params);
});
}