Reduce machine max MCP response size
This commit is contained in:
+31
-2
@@ -69,8 +69,8 @@ def calculate_machine_max_product_length_result(
|
||||
product_width_m: float | None = None,
|
||||
area_weight_g_m2: float | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Delegate machine-aware maximum product length to the shared domain."""
|
||||
return calculate_machine_max_product_length(
|
||||
"""Return the compact MCP view of the machine-aware domain calculation."""
|
||||
result = calculate_machine_max_product_length(
|
||||
machine=machine,
|
||||
core_diameter_mm=core_diameter_mm,
|
||||
thickness_mm=thickness_mm,
|
||||
@@ -78,6 +78,35 @@ def calculate_machine_max_product_length_result(
|
||||
product_width_m=product_width_m,
|
||||
area_weight_g_m2=area_weight_g_m2,
|
||||
)
|
||||
return project_machine_max_product_length_result(result)
|
||||
|
||||
|
||||
def project_machine_max_product_length_result(result: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Project successful maximum-length results for MCP without diagnostics.
|
||||
|
||||
The shared domain result deliberately contains detailed verification reports.
|
||||
They remain available to Flask and other consumers, but duplicate machine
|
||||
metadata and checks are unnecessary in the MCP response.
|
||||
"""
|
||||
if result.get("status") != "success":
|
||||
return result
|
||||
|
||||
machine = result["machine"]
|
||||
constraints = machine["constraints"]
|
||||
return {
|
||||
"status": result["status"],
|
||||
"machine": {"id": machine["id"], "name": machine["name"]},
|
||||
"weight_scope": result["weight_scope"],
|
||||
"machine_limits": {
|
||||
"maximum_roll_diameter_mm": constraints["roll_diameter_mm"]["maximum"]
|
||||
if constraints["roll_diameter_mm"] is not None else None,
|
||||
"maximum_material_roll_weight_kg": constraints["roll_weight_kg"]["maximum"]
|
||||
if constraints["roll_weight_kg"] is not None else None,
|
||||
},
|
||||
"production_maximums": result["production_maximums"],
|
||||
"material_weights_kg": result["material_weights_kg"],
|
||||
"warnings": result["warnings"],
|
||||
}
|
||||
|
||||
|
||||
def calculate_material_weight_result(
|
||||
|
||||
Reference in New Issue
Block a user