Harden MCP tool composition
This commit is contained in:
+14
-5
@@ -4,7 +4,11 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from roll_calculation import calculate_roll, get_article
|
||||
from roll_calculation import (
|
||||
calculate_roll,
|
||||
get_article,
|
||||
transport_roll_inputs_from_roll_calculation,
|
||||
)
|
||||
from transport_calculation import analyze_transport
|
||||
|
||||
|
||||
@@ -29,10 +33,9 @@ def calculate_roll_diameter_result(
|
||||
core_type: str | None = None,
|
||||
category: str | None = None,
|
||||
production_site: str | None = None,
|
||||
include_roll_weight: bool = False,
|
||||
) -> dict[str, Any]:
|
||||
"""Map MCP arguments to the existing CalculationRequest input shape."""
|
||||
return calculate_roll({
|
||||
"""Map MCP inputs to the existing calculation, always requesting weight."""
|
||||
result = calculate_roll({
|
||||
"article_number": article_number,
|
||||
"article_name_hint": article_name_hint,
|
||||
"roll_length_m": roll_length_m,
|
||||
@@ -44,8 +47,14 @@ def calculate_roll_diameter_result(
|
||||
"core_type": core_type,
|
||||
"category": category,
|
||||
"production_site": production_site,
|
||||
"include_roll_weight": include_roll_weight,
|
||||
"include_roll_weight": True,
|
||||
})
|
||||
if result.get("status") == "success":
|
||||
result = dict(result)
|
||||
result["transport_roll_inputs"] = (
|
||||
transport_roll_inputs_from_roll_calculation(result)
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
def analyze_transport_capacity_result(
|
||||
|
||||
Reference in New Issue
Block a user