Add machine-aware maximum product length
This commit is contained in:
@@ -14,6 +14,7 @@ from roll_calculation import (
|
||||
)
|
||||
from rollcalc_mcp_tools import (
|
||||
analyze_transport_capacity_result,
|
||||
calculate_machine_max_product_length_result,
|
||||
check_production_feasibility_result,
|
||||
calculate_material_weight_result,
|
||||
calculate_product_length_result,
|
||||
@@ -22,7 +23,11 @@ from rollcalc_mcp_tools import (
|
||||
get_machine_result,
|
||||
search_articles_result,
|
||||
)
|
||||
from machine_constraints import check_production_feasibility, get_machine
|
||||
from machine_constraints import (
|
||||
calculate_machine_max_product_length,
|
||||
check_production_feasibility,
|
||||
get_machine,
|
||||
)
|
||||
from transport_calculation import analyze_transport, transport_presets
|
||||
|
||||
|
||||
@@ -98,6 +103,20 @@ class McpAdapterTests(unittest.TestCase):
|
||||
"feasible_with_warnings",
|
||||
)
|
||||
|
||||
def test_machine_maximum_length_adapter_delegates_to_shared_domain(self):
|
||||
arguments = {
|
||||
"machine": "K7",
|
||||
"core_diameter_mm": 133.0,
|
||||
"thickness_mm": 4.311611,
|
||||
"thickness_stddev_mm": 0.249999,
|
||||
"product_width_m": 6.0,
|
||||
"area_weight_g_m2": 495.395833,
|
||||
}
|
||||
self.assertEqual(
|
||||
calculate_machine_max_product_length_result(**arguments),
|
||||
calculate_machine_max_product_length(**arguments),
|
||||
)
|
||||
|
||||
def test_material_weight_adapter_delegates_without_a_core_diameter(self):
|
||||
arguments = {
|
||||
"roll_length_m": 60.0,
|
||||
@@ -220,6 +239,7 @@ class McpAdapterTests(unittest.TestCase):
|
||||
"search_articles",
|
||||
"get_machine",
|
||||
"check_production_feasibility",
|
||||
"calculate_machine_max_product_length",
|
||||
"calculate_material_weight",
|
||||
"calculate_product_length",
|
||||
"calculate_roll_diameter",
|
||||
@@ -233,6 +253,7 @@ class McpAdapterTests(unittest.TestCase):
|
||||
search_tool = tools["search_articles"]
|
||||
machine_tool = tools["get_machine"]
|
||||
feasibility_tool = tools["check_production_feasibility"]
|
||||
maximum_tool = tools["calculate_machine_max_product_length"]
|
||||
material_weight_tool = tools["calculate_material_weight"]
|
||||
product_length_tool = tools["calculate_product_length"]
|
||||
roll_schema = tools["calculate_roll_diameter"].parameters
|
||||
@@ -250,6 +271,21 @@ class McpAdapterTests(unittest.TestCase):
|
||||
self.assertIn("never override failed constraints", feasibility_tool.description)
|
||||
self.assertIn("warnings", feasibility_tool.description)
|
||||
self.assertIn("Missing configured V1 roll inputs", feasibility_tool.description)
|
||||
self.assertEqual(
|
||||
maximum_tool.parameters["required"],
|
||||
["machine", "core_diameter_mm", "thickness_mm"],
|
||||
)
|
||||
self.assertIn("product_width_m", maximum_tool.parameters["properties"])
|
||||
self.assertIn("area_weight_g_m2", maximum_tool.parameters["properties"])
|
||||
for text in (
|
||||
"Resolve the article first with search_articles/get_article",
|
||||
"Do not supply or invent machine limits",
|
||||
"rearrange roll or weight formulas",
|
||||
"compare candidate limits yourself",
|
||||
"nominal and conservative/no-warning production maxima",
|
||||
"incompatibility rather than substituting another core or width",
|
||||
):
|
||||
self.assertIn(text, maximum_tool.description)
|
||||
self.assertEqual(
|
||||
search_tool.parameters["properties"]["query"]["type"], "string"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user