Skip to main content
Glama
Atakan-Emre

QA-MCP: Test Standardization & Orchestration Server

by Atakan-Emre

testcase.normalize

Converts test cases from various formats (markdown, gherkin, json, plain text) into standardized QA-MCP format for consistent testing workflows.

Instructions

Farklı formatlardaki test case'leri QA-MCP standardına çevirir

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_dataYesNormalize edilecek test case (markdown, gherkin, json veya plain text)
source_formatNoKaynak format (default: auto)

Implementation Reference

  • Core handler function implementing the testcase.normalize tool logic. Detects input format automatically if needed, parses the input_data accordingly (gherkin, markdown, json, plain), fills missing fields, normalizes values, and returns the standardized test case with metadata.
    def normalize_testcase(
        input_data: str | dict,
        source_format: str = "auto",
    ) -> dict:
        """
        Normalize a test case from various formats to QA-MCP standard.
    
        Args:
            input_data: Test case in string (markdown/gherkin) or dict format
            source_format: Source format - 'auto', 'markdown', 'gherkin', 'json', 'plain'
    
        Returns:
            Dictionary containing:
            - testcase: Normalized test case in standard format
            - source_format_detected: Detected source format
            - transformations: List of transformations applied
            - warnings: Any warnings during normalization
        """
        transformations = []
        warnings = []
    
        # Detect format if auto
        if source_format == "auto":
            source_format = _detect_format(input_data)
            transformations.append(f"Format otomatik tespit edildi: {source_format}")
    
        # Parse based on format
        try:
            if source_format == "gherkin":
                testcase, parse_warnings = _parse_gherkin(input_data)
            elif source_format == "markdown":
                testcase, parse_warnings = _parse_markdown(input_data)
            elif source_format == "json" or isinstance(input_data, dict):
                testcase, parse_warnings = _parse_json(input_data)
            else:  # plain text
                testcase, parse_warnings = _parse_plain_text(input_data)
    
            warnings.extend(parse_warnings)
    
        except Exception as e:
            return {
                "testcase": None,
                "source_format_detected": source_format,
                "transformations": transformations,
                "warnings": [f"Parse hatası: {str(e)}"],
                "error": str(e),
            }
    
        # Validate and fill missing fields
        testcase, fill_warnings = _fill_missing_fields(testcase)
        warnings.extend(fill_warnings)
        transformations.append("Eksik alanlar varsayılan değerlerle dolduruldu")
    
        # Normalize values
        testcase = _normalize_values(testcase)
        transformations.append("Değerler standartlaştırıldı")
    
        return {
            "testcase": testcase.model_dump(),
            "source_format_detected": source_format,
            "transformations": transformations,
            "warnings": warnings,
        }
  • Registration of the 'testcase.normalize' tool in the MCP server, including name, description, and input schema.
    Tool(
        name="testcase.normalize",
        description="Farklı formatlardaki test case'leri QA-MCP standardına çevirir",
        inputSchema={
            "type": "object",
            "properties": {
                "input_data": {
                    "type": ["string", "object"],
                    "description": "Normalize edilecek test case (markdown, gherkin, json veya plain text)",
                },
                "source_format": {
                    "type": "string",
                    "enum": ["auto", "markdown", "gherkin", "json", "plain"],
                    "description": "Kaynak format (default: auto)",
                },
            },
            "required": ["input_data"],
        },
  • Input schema defining parameters for testcase.normalize: input_data (string or object, required) and optional source_format.
    inputSchema={
        "type": "object",
        "properties": {
            "input_data": {
                "type": ["string", "object"],
                "description": "Normalize edilecek test case (markdown, gherkin, json veya plain text)",
            },
            "source_format": {
                "type": "string",
                "enum": ["auto", "markdown", "gherkin", "json", "plain"],
                "description": "Kaynak format (default: auto)",
            },
        },
        "required": ["input_data"],
  • Dispatch handler in server.call_tool that invokes the normalize_testcase function with parsed arguments and logs audit.
    elif name == "testcase.normalize":
        result = normalize_testcase(
            input_data=arguments["input_data"],
            source_format=arguments.get("source_format", "auto"),
        )
        audit_log(
            name,
            arguments,
            f"Normalized from {result.get('source_format_detected', 'unknown')}",
        )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Atakan-Emre/McpTestGenerator'

If you have feedback or need assistance with the MCP directory API, please join our Discord server