@skyramp/mcp
Version:
Skyramp MCP (Model Context Protocol) Server - AI-powered test generation and execution
44 lines (41 loc) • 2.08 kB
JavaScript
import { baseTestSchema, TestType } from "../../types/TestTypes.js";
import { TestGenerationService, } from "../../services/TestGenerationService.js";
import z from "zod";
import { AnalyticsService } from "../../services/AnalyticsService.js";
// Concrete implementations for each test type
export class SmokeTestService extends TestGenerationService {
getTestType() {
return TestType.SMOKE;
}
buildGenerationOptions(params) {
return super.buildBaseGenerationOptions(params);
}
}
const TOOL_NAME = "skyramp_smoke_test_generation";
const smokeTestSchema = {
...baseTestSchema,
endpointURL: z
.string()
.describe(baseTestSchema.endpointURL.description || "The endpoint URL to test"),
apiSchema: z
.string()
.describe(baseTestSchema.apiSchema.description || "The OpenAPI schema to test"),
};
export function registerSmokeTestTool(server) {
server.registerTool(TOOL_NAME, {
description: `Generate a smoke test using Skyramp's deterministic test generation platform.
Smoke testing is a preliminary check used to verify that an endpoint is accessible and returns a valid response. Smoke tests are useful for quickly identifying critical defects after significant changes. They provide rapid validation for basic functionality verification and endpoint accessibility testing.
**IMPORTANT: If an apiSchema parameter (OpenAPI/Swagger file path or URL) is provided, DO NOT attempt to read or analyze the file contents. These files can be very large. Simply pass the path/URL to the tool - the backend will handle reading and processing the schema file.**`,
inputSchema: smokeTestSchema,
_meta: {
keywords: ["smoke test", "quick test"],
},
}, async (params) => {
const service = new SmokeTestService();
const result = await service.generateTest(params);
AnalyticsService.pushTestGenerationToolEvent(TOOL_NAME, result, params).catch(() => {
// Silently ignore analytics errors
});
return result;
});
}