immunity_test_plan
Get a customized immunity test plan for your product's environment, including applicable IEC 61000-4-x tests and levels.
Instructions
Get a suggested immunity test plan for a product type. Returns applicable IEC 61000-4-x tests and recommended levels.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environment | Yes | Target environment |
Implementation Reference
- src/mcp_emc_regulations/tools/immunity.py:61-84 (registration)The 'immunity_test_plan' tool is registered as part of the ImmunityTools class via the Tool(name='immunity_test_plan', ...) definition returned by list_tools(). This is how it gets discovered by the ToolRegistry.
Tool( name="iec61000_overview", description="Get an overview of all IEC 61000-4-x immunity tests with typical levels for residential and industrial environments.", inputSchema={"type": "object", "properties": {}}, ), Tool( name="immunity_test_plan", description=( "Get a suggested immunity test plan for a product type. " "Returns applicable IEC 61000-4-x tests and recommended levels." ), inputSchema={ "type": "object", "properties": { "environment": { "type": "string", "enum": ["residential", "industrial", "automotive", "medical"], "description": "Target environment", }, }, "required": ["environment"], }, ), ] - The _test_plan method is the actual handler for 'immunity_test_plan'. It takes an 'environment' argument (residential/industrial/automotive/medical) and returns a formatted test plan with standard, test, level, and performance criterion columns.
@staticmethod def _test_plan(arguments: dict[str, Any]) -> list[TextContent]: environment = arguments["environment"] result = f"Immunity Test Plan: {environment.title()} Environment\n{'=' * 55}\n\n" plans = { "residential": [ ("IEC 61000-4-2", "ESD", "Contact +/-4 kV, Air +/-8 kV", "B"), ("IEC 61000-4-3", "Radiated immunity", "3 V/m, 80-1000 MHz", "A"), ("IEC 61000-4-4", "EFT/Burst", "+/-1 kV AC power, +/-0.5 kV signal", "B"), ("IEC 61000-4-5", "Surge", "+/-1 kV L-L, +/-2 kV L-E", "B"), ("IEC 61000-4-6", "Conducted RF", "3 V, 0.15-80 MHz", "A"), ("IEC 61000-4-8", "Magnetic field", "3 A/m", "A"), ("IEC 61000-4-11", "Voltage dips", "Standard dip profile", "B/C"), ], "industrial": [ ("IEC 61000-4-2", "ESD", "Contact +/-4 kV, Air +/-8 kV", "B"), ("IEC 61000-4-3", "Radiated immunity", "10 V/m, 80-2700 MHz", "A"), ("IEC 61000-4-4", "EFT/Burst", "+/-2 kV AC power, +/-1 kV signal", "B"), ("IEC 61000-4-5", "Surge", "+/-2 kV L-L, +/-4 kV L-E", "B"), ("IEC 61000-4-6", "Conducted RF", "10 V, 0.15-80 MHz", "A"), ("IEC 61000-4-8", "Magnetic field", "30 A/m", "A"), ("IEC 61000-4-11", "Voltage dips", "Standard dip profile", "B/C"), ], "automotive": [ ("ISO 11452-2", "Radiated immunity (ALSE)", "30-200 V/m, 200-2000 MHz", "A (per OEM)"), ("ISO 11452-4", "BCI", "30-300 mA, 1-400 MHz", "A (per OEM)"), ("ISO 7637-2", "Conducted transients", "Pulses 1, 2a, 3a, 3b", "A/B (per OEM)"), ("IEC 61000-4-2", "ESD", "Contact +/-4-8 kV", "B"), ("ISO 16750-2", "Electrical loads", "OEM-specific voltage ranges", "A"), ], "medical": [ ("IEC 61000-4-2", "ESD", "Contact +/-8 kV, Air +/-15 kV", "B"), ("IEC 61000-4-3", "Radiated immunity", "3-10 V/m (per 60601-1-2), extended to 2.7 GHz", "A"), ("IEC 61000-4-4", "EFT/Burst", "+/-2 kV AC power", "B"), ("IEC 61000-4-5", "Surge", "+/-1 kV L-L, +/-2 kV L-E", "B"), ("IEC 61000-4-6", "Conducted RF", "3-6 V, 0.15-80 MHz", "A"), ("IEC 61000-4-8", "Magnetic field", "3-30 A/m", "A"), ("IEC 61000-4-11", "Voltage dips", "Standard + extended profiles", "B/C"), ], } plan = plans.get(environment, plans["residential"]) result += f"{'Standard':<20} {'Test':<25} {'Level':<35} {'Criterion':<10}\n" result += "-" * 90 + "\n" for std, test, level, criterion in plan: result += f"{std:<20} {test:<25} {level:<35} {criterion:<10}\n" result += f"\nNote: Levels are typical for {environment} environment. " result += "Actual levels may be specified by product standard or customer requirements.\n" return [TextContent(type="text", text=result)] - The input schema for 'immunity_test_plan' defines a single required 'environment' parameter (enum: residential, industrial, automotive, medical). No output schema since it returns TextContent.
Tool( name="immunity_test_plan", description=( "Get a suggested immunity test plan for a product type. " "Returns applicable IEC 61000-4-x tests and recommended levels." ), inputSchema={ "type": "object", "properties": { "environment": { "type": "string", "enum": ["residential", "industrial", "automotive", "medical"], "description": "Target environment", }, }, "required": ["environment"], }, ), - src/mcp_emc_regulations/tools/immunity.py:86-93 (registration)The call_tool method routes the tool name 'immunity_test_plan' to _test_plan() handler. This is invoked by the ToolRegistry after discovery.
async def call_tool(self, name: str, arguments: dict[str, Any]) -> list[TextContent]: if name == "iec61000_test_levels": return self._test_levels(arguments) elif name == "iec61000_overview": return self._overview() elif name == "immunity_test_plan": return self._test_plan(arguments) return [TextContent(type="text", text=f"Unknown immunity tool: {name}")] - The helper function load_json loads the iec61000_immunity.json data file which provides the data backing for all immunity tools. However, _test_plan uses hardcoded plan data, not the JSON.
from ..utils import load_json from .base import ToolModule IMMUNITY = load_json("iec61000_immunity.json")