UNPKG

@skyramp/mcp

Version:

Skyramp MCP (Model Context Protocol) Server - AI-powered test generation and execution

26 lines (25 loc) 1.11 kB
import { SkyrampClient } from "@skyramp/skyramp"; import { IsValidKeyValueList } from "./utils.js"; // Analyze OpenAPI to check for required path params export async function analyzeOpenAPIWithGivenEndpoint(apiSchemaInput, uriInput, pathParamsInput) { const client = new SkyrampClient(); const analyzeOpenapiOptions = { apiSchema: apiSchemaInput, uri: uriInput, }; const pathParamRequired = await client.analyzeOpenapi(analyzeOpenapiOptions); if (IsValidKeyValueList(pathParamRequired)) { const requiredPathParams = pathParamRequired ? pathParamRequired.split(",").map((p) => p.trim()) : []; let providedPathParams = pathParamsInput ? pathParamsInput.split(",").map((param) => param.split("=")[0].trim()) : []; // Find missing path parameters by comparing keys let missingPathParams = requiredPathParams.filter((param) => !providedPathParams.includes(param)); if (missingPathParams.length > 0) { return `${missingPathParams.join(", ")}`; } } return null; }