@skyramp/mcp
Version:
Skyramp MCP (Model Context Protocol) Server - AI-powered test generation and execution
106 lines (105 loc) • 4.57 kB
JavaScript
import { z } from "zod";
export const languageSchema = z.object({
language: z
.string()
.describe("Programming language for the generated test (default: python)"),
framework: z
.string()
.describe("Testing framework to use (e.g., pytest for python, playwright for javascript and typescript, junit for java, etc.)"),
});
export const baseSchema = z.object({
...languageSchema.shape,
deployDashboard: z
.boolean()
.default(false)
.describe("Whether to deploy the Skyramp dashboard for test monitoring"),
runtime: z
.string()
.default("local")
.describe("Runtime environment (docker, kubernetes, local)"),
dockerNetwork: z
.string()
.default("")
.describe("Docker network name to use for containerized testing"),
dockerWorkerPort: z
.number()
.default(0)
.describe("Port number for the Docker worker service"),
k8sNamespace: z
.string()
.default("")
.describe("Kubernetes namespace for deployment"),
k8sConfig: z
.string()
.default("")
.describe("Path to Kubernetes configuration file"),
k8sContext: z.string().default("").describe("Kubernetes context to use"),
authHeader: z
.string()
.default("")
.describe("Authorization header value for authenticated requests"),
insecure: z
.boolean()
.default(false)
.describe("Whether to allow insecure SSL connections for HTTPS endpoints"),
output: z
.string()
.optional()
.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."),
outputDir: z
.string()
.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"),
force: z
.boolean()
.describe("Whether to overwrite existing files in the output directory"),
prompt: z.string().describe("The prompt user provided to generate the test"),
});
export const baseTraceSchema = z.object({
trace: z
.string()
.describe("MUST be absolute path to trace file for test generation like /path/to/trace.json and MUST be a json file"),
include: z
.array(z.string())
.default([])
.describe("List of endpoints or patterns to include in test generation. DO NOT ASSUME ANYTHING IF NOT PROVIDED"),
exclude: z
.array(z.string())
.default([])
.describe("List of endpoints or patterns to exclude from test generation. EXCLUDE THE PATHS THAT ARE NOT API ENDPOINTS."),
...baseSchema.shape,
});
// Base schema that all test tools share
export const baseTestSchema = {
endpointURL: z
.string()
.describe("The endpoint URL to test (e.g., https://demoshop.skyramp.dev/api/v1/products)"),
method: z
.string()
.default("")
.describe('HTTP method to use. DEFAULT: Use empty string ("") to test ALL available methods from OpenAPI schema (recommended). Only specify a specific method (GET, POST, PUT, DELETE, etc.) if user explicitly requests testing a single method only.'),
apiSchema: z
.string()
.default("")
.describe("MUST be absolute path(/path/to/openapi.json) to the OpenAPI/Swagger schema file or a URL to the OpenAPI/Swagger schema file(e.g. https://demoshop.skyramp.dev/openapi.json). DO NOT TRY TO ASSUME THE OPENAPI SCHEMA IF NOT PROVIDED"),
pathParams: z
.string()
.default("")
.describe("MUST be string of comma separated values like 'id=1,name=John' for URL path parameters"),
queryParams: z
.string()
.default("")
.describe("MUST be string of comma separated values like 'id=1,name=John' for URL query parameters"),
formParams: z
.string()
.default("")
.describe("MUST be string of comma separated values like 'id=1,name=John' for form data parameters"),
requestData: z
.string()
.default("")
.describe("Sample request body data, provided either as an inline JSON/YAML string or as an absolute file path prefixed with '@' (e.g., @/absolute/path/to/file)."),
responseStatusCode: z
.string()
.default("")
.describe("Expected HTTP response status code (e.g., '200', '201', '404'). DO NOT ASSUME STATUS CODE IF NOT PROVIDED"),
...baseSchema.shape,
};